-
Notifications
You must be signed in to change notification settings - Fork 9
Raspberry Pi (online)
This article may be outdated
This script turns a Linux rig into a JW Broadcasting "TV channel". This is not for your Plex server. Rather this is used instead of Plex.
- Videos are played randomly in a loop
- Resumes playback when restarting
- New videos get downloaded regularly (jwb-index)
- Old videos get deleted when disk space is low (jwb-index)
The guide is written for a Raspberry Pi, but naturally this can be used on any Linux box.
Install your distro of choice to a SD-card. A lite version of Raspbian is a good choice :)
You can login and configure the Pi from another computer, over SSH. To enable this, simply put an empty file on the Pi's SD-card, called
/boot/ssh
Boot the Pi. Now you can log in over SSH (example), or locally if you connect a keyboard and display to the Pi.
ssh pi@raspberrypi
The default user is pi
and password is raspberrypi
It could be a good idea to store the videos on an external drive, or a thumb drive. SD-cards have a tendency to break, after a year or so of heavy use in a Pi.
Plug in a USB drive, and run lsblk
to get its device name.
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 16G 0 disk
├─sda1 8:1 0 16G 0 part
In this case the device is called /dev/sda1
. Now edit /etc/fstab
and add the following line:
/dev/sda1 /home/pi/jwb vfat defaults 0 2
Create the mount point, and mount the USB drive.
mkdir /home/pi/jwb
sudo mount /home/pi/jwb
Install the required software
sudo apt-get update
sudo apt-get install omxplayer git python3 python3-setuptools curl
Download and install the JW scripts
git clone https://github.com/allejok96/jw-scripts.git
cd jw-scripts
sudo python3 setup.py install
Now you can start to fill up the collection of videos:
jwb-index --since 2017-01-01 --free 100 --download --limit-rate 0 /home/pi/jwb
Create the service file for video playback.
If you're not using a Pi, you have to specify a media player at the end of the
jwb-offline
command.
/etc/systemd/system/jwb-offline.service
[Unit]
Description=Play JW videos
[Service]
ExecStart=/usr/local/bin/jwb-offline /home/pi/jwb
User=pi
[Install]
WantedBy=multi-user.target
Enable and start it.
sudo systemctl enable jwb-offline
sudo systemctl start jwb-offline
If your Pi won't be having an internet connection, go to jwb-offline-import.
Create a service file and a timer. Tweak the options as you like (see jwb-index).
/etc/systemd/system/jwb-index.service
[Unit]
Description=Download the latest JW videos
[Service]
ExecStart=/usr/local/bin/jwb-index --latest --download --free 100 --no-warning /home/pi/jwb
User=pi
/etc/systemd/system/jwb-index.timer
[Timer]
OnCalendar=daily
Persistent=yes
[Install]
WantedBy=multi-user.target
Enable the timer.
sudo systemctl enable jwb-index.timer
Now you should have your own "JW Broadcasting TV station".