Created by CecilWesterhof.
I created a little script to play YouTube videos with mpv. There were several reasons for this:
At this moment it is a command line script, but I want to make a Tk version also. This will add at least the following functionalities:
Any ideas for extra functionalities are welcome.
The code:
#!/usr/bin/env tclsh proc getInput {prompt} { if {(${prompt} ne "") && ([string index ${prompt} end] ne " ")} { set prompt "${prompt}: " } puts -nonewline ${prompt} flush stdout gets stdin } while {True} { set URL [getInput "Enter YouTube URL (#q to exit): "] if {${URL} == "#q"} { break } else { if {[regexp {^https://www.youtube.com/watch\?v=(.){11}$} ${URL}]} { exec mpv --speed 1.5 ${URL} >&/dev/null } else { puts "Not a valid YouTube URL: ${URL}" } } }
As always: comments, tips and questions are appreciated.