diff --git a/examples/configpipath.txt b/examples/configpipath.txt new file mode 100644 index 0000000..3fadff0 --- /dev/null +++ b/examples/configpipath.txt @@ -0,0 +1,4 @@ +#this are the default(except it's in a folder /home/pi/youtube) this is the script that's run inside the ssh connection to run the script! +echo we in +cd youtube/gotubecast +bash vlcCostum.sh diff --git a/examples/readme.txt b/examples/readme.txt new file mode 100644 index 0000000..7a05210 --- /dev/null +++ b/examples/readme.txt @@ -0,0 +1,20 @@ +"Documentation"! + +Files and what they're for: + +On the raspberry: + -dumb.sh - default implementation in shell with gotubecast; + -raspi.sh - implementation in shell with gotubecast, omxplayer and youtube-dl; + -vlcCostum.sh - implementation in shell with gotubecast and cvlc (vlc without GUI); + +Now if you want to automate the process, with Windows: + -youtubePI.bat - auto open ssh and run commands on configyoutubepipath.txt + -configyoutubepipath.txt - cd into thhe right folders and run + Needs: + - Enable ssh on your raspberry and discover it's ip. + - Edit youtubePI.bat with the ip for ssh and it's credentials if you have changed them already. + - Edit configyoutubepipath.txt with the commands on ssh that you might need to open vlcCostum.sh / raspi.sh if you want. + + +-BearkillerPT + diff --git a/examples/vlcCostum.sh b/examples/vlcCostum.sh new file mode 100644 index 0000000..9c3f632 --- /dev/null +++ b/examples/vlcCostum.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# simple YouTube TV for Raspberry Pi +# kills any currently playing video as soon as a new video is queued +# ONLY NEEDS cvlc no need for youtube-dl +# Made this script out of the already existing raspi.sh +# by bearkillerPT :) +# +# Everything working kinda fine now... Specs: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html +# Finally managed to get it working though I'm having some issues with vlc not keeping up? Might be a connection issue: +# Log: +# [61cc0ad8] main decoder error: buffer deadlock prevented +# [00a50b70] main audio output warning: buffer too late (-27547070 us): dropped +# [00a50b70] pulse audio output warning: starting late (-30195 us) +# [00a50b70] main audio output warning: playback too late (125949): up-sampling +# Omxplayer wassn't working on my rasp and so this way you can also drop the youtube-dl dependecy + +export SCREEN_ID="" +export SCREEN_NAME="Raspberry Pi" +export SCREEN_APP="pitubecast-v1" +export OMX_OPTS="-o hdmi" +#export POS="1" + + +function omxdbus { + dbus-send --type=method_call --reply-timeout=12000 --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 $* +} + +function mult1000 () { + local floor=${1%.*} + [[ $floor = "0" ]] && floor='' + local frac='0000' + [[ $floor != $1 ]] && frac=${1#*.}$frac + POS=$(( ${floor}${frac:0:3} )) +} + +gotubecast -s "$SCREEN_ID" -n "$SCREEN_NAME" -i "$SCREEN_APP" | while read line +do + cmd="`cut -d ' ' -f1 <<< "$line"`" + arg="`cut -d ' ' -f2 <<< "$line"`" + case "$cmd" in + pairing_code) + echo "Your pairing code: $arg" + ;; + remote_join) + cut -d ' ' -f3- <<< "$line connected" + ;; + video_id) + echo "you/$arg" + killall -9 vlc + cvlc -v "http://youtu.be/$arg" /dev/null + ;; + stop) + omxdbus org.mpris.MediaPlayer2.Player.Stop >/dev/null + ;; + seek_to) + echo "Set Position: "$arg + mult1000 $arg + (( POS=$POS*1000 )) + STARTAGAIN64BIT=$(( -9223372036854775808 )) + omxdbus org.mpris.MediaPlayer2.Player.Seek int64:$STARTAGAIN64BIT >/dev/null + omxdbus org.mpris.MediaPlayer2.Player.Seek int64:$POS >/dev/null + #Here had to abuse seek function.... + ;; + set_volume) + if [ $arg -lt 100 ]; then + VOL=`echo $arg / 100 | bc -l | awk '{printf "%0.2f\n", $1}'` + fi + echo "Set Volume: " $VOL + omxdbus org.freedesktop.DBus.Properties.Set string:org.mpris.MediaPlayer2.Player string:Volume variant:double:$VOL >/dev/null + ;; + esac +done diff --git a/examples/youtubePI.bat b/examples/youtubePI.bat new file mode 100644 index 0000000..886d891 --- /dev/null +++ b/examples/youtubePI.bat @@ -0,0 +1,11 @@ +#This is also a configo file. +#SSH credentials can be modified here too +# SSH needs also putty on windows ::)))))))))) +#Defaultraspbian ssh credentials with the MY rasp's ip on MY router (enable ssh if you don't already have and check it's ip): +set login=pi@192.168.1.79 +set pass=raspberry +set app_path=youtube/gotubecast/examples/ +set app_name=vlcCostum.sh +ECHO \n +ECHO IMMA GET SOME YOUTUBE ACTION ON U LIL PI +putty.exe -ssh %login% -pw %pass% -m .\configpipath.txt \ No newline at end of file