add shortcuts

This commit is contained in:
Your Name 2022-06-05 12:09:33 +02:00
parent 73eccc64b5
commit a78c5bf7c3
5 changed files with 50 additions and 1 deletions

28
#youtube.py# Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import sys
import pychromecast
from pychromecast.controllers.youtube import YouTubeController
CC_IP = '192.168.178.22'
playing = True
video_id = sys.argv[1]
cast = pychromecast.Chromecast(CC_IP)
cast.wait()
yt = YouTubeController()
cast.register_handler(yt)
yt.play_video(video_id)
mc = cast.media_controller
for line in sys.stdin:
if playing:
mc.pause()
else:
mc.play()
playing = not playing

2
.shortcuts/ard.sh Executable file
View File

@ -0,0 +1,2 @@
python $HOME/chromeCast-py/das_erste.py

2
.shortcuts/ld-ka.sh Executable file
View File

@ -0,0 +1,2 @@
bash $HOME/db/ld-ka.sh

17
custom_url.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
import sys
import pychromecast
CC_IP = '192.168.178.22'
cast = pychromecast.Chromecast(CC_IP)
cast.wait()
mc = cast.media_controller
# see https://github.com/mediathekview/zapp/blob/0df9ea4eccc3ddc9ca9d344f7d5c1916e19696e0/app/src/main/res/raw/channels.json
mc.play_media(sys.argv[1], 'application/vnd.apple.mpegurl')
mc.block_until_active()

View File

@ -6,7 +6,7 @@ echo $url
if [[ "$url" =~ "youtube" ]]; then
video_id=$(echo $url | sed 's#https://www.youtube.com/watch?v=##g')
echo $video_id
youtube.py $video_id
python $HOME/chromeCast-py/youtube.py $video_id
exit 0
fi