My music is stored and sorted in /shared/music. To make it more
accessible for my Dreambox I want have the following playlists.
/shared/music/
<complete list of everything below>
/shared/music/P
<complete list of everything below P>
/shared/music/P/Prodigy
<complete list of everything below P/Prodigy>
First I was playing around with some Perl and came up with the following solution:
% cat m3u
#!/usr/bin/perl
while(<>) {
chomp;
chdir $_;
system("fapg -r . > playlist.m3u");
}
Which would then become
find /shared/music -type d | m3u
Only 2 things wrong with this solution
- Perl isn't needed
playlist.m3uis a bad filename sorting wise
For some odd reason I could not write it strait away in shell, but after some coffee it became
find /shared/music -type d | ( while read dir; do
cd "$dir" && fapg -r . > 00-PLAYLIST.m3u
done )
Note however that the usual find caveats apply: directories with a trailing space or directories with newlines in the name will not work.

