Search code examples
vlc

Play file with vlc using path from clipboard


So my scenario is that I've copied an http link (that I want to stream with vlc player) to the clipboard. I would like to write a simple script that plays the file located at the path on the clipboard. I've already tried

pbpaste | VLC -

pbpaste outputs the contents of the clipboard to stdout and "VLC -" attempts to play what's on stdout, so I was hoping VLC would pick up the path, read it, and then fetch the file to play, but apparently it expects an actual byte stream when you pipe things to it, not a string filepath. I've tried something similar on windows that failed so I don't think this is OS-specific

Any thoughts?

Thanks, sh4d0w


Solution

  • Try this:

    LOC=$(pbpaste); vlc -vvv $LOC
    

    It should work as long as you've copied the "http://" as well. In fact, it will work for any string as described in this manual chapter