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.
DDG Very interesting. As mpv supports like mplayer the --wid option for embedding, you might be use my SnitMPlayer as a starting point for a graphical version. Please note, that mplayers slave mode was however replaced with JSON IPC See https://github.com/mpv-player/mpv/blob/master/DOCS/man/ipc.rst