我正在尝试创建一个播放列表,它与您通常在 iTunes 中看到的“最近添加的专辑”播放列表的想法相同,但使用 $NUM_OF_DAYS_BEFORE 参数。
我使用了这篇文章中的大多数想法:如何递归地查找并列出具有子目录和时间的目录中最新修改的文件?
我创建了一个可以使用以下参数运行的脚本:
create_m3u /dir_root/with/mp3s 60
其中 $1 是我的 mp3 根目录(其中有文件夹也有 mp3) 其中 $2 是从今天开始我想创建 m3u 播放列表文件的天数。
脚本的主要部分是这个命令:
find $1 -type f -iregex '.*\.mp3' -mtime -$2 -exec stat --format '%Y %y %n' {} \; | \
sort -n | \
cut -d' ' -f5- | \
sed -e 's/^/\./'
现在我的问题是,上面的命令包括
cut d' ' -f5-
部分给了我这种类型的输出:
....
./RATKING - So It Goes - 2014 [V0]/09. Protein.mp3
./RATKING - So It Goes - 2014 [V0]/08. Puerto Rican Judo.mp3
./RATKING - So It Goes - 2014 [V0]/02. Canal.mp3
./RATKING - So It Goes - 2014 [V0]/05. Remove Ya.mp3
./RATKING - So It Goes - 2014 [V0]/04. So Sick Stories.mp3
./RATKING - So It Goes - 2014 [V0]/06. Eat.mp3
./RATKING - So It Goes - 2014 [V0]/03. Snow Beach.mp3
./RATKING - So It Goes - 2014 [V0]/07. So It Goes.mp3
./RATKING - So It Goes - 2014 [V0]/01. _.mp3
./RATKING - So It Goes - 2014 [V0]/10. Bug Fights.mp3
./RATKING - So It Goes - 2014 [V0]/11. Take.mp3
./Aesop Rock - The Blob (2014) [MP3 320]/01 The Blob.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/06 - Requiem.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/08 - Riot In My Brain!!.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/10 - Can't Let It Go.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/03 - Battling Voices From Beyond.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/02 - Meepy Morp.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/07 - Meepy Morp (Reprise).mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/09 - 7 SKIES H3 (Main Theme).mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/05 - Metamorphosis.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/04 - In A Dream.mp3
./The Flaming Lips - 7 Skies H3 (2014) [V0]/01 - 7 SKIES H3 (Can't Shut Off My Head).mp3
./G. Love & Special Sauce - 2014 - Sugar/14 - Bad Girl Baby Blues.mp3
./G. Love & Special Sauce - 2014 - Sugar/06 - Sugar.mp3
./G. Love & Special Sauce - 2014 - Sugar/10 - Windshield Wipers.mp3
./G. Love & Special Sauce - 2014 - Sugar/02 - Nite Life.mp3
./G. Love & Special Sauce - 2014 - Sugar/09 - One Night Romance.mp3
./G. Love & Special Sauce - 2014 - Sugar/03 - Good Life.mp3
./G. Love & Special Sauce - 2014 - Sugar/04 - Nothing Else Quite Like Home.mp3
./G. Love & Special Sauce - 2014 - Sugar/05 - Smokin Blues.mp3
./G. Love & Special Sauce - 2014 - Sugar/08 - Saturday Night.mp3
./G. Love & Special Sauce - 2014 - Sugar/13 - Run For Me.mp3
./G. Love & Special Sauce - 2014 - Sugar/07 - Weekend Dance #2.mp3
./G. Love & Special Sauce - 2014 - Sugar/12 - Too Much Month.mp3
./G. Love & Special Sauce - 2014 - Sugar/01 - Come Up Man.mp3
./G. Love & Special Sauce - 2014 - Sugar/11 - Cheating Heart.mp3
这是我想要的方式(部分) - 按专辑添加到文件系统/PC 的日期排序。但我另外想要的是让每张专辑按每个文件夹/专辑中的歌曲编号 01、02、03、04... 排序,而不是如上所示的无序数字。
有没有人对我如何以不同的方式做到这一点有什么建议,这样我才能得到想要的结果?