Skip to content

Instantly share code, notes, and snippets.

@siutin
Last active August 11, 2018 19:24
Show Gist options
  • Select an option

  • Save siutin/4501ec810eea5ea4e06d994d3b124447 to your computer and use it in GitHub Desktop.

Select an option

Save siutin/4501ec810eea5ea4e06d994d3b124447 to your computer and use it in GitHub Desktop.
simulate picture-in-picture for youtube in Ubuntu
mkdir ~/picture-in-pictures/
/bin/bash -c 'youtube-dl --ignore-errors --yes-playlist -o "${HOME}/./picture-in-picture/%(playlist_id)s-%(playlist_index)s" `xclip -selection c -o`'

start a player instance

vlc --video-on-top --qt-minimal-view --no-qt-video-autoresize --autoscale

enqueue video if playlist empty

vlc --started-from-file --playlist-enqueue filename

play video in the player instance

vlc --started-from-file filename
#!/bin/bash
[ $1 ]&&`vlc --started-from-file $([[ $(basename $1) != 00001* ]]&&echo "--playlist-enqueue") $1`||([ $(pgrep -x vlc) ]||(vlc --video-on-top --qt-minimal-view --no-qt-video-autoresize --loop&)&&youtube-dl -i -o "`mktemp -d`/%(autonumber)s%(id)s" --exec $0 `xclip -selection c -o`)
#!/bin/bash
SOURCE=${BASH_SOURCE[0]}
TEMP_FOLDER="${HOME}/.picture-in-picture/"
[ "$1" == "complete" ] && \
eval "vlc --started-from-file `[[ $(basename $2) != 00001_* ]] && \
echo "--playlist-enqueue"` $2 &" && \
exit 0
[ -z $(pgrep -x "vlc") ] && \
eval "vlc --video-on-top --qt-minimal-view --no-qt-video-autoresize --autoscale --loop &"
(mkdir -p $TEMP_FOLDER || exit -1) && \
/bin/bash -c 'youtube-dl \
--ignore-errors \
--yes-playlist \
-o "'$TEMP_FOLDER'%(autonumber)s_%(playlist_id)s_%(playlist_index)s" \
--exec "'$SOURCE' complete" \
`xclip -selection c -o`'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment