7

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
  • 7,456
  • 6
  • 54
  • 56

2 Answers2

14

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

ls | mpv --playlist=-
dec05eba
  • 156
  • 2
  • 3
  • 2
    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 Jul 13 '19 at 11:38
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
  • 131
  • 5