GOAL:
- We want to be able to have a pretty nice Screensaver such as a Real Streaming Aquearium or a Virtual 3D aquarium with relaxing sounds, or any else you can imagine.
- We also might have to have a movie as wallpapaer
So the idea is to use for example Youtube as a source to playing videos as Wallpaper or as ScreenSaver.
Take a look at some pictures and the i'll explain howto do it.
Real Auqrium (movie at the top as screensaver Youtube)
Virtual Aquarium (movie youtube)
https://www.youtube.com/watch?v=5f2T-5mq_UY
Virtual Aquarium (movie youtube)
https://www.youtube.com/watch?v=VMxuo4sJ7iM
Virtual Fire (movie youtube)
https://www.youtube.com/watch?v=0fYL_qiDYf0
Basically, we're going to enjoy by playing long streaming youtubes movies as Wallpapers or screensavers for even hours.
HOW IS IT DONE??:
0- We will use VLC to play streaming videos from YOUTUBE:
--> some VLC version can play directly youtube video, others need youtube-dl command
examples:
Code: Select all
vlc --video-wallpaper https://www.youtube.com/watch?v=5f2T-5mq_UY
vlc --video-wallpaper $(youtube-dl -g https://www.youtube.com/watch?v=5f2T-5mq_UY)
--> for this we use param starttime: vlc --start-time $STARTIME
--> we'll use RANDOM linux param for starting time
2- We'll configure VLC to play as screensaver:
2.1- We'll need to install xautolock y xtrlock. http://tuxdiary.com/2015/01/07/xautolock/
--> xautolock launch command to inactivity time
--> xtrlock to locks screen keyboard and mouse, and at the same time allow to watch desktop.
sudo apt-get install xautolock xtrlock
3- We'll set some hotkeys in VLC, so that we'll will be able to invoke them fomr the script with xdotooltry --> xautolock -time 10 -locker xtrlock
xautolock -time 10 myscreensaver.sh (we will use xautolock to lauch our own script,)
--> Well invoke kotkey for Full screensave at the topsudo apt-get install xdotool
xdotool key ctrl+shift+v
xdotool key ctrl+shift+v ---> (mapping on vlc with function hotkeys: Change to mode background Desktop )
This function conmute to background or foreground movie VLC when playing with param mode --video-wallpaper.
I hope you enjoy, because its so easy and cool that i didn't now i was possible..
-------------------------------------------------------
The script for Screensaver will follow this easy flow
0- Set a list of 10 youtube videos with their respectvly times (youll have to calculate them to seconds to play with param --start-time), so we can use their times to established periods startings times (length move/10).
1- With param RANDOM choose ramdomly one of the movies to play everytime screensaver launches (xautolock reach time)
2- With param RANDOM calculate ramdomly starting times, so we can enjoy long movies without to play it repeatly from the beginng
--start-time $STARTIME
3- Screensaver locks (launch xtrlock)--> from this time on you are locked.
4- lauch youtube movie as desktop background
cvlc --video-on-top --start-time $STARTIME --loop --autoscale --video-wallpaper --no-video-title-show $VIDEO &
5- Change VLC to playe on mode top or foreground full scrren:
--> Unlock for a microsecond, so xdotool can command to vlc to play at the front, so you can watch the movie with the desktop hidden like a porpertly screensaver. (killall xtrlock)
--> xdotool key ctrl+shift+v --> gives order to VLC to play full top screen
6- lock again once the movie play the whole screen (xtrlock) .
To launch screensaver scheduled:
xautolock -time 10 -locker wallpaperscreensaver.sh
or more complete, with suspend command after screensaver running for a while
xautolock -time 12 -detectsleep -killtime 10 -killer "systemctl suspend" -locker wallpaperscreensaver &
And Now the script wallpaperscreensaver.sh :
#!/bin/bash
#
# Lista de 10 videos
#Video DEFFAULT
#6 Hour REAL VIDEO Ocean
VV=https://www.youtube.com/watch?v=zJ7hUvU-d2Q
DD=6*3600
#-------------------#-------------------
#---------------------------------------
#Lista de video 10----------------
#-------------------#-------------------
V1=https://www.youtube.com/watch?v=VMxuo4sJ7iM
D1=5*3600
#-------------------
#Aquarium 2hr relax music
V2=https://www.youtube.com/watch?v=VIrBecB746c
D2=2*3600
# Aquarium
V3=https://www.youtube.com/watch?v=5f2T-5mq_UY
D3=2*3600
#1ho Aqu
V4=https://www.youtube.com/watch?v=tJBJp6BCVhQ
D4=1*3600
#Muy bueno 4k Aqua
V5=https://www.youtube.com/watch?v=0vYb9TcUo0Q
D5=20*60
#10min 4 K Tropical Reef Aquarium i
V6=https://www.youtube.com/watch?v=T6UTVcmxHT4
D6=10*60
#Akvaryum, Aquarium, Fish Tank
V7=https://www.youtube.com/watch?v=lfbX2PwENiE
D7=30*60
#Aquarium HD HQ All Platforms
V8=https://www.youtube.com/watch?v=C5qJgZsW8o0
D8=50*60
#Burning Fireplace
V9=https://www.youtube.com/watch?v=0fYL_qiDYf0
D9=2*3600
#----------------------------------------------------------- NO MODIFICAR DE AQUI EN ADELANTE
xtrlock &
killall vlc
#Seleccionde videl de forma aleatoria
count=1
NVIDEOS=10
echo "-----------------"
while [ "$count" -le $NVIDEOS ] # Generate 10 ($MAXCOUNT) random integers.
do
#number=$RANDOM
SELEC=$((RANDOM%$NVIDEOS+1))
let "count += 1" # Increment count.
done
#-----------------------------------------------------------
case $SELEC in
1) echo "one"
MAXLEN=$D1; VIDEO=$V1;;
2) echo "two"
MAXLEN=$D2; VIDEO=$V2;;
3) echo "three"
MAXLEN=$D3; VIDEO=$V3;;
4) echo "four"
MAXLEN=$D4; VIDEO=$V4;;
5) echo "five"
MAXLEN=$D5; VIDEO=$V5;;
6) echo "six"
MAXLEN=$D6; VIDEO=$V6;;
7) echo "seven"
MAXLEN=$D7; VIDEO=$V7;;
echo "eight"
MAXLEN=$D8; VIDEO=$V8;;
9) echo "nine"
MAXLEN=$D9; VIDEO=$V9;;
10) echo "ten"
MAXLEN=$D10; VIDEO=$V10;;
*) echo "INVALID NUMBER!"
MAXLEN=$DD; VIDEO=$VV;;
esac
if [ "$VIDEO" == "" ]; then
echo "Video $SELEC no programado"
MAXLEN=$DD; VIDEO=$VV
fi
echo "Seleccionado video nº $SELEC, con duracion $MAXLEN"
count=1
echo "-----------------"
while [ "$count" -le 10 ] # Generate 10 ($MAXCOUNT) random integers.
do
TIEMPO=$((RANDOM%9+1))
# echo $TIEMPO
let "count += 1" # Increment count.
done
echo "normalizado a $TIEMPO/10"
STARTIME=$(($TIEMPO*$MAXLEN/10))
echo $STARTIME
echo "-----------------"
echo "START TIME=$STARTIME"
sleep 5
nohup cvlc --video-on-top --start-time $STARTIME --loop --autoscale --video-wallpaper --no-video-title-show $VIDEO &
amixer set Master 25% on
sleep 40
amixer set Master 25% on
killall xtrlock
xdotool key ctrl+shift+v
xtrlock &