This little think downloads youtube-dl compatible videos and adds them to your MPD. ATTENTION: all this is quick and dirty :)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fastcloudtube.py 588B

123456789101112131415161718192021
  1. #!/usr/bin/env python3
  2. from bottle import route, run, template
  3. from subprocess import call
  4. @route("/")
  5. @route("/<link:path>")
  6. def index(link=""):
  7. if(link == ""):
  8. return "Please add a youtube-dl compatible link"
  9. else:
  10. return download(link)
  11. def download(link):
  12. try:
  13. call(["youtube-dl", """--no-playlist --output "%(playlist_title)s%(ext)s" --write-thumbnail --extract-audio --audio-quality 9 --embed-thumbnail """])
  14. except OSError:
  15. return "youtube-dl is not installed on the host"
  16. except:
  17. return "some strange error happened"
  18. run(host="0.0.0.0", port=1995, reloader=True)