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

23,861

Solution 1

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.

Solution 2

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
Share:
23,861

Related videos on Youtube

Aaron Hall
Author by

Aaron Hall

NixOS is the new Arch Linux - nixos.org NixOS has the most up-to-date packages and now, the most packages If you want to thank me: financially? make a donation in my name to this young lady's gofundme Follow me on Twitter and tell me what canonical questions you would like me to respond to! (If you keep it to programming, I may follow you back.) Please critique my recent answers If I know you, please connect with me on LinkedIn. Miscellaneous information about me: my .ghci file (for Haskell): :set +m :set prompt "λ: " :set prompt-cont " | " on code review Landslide Elected Stack Overflow moderator, ♦ My Haskell Posts HackerRank Python Talks: PyCon: __slots__ PyGotham: Reusable Python PyGotham: Python Datamodel N-Languages NYC: Python Code licenses: CC-BY-SA/MIT

Updated on September 18, 2022

Comments

  • Aaron Hall
    Aaron Hall over 1 year

    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.