Skip to content

Commit 8bafbfd

Browse files
committed
Add install script
1 parent 7801fbf commit 8bafbfd

File tree

3 files changed

+75
-27
lines changed

3 files changed

+75
-27
lines changed

install.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Watch TV install script
4+
# https://github.com/phpbg/watchtv
5+
6+
# -e option instructs bash to immediately exit if any command has a non-zero exit status
7+
set -e
8+
9+
command_exists () {
10+
command -v $1 >/dev/null 2>&1;
11+
}
12+
13+
if [[ $EUID -ne 0 ]]; then
14+
echo "This script must be run as root"
15+
exit 1
16+
fi
17+
18+
if ! command_exists apt; then
19+
echo "This script is compatible only with debian and its derivatives (e.g. raspbian,ubuntu)"
20+
exit 1
21+
fi
22+
23+
echo "Updating packages metadata"
24+
apt update &> /dev/null
25+
26+
echo "Installing dependencies"
27+
apt -y install php-cli dvb-tools
28+
29+
echo "Creating watchtv user and group"
30+
if id watchtv >/dev/null 2>&1; then
31+
echo "User already exists"
32+
else
33+
useradd -U watchtv -M -G video
34+
fi
35+
36+
echo "Copying to /opt/watchtv"
37+
cp -r ./ /opt/watchtv
38+
39+
echo "Installing systemd service"
40+
cp -f watchtv.service /etc/systemd/system/
41+
systemctl daemon-reload
42+
systemctl restart watchtv
43+
systemctl enable watchtv
44+
45+
echo "Success, you may now remove current directory. Open you browser and browse http://localhost:8080/"

readme.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,20 @@ This is a small server that allows you to watch digital television on your compu
1212
* watch simultaneously all channels in the same multiplex
1313
* logical channel numbering (please note that this is not standard and may depend on your country)
1414

15+
## Quick installation (debian, raspbian, ubuntu)
16+
```shell
17+
wget https://github.com/phpbg/watchtv/releases/download/1.0.0/watchtv-1.0.0.tar.gz
18+
tar xf watchtv-1.0.0.tar.gz
19+
sudo ./install.sh
20+
```
21+
1522
## Is is compatible in my country?
1623
Use [this map](https://fr.wikipedia.org/wiki/DVB-T#/media/File:Digital_terrestrial_television_standards.svg) to know your broadcasting technology.
1724
* **This has been developed and tested on a DVB-T network only**, with MPEG-4 (H.264) streams.
1825
* It will probably work on DVB-T2 (not tested yet).
1926
* It may work on other networks (Cable, Satellite, ATSC), but it is yet untested.
2027
* Please open an issue or merge request to report your success or failure to improve this software.
2128

22-
## Status - 1.0 milestone
23-
* It is working and functionnal
24-
* Needs more testing before stable release
25-
* Needs packaging for common linux distributions (at least Debian/Raspbian/Ubuntu)
26-
* Needs DVBV5 stability fixes to be upstreamed
27-
28-
## Ideas for future releases
29-
* browse whole electronic program guide (EPG) on the web interface (currently you can just view running EPG in the web page, full EPG is available with Kodi)
30-
* live update web interface to reflect avaliable channels when a stream is already running
31-
* multiple adapter support
32-
* pause (live recording)
33-
* scheduled recording
34-
* remote
35-
* performance improvements (starting a channel is way too slow)
36-
* watch TV directly in the browser with HTTP_Live_Streaming
37-
* https://en.wikipedia.org/wiki/HTTP_Live_Streaming
38-
* https://tools.ietf.org/html/rfc8216
39-
4029
## Requirements
4130
You can run the server and the client on the same device if you want.
4231

@@ -60,15 +49,15 @@ You can run the server and the client on the same device if you want.
6049
* A TV adapter
6150
* ethernet network. Wifi works but please avoid wifi: **wifi is not that reliable**. I do not recommend you use wifi for the server side.
6251

63-
This is compatible with raspberry pi, but note that there is a bug that WILL crash your raspberry sooner or later. Please wait for bug resolution before using this on your raspberries: [bug report](https://bugs.launchpad.net/raspbian/+bug/1819650)
52+
**IMPORTANT**: there is a bug in dvbv5 that may crash your raspberry sooner or later. Please wait for bug resolution before using this on your raspberries: [bug report](https://bugs.launchpad.net/raspbian/+bug/1819650). If you experience the issue I highly suggest you install and use dvbjet from https://github.com/lightful/DVBdirect , it is faster and stable.
6453

6554
A raspberry zero-w is enough, although I recommend you something more reliable:
6655
* the raspberry zero will be pushed at it's own limits (expect 80% to 100% CPU)
6756
* it has wifi only (you may try USB attached ethernet adapter)
6857
* some TV dongles require a lot of current, and some power supplies don't handle this corectly
6958
* Raspberry pi does not have a reliable wifi (at least raspberry-zero and raspberry 3B have wifi troubles - raspberry 3B+ seems not to be affected). Discussion [here](https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=188891&sid=afdef6524bddc08ec983fe57bb3a797c) and [here](https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=234058)
7059

71-
## Installation
60+
## Manual installation
7261

7362
1. Install requirements
7463
Ubuntu / raspbian
@@ -82,7 +71,7 @@ A raspberry zero-w is enough, although I recommend you something more reliable:
8271
2. Download latest release package from https://github.com/phpbg/watchtv/releases
8372
3. Extract it
8473
```shell
85-
$ tar xf watchtv-0.6.0.tar.gz
74+
$ tar xf watchtv-1.0.0.tar.gz
8675
```
8776
3. Test the server manually
8877
```shell
@@ -93,8 +82,8 @@ A raspberry zero-w is enough, although I recommend you something more reliable:
9382
## Installing as a service with systemd
9483
If you want the server to start automatically at boot, install it as a service.
9584
1. edit `watchtv.service`
96-
* fix `ExecStart` path
97-
* set `User` and `Group`
85+
* change `ExecStart` path, or copy the files extracted to `/opt/watchtv`
86+
* change `User` and `Group` or create watchtv user with `useradd -U watchtv -M -G video`
9887
2. copy `watchtv.service` to `/etc/systemd/system/`
9988
```shell
10089
$ sudo cp watchtv.service /etc/systemd/system/
@@ -118,7 +107,7 @@ To check logs run `$ journalctl -u watchtv`
118107
See [here](https://www.linuxtv.org/wiki/index.php/Hardware_device_information) for a complete list of DVB digital devices that **should** be compatible.
119108
Tested:
120109
* TerraTec Cinergy T Stick+: OK
121-
* RTL SDR v2: OK but some glitches appears after a few hours (when the dongle is hot)
110+
* [RTL SDR v2](https://www.rtl-sdr.com/): OK but some glitches appears after a few hours (when the dongle is hot)
122111
* [Raspberry TV HAT](https://www.raspberrypi.org/blog/raspberry-pi-tv-hat/) **should** work. If you have one please open an issue or a merge request to report the status (try to run it for many hours to check longterm stability). Note: this device use [SPI at 55Mhz](https://patchwork.kernel.org/patch/10003465/#21035387). I don't know yet if this is sufficient to watch *all* channels within a multiplex...
123112

124113
### Horizontal lines (more or less visible) on image
@@ -128,6 +117,20 @@ With mpv, try pressing `d` to activate deinterlace
128117

129118
If it works, you can make it permanent with `deinterlace=yes` in `~/.config/mpv/mpv.conf`
130119

120+
## Ideas for future releases
121+
* Packaging for common linux distributions
122+
* Support Fedora and arch in install script
123+
* browse whole electronic program guide (EPG) on the web interface (currently you can just view running EPG in the web page, full EPG is available with Kodi)
124+
* live update web interface to reflect avaliable channels when a stream is already running
125+
* multiple adapter support
126+
* pause (live recording)
127+
* scheduled recording
128+
* remote
129+
* performance improvements (starting a channel is way too slow)
130+
* watch TV directly in the browser with HTTP_Live_Streaming
131+
* https://en.wikipedia.org/wiki/HTTP_Live_Streaming
132+
* https://tools.ietf.org/html/rfc8216
133+
131134
## Contributions
132135
After cloning the project run:
133136

watchtv.service

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Description=Watch TV server
33
After=network.target
44

55
[Service]
6-
ExecStart=/usr/bin/php /your/path/to/watchtv/server.php
6+
ExecStart=/usr/bin/php /opt/watchtv/server.php
77
Type=simple
8-
User=<your user>
9-
Group=<your group>
8+
User=watchtv
9+
Group=watchtv
1010
Restart=always
1111
RestartSec=3s
1212

0 commit comments

Comments
 (0)