-
Notifications
You must be signed in to change notification settings - Fork 1
/
youtube_on_linux
46 lines (40 loc) · 1.45 KB
/
youtube_on_linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# install
apt install -y xinit x11-utils chromium xdotool fbset
# configure
sed -i -e 's/console/anybody/g' /etc/X11/Xwrapper.config
echo '*/5 * * * * root export DISPLAY=:0.0 ; xdotool key Ctrl > /dev/null 2>&1 ' | tee -a /etc/cron.d/nosleep > /dev/null
# create service
# note 1: the &loop option only works if you also define the &playlist option
# note 2: the &autoplay option only works if you also define the &mute option
bash -c cat > /etc/systemd/system/browser.service << 'EOL'
[Unit]
Description=browser service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/bin/bash -c " \
videoid=$(echo $youtubeurl | sed -n 's/.*v=\(.*\)/\1/p') \
width=$(fbset -s | awk '/geometry/ { print $2 }'); \
height=$(fbset -s | awk '/geometry/ { print $3 }'); \
xinit /usr/bin/chromium \
--aggressive-cache-discard \
--no-sandbox \
--enable-features=OverlayScrollbar \
--start-fullscreen \
--kiosk \
--noerrdialogs \
--no-first-run \
--fast \
--fast-start \
--disable-infobars \
--window-size=$width,$height \
'https://www.youtube.com/embed/'$videoid'?&autoplay=1&mute=1&loop=1&playlist='$videoid -- -nocursor"
Restart=always
[Install]
WantedBy=multi-user.target
EOL
systemctl daemon-reload
systemctl enable browser.service
systemctl start browser.service