Play Playlist with mpv

Here's how to play a list of songs with mpv.

Make Your Playlist

Create a file with the path of each track on a separate line. You can create your playlist with cmus.

It'll look something like this:

/mnt/mynas/music/Whitney Houston - Singles/01 I Wanna Dance With Somebody (Who Loves Me).m4a
/mnt/mynas/music/Whitney Houston - Singles/05 - So Emotional.mp3
/mnt/mynas/music/Who - Singles/06 Pinball Wizard (Original Album Version).m4a

Put that file somewhere consistent, like /mnt/mynas/playlists/80s.txt

Play the Playlist

mpv is a great media player. You can play the playlist with the --playlist flag:

mpv --playlist=/mnt/mynas/playlists/80s.txt

And if you're like me and didn't know that there was a --playlist flag, you can make a script, playlist.sh to play your playlist by name. That's the power of putting your playlists in a consistent location with memorable names:

#!/bin/bash

cat "/mnt/jakebank/playlists/$1.txt" | sed -e "s/\(.*\)/'\1'/" | xargs mpv $@

Put that script in your PATH, and you can let the 80s roll:

playlist.sh 80s

Or pass args to mpv:

playlist.sh 80s --shuffle --no-video