Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Re: building m3u-playlists from bash in unix

Re: building m3u-playlists from bash in unix

From: Brendan Hack <bendy_at_bendys.com>
Date: Thu, 02 Oct 2003 21:03:51 +1000

Or you could do it with perl and not have to do the escaping:

find ~/Music/ -type f -name \*.mp3 | perl -p -e
's|/Users/svante/Music/|/A-C/|' > playlist.m3u

and if you use three letter spacings for all your categories (ie: A-C is
for artists who start with that letter range followed by
D-F,G-I,J-L,M-O,P-R,S-U,V-X and Y-Z) you can try this:
 
find ~/Music/ -type f -name \*.mp3 | perl -p -e
's|/Users/svante/Music/(.*)|sprintf
"/%c-%c/$1",ord("A")+3*int((ord(uc($1))-ord("A"))/3),($b=ord("A")+3*int((ord(uc($1))-ord("A"))/3)+2)>ord("Z")?ord("Z"):$b|e;'

And it should do the directory classification for you. Not guaranteed
and certainly could be done cleaner.

Though you probably don't have 3 letters in each directory though. It's
not too hard to make it do arbitrary sized groups but it's well beyond
the scope of this email.

bendy


Gajdos_at_metatem.net wrote:

>You can pipe it through 'sed' - it's got a nice search/replace function:
>find ~/Music/ -type f -name \*.mp3 | sed 's/Users\/svante\/Music/A-C/' >playlist.m3u
>
>(the '/' acts as a separator in 's/search-for/replace-with/', so it has to
>be escaped with '\' in the actual search string.)
>/JG
>
>
>On Thu, 2 Oct 2003 at 08:50, svante t wrote:
>
>
>
>>Hey all,
>>I have a slight *nix-problem I want some help with, a little bit off
>>topic maybe...
>>I learned how to make m3u-playlists straight from my prompt by using this:
>>
>>find ~/Music/* -type f -name '*.mp3' > ~/Music/Playlist.m3u
>>
>>Now, the problem is that I dont always mirror my files locally
>>exactly like on my archos. So how do I modify the above to put in
>>another path than the output? More exactly, how do I change the
>>output from /Users/svante/Music/Artist/Track.mp3 to
>>/A-C/Artist/Track.mp3
>>
>>There is probably some supersmart command to put in between the two
>>commands above, and I want to know how. Any wizard out there who can
>>guide me?
>>
>>/Svante
>>
>>
>
>
>
Received on 2003-10-02

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy