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

  1. Perl isn't needed
  2. playlist.m3u is 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.

Tags: dreambox, linux

0 comments

Comments are closed

If you really, really want to comment, please mail miek@miek.nl.

0 comments in moderator queue