18

How do you make a universal playlist from a directory of mp3 files?

This question came up as my wife is a musician (violinist) and she has a gig, and the DJ at the event will be playing her accompanying music for her. He told her to bring a thumbdrive with her music on it. She asked me to help her make a playlist. Since I don't know what sort of operating system the DJ has or will be using, I need a universal format, and I need to accomplish this without expending a great deal of effort.

Googling did not provide me with answers, even when I added Ask Ubuntu to the search.

So the question is:

How do you make a universal playlist from a directory of mp3 files?


Note that after writing this up, I found How can I generate an M3U playlist from the terminal?, but the use-case is different (requiring a different answer as well), and the question being asked here is not aware of the existence of m3u.

3 Answers 3

26

How to make a playlist from a directory of mp3 files?

cd to the directory and

ls -1 *.mp3 > playlist.m3u

It turns out that there exists a fairly universal format called m3u format, and it can be as simple as a list of filenames separated by newlines.

After my wife had moved the mp3 files she wanted onto an empty thumb drive, I opened a terminal, browsed to the media directory, and typed the following and hit enter:

ls -1 *.mp3 > playlist.m3u

I then opened the file for her in gedit and let her copy and paste the lines around as much as she wanted to get them into her desired order.

When she was done, she saved the file, double-clicked it in a folder browser, and RhythmBox opened it. She clicked play, and it played, and I was a hero.

0
5

Shuffle Playlist

Bash script example for Pi Musicbox with USB HDD (generatePlaylist.sh)...

find /music/USB/mp3/* -iname *.mp3 -type f | shuf | head -n 200 > /music/playlists/mp3_shuffle.m3u

combined with crontab job to run every 4 hours...

0 */4 * * *     root    /music/playlist/generatePlaylist.sh
1

mkpl

with mkpl all is easy:

  1. Create a playlist for one music album:

    cd myalbum
    mkpl myalbum.m3u
    
  2. Create a playlist of a film saga

    mkpl -d HarryPotter -f mkv HP_saga.m3u
    
  3. Create a shuffled playlist with my music collection

    mkpl -d "my_mp3_collection" "my_mp4_collection" -rs "my music.m3u"
    
  4. Create a shuffled playlist with my music collection and exclude dirs

    mkpl -d "my_mp3_collection" "my_mp4_collection" -r -s -e "my_mp3_collection/metallica" "my_mp3_collection/dk" "my music.m3u"
    
  5. Create a TV series playlist with max 15 tracks

    mkpl -d "my_series/GOT" -m 15 "got_first_15.m3u"
    
  6. Add into my_music playlist new songs and don't add same file

    mkpl -d "new_collection" -rsu "my music.m3u" -a
    
  7. Create playlist with music and video files if files is greater then 10MB

    mkpl -d "my_files" -r -z 10485760 "multimedia.m3u"
    
  8. Create playlist with only number one and two tracks wit regular expression

    mkpl -d "my_mp3_collection" -r -p "^[12]|[012]{2}" "my music.m3u"
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .