Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Burn songs from a .m3u Playlist in given order...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
tragor
Apprentice
Apprentice


Joined: 21 May 2003
Posts: 168
Location: Freiburg i.Br., Germany

PostPosted: Tue Sep 19, 2006 9:00 pm    Post subject: HOWTO: Burn songs from a .m3u Playlist in given order... Reply with quote

Hi!

Ever wanted to burn a playlist you created in amarok or alike? If you would simply use the function inside amarok to burn all selected titles in the playlist amarok would open k3b and add the files. *But* they wouldn't be in the order they appeared in the playlist, instead they would be sorted by filename!

I had exactly this problem, so I wrote a script that copys all songs in a m3u playlist to the current directory and numbers them. To preserve the original order padding with zeros is used for the counter, so you would get like

Code:

001_song1.mp3
002_song2 extra long.Mp4
003_another song.aac
...
123_last song.flac


Here is the bash script:

Code:

#!/bin/bash

number=`grep -Eshc '^/' $*`;
i=1;
grep -Esh '^/' $* | while read file; do
  count=`printf "%0${#number}d" "${i}"`;
  printf "copying file: ${file##/*/} ...";
  cp "$file" "./${count}_${file##/*/}";
  printf " done!\n";
  let i+=1;
done;


Just save it in a file named e.g. copyPlaylist, save it in your path and make it executable. Then call it like this

Code:

sh copyPlaylist [path_to_playlist_file]/playlist.m3u


All songs are copied to the current directory.

If you would like to make a mp3 sampler cd or dvd you may want to use mp3gain afterwards to make all mp3s the same volume:

Code:

sh copyPlaylist [path_to_playlist_file]/playlist.m3u && mp3gain ./*


Have fun!

tragor
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum