maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Multimedia (https://talk.maemo.org/forumdisplay.php?f=32)
-   -   Script to create M3U playlists for each folder in MyDocs/.sounds (https://talk.maemo.org/showthread.php?t=59508)

leojab 2010-07-31 20:20

Re: Script to create M3U playlists for each folder in MyDocs/.sounds
 
All my music is on my 16 Gb SD card and it plays fine from there on my N900.
Question, all my songs are in m4a format so does m3u support this format.. thanks. I do not want to use mp3 going forward as well.

j.s 2010-07-31 21:11

Re: Script to create M3U playlists for each folder in MyDocs/.sounds
 
Quote:

Originally Posted by dave1010 (Post 771126)
I've created this script that makes a playlist for each folder in your music. This lets you play a folder at a time with the default media player.

Code:

cd ~/MyDocs/.sounds
for i in *; do
  echo Processing $i
  if [ -d "$i" ]; then
    find "$i/" -type f -iname "*.mp3" > "$i.m3u"
  fi
done


The following also addresses date ordering.

If the playlist is in the same directory as the audio files, no path information is needed in the playlist. This also makes it easy to move directories around on a device or between devices.

Code:

cd  $1
for i in *; do
  echo Processing $i
  if [ -d "$i" ]; then
    cd $i
    ls "*.mp3" "*.ogg" "*.wma" > "$i.m3u"
    cd ..
  fi
done

To sort by date:

Code:

cd  $1
for i in *; do
  echo Processing $i
  if [ -d "$i" ]; then
    cd $i
    ls -rt "*.mp3" "*.ogg" "*.wma" > "$i.m3u"
    cd ..
  fi
done


dave1010 2010-07-31 21:50

Re: Script to create M3U playlists for each folder in MyDocs/.sounds
 
Quote:

Originally Posted by leojab (Post 771635)
Question, all my songs are in m4a format so does m3u support this format.

M3U playlists should support any file - I think even videos. Just change the find line to:
Code:

find "$i/" -type f -iname "*.m4a" > "$i.m3u"

dave1010 2010-07-31 21:57

Re: Script to create M3U playlists for each folder in MyDocs/.sounds
 
j.s, that's a great idea using ls instead of find. I keep most of my music in an Arist/Album/Track structure so it woudn't work so well some of the time. I'm experimenting with ls -R (recursive) but it's not getting the whole path.

kl2010 2010-07-31 22:47

Re: Script to create M3U playlists for each folder in MyDocs/.sounds
 
Quote:

Originally Posted by soeiro (Post 771329)
You must run it again when you make changes. However, you could also create a desktop shortcut to make it easier to start.

pls how do i make it as a desktop shortcut? thanks.

dave1010 2010-08-01 17:24

Re: Script to create M3U playlists for each folder in MyDocs/.sounds
 
Quote:

Originally Posted by kl2010 (Post 771703)
pls how do i make it as a desktop shortcut? thanks.

  1. Save the script at the top of this thread as a file as /home/user/make-playlists.sh
  2. Install Queen Beecon Widget
  3. Add the Queen Beecon widget to your desktop
  4. Configure it and add /home/user/make-playlists.sh as a customnew command

karblast 2010-08-20 11:34

Re: Script to create M3U playlists for each folder in MyDocs/.sounds
 
Hi.. M sure my question might sound lame! but m not aware of how one is supposed to use scripts!! Pls guide me on how i am supposed to install this script in my fone to be able to play my tracks by folders!! Thanks in advance!!


All times are GMT. The time now is 00:02.

vBulletin® Version 3.8.8