Skip to content

Instantly share code, notes, and snippets.

@hldr4
Last active December 28, 2021 23:38
Show Gist options
  • Save hldr4/b0389efefee53e6368b088f9ae8d2557 to your computer and use it in GitHub Desktop.
Save hldr4/b0389efefee53e6368b088f9ae8d2557 to your computer and use it in GitHub Desktop.
Simplifies http(s) streaming with mpv a little
import sys, subprocess
'''
Required: mpv and this script in PATH
Replace username and password with yours (eg for a seedbox)
Copy direct link to file from your FTP directory listing
Example: mpv.py https://host.seedhost.eu/user/downloads/Vice.2018.1080p.BluRay.DDP.5.1.x264-decibeL.mkv
use -l to print the edited link and exit
'''
username = 'username'
password = 'password'
url = f'https://{username}:{password}@{sys.argv[1].split("https://")[1]}'
try:
if sys.argv[2] == '-l': print(f'\n{url}'); exit(0)
except IndexError:
try: subprocess.Popen(['mpv', url]); exit(0)
except IndexError: print('\nProvide a link'); exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment