mpv: how to play a list of URLs piped from stdin

2

Is there a way to get mpv to play a list of URLs that are piped from another command's stdout?

My use case is to play all media links from an HTML page, e.g. with something like this:

extractlinks.py http://example.com '*.mp3' | mpv

extractlinks.py returns a list of playable URLs which could normally be considered a valid m3u playlist. I tried using mpv --playlist but it's not accepting the playlist from stdin.

Is there a way to get mpv to read a list of URLs from stdin?

ccpizza

Posted 2019-04-17T15:50:04.307

Reputation: 5 372

Answers

2

The --playlist option allows you to specify a playlist from stdin if you use - as path, Example:

ls | mpv --playlist=-

dec05eba

Posted 2019-04-17T15:50:04.307

Reputation: 36

Thanks a bunch! Exactly what I was looking for! – ccpizza – 2019-06-27T20:01:09.783

btw, for the specific case you list in your example, ie, playing all files in a local folder, you can simply use mpv . — this will additionally traverse all the subfolders recursively. – ccpizza – 2019-07-13T11:38:22.023

0

As @ccpizza points out in the comment above. You can use mpv . to play all the file inside directory and subdirectory.

To exclude some file, use $ mpv !(*.jpg|*.png). Remember you need to activate your extglob beforehand, shopt -s extglob.

azzamsa

Posted 2019-04-17T15:50:04.307

Reputation: 121