README.md 2.59 KB
Newer Older
birk's avatar
birk committed
1
2
3
4
5
Sender Medienarchiv der Künste
==============================

![](https://medienarchiv.zhdk.ch/media/822530be-7300-4332-9049-5ad905ac3df6)

birk's avatar
birk committed
6
## System installation
7

birk's avatar
birk committed
8
9
10
11
12
13
14
15
16
17
18
19
Install Ubuntu 16.04 LTS.

In *Settings > System > Details* change the device name to `nipkow`. In *Settings > User* create a main admin user `itz` with automatic login enabled. In *Settings > Brightness & Lock* disable the screen saver.

In the Terminal update the system and change the keyboard layout.

```bash
sudo apt-get update  
sudo apt-get install unattended-upgrades  
setxkbmap ch  
```

birk's avatar
birk committed
20
21
22
23
24
25
Enable automtic security update.

```bash
sudo dpkg-reconfigure unattended-upgrades
```

birk's avatar
birk committed
26
27
28
Install necessary software.

```bash
birk's avatar
birk committed
29
sudo apt-get install python3-pip python-pyglet virtualenvwrapper git supervisor openssh-server samba-common-bin
birk's avatar
birk committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
```

Add your own public key form remote access to `~/.ssh/authorized_keys`.

## Player installation

Create a virtual environment.

```bash
mkvirtualenv --python=/usr/bin/python3 broadcaster  
echo "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh" >> ~/.bashrc  
echo "workon broadcaster" >> ~/.bashrc  
```

Create a SSH key pair for the machine and add the public key here as a deploy key: [https://gitlab.zhdk.ch/bweiberg/madek-broadcaster/deploy_keys](https://gitlab.zhdk.ch/bweiberg/madek-broadcaster/deploy_keys)

Add 

```bash
host gitlab.zhdk.ch  
      identityfile ~/.ssh/id_rsa  
```

to `~/.ssh/config`.

Clone the repository and install python packages.

```bash
git clone git@gitlab.zhdk.ch:bweiberg/madek-broadcaster.git  
cd madek-broadcaster  
pip3 install -r requirements.txt  
```

Install `libav` from `dependencies/ubuntu/` or [https://libav.org/download/](https://libav.org/download/).

Copy `monitors.xml` (the config file for the screens) to `~/.config/` and change the permissions to `755`.

Duplicate `player/api_access.py.sample` as `player/api_access.py` and change the values of `user` and `password`.

Run the software manually via `python player/main.py`.

## Setting player software up as a `systemd` service

This ensures that the player software starts automatically after startup and possible crashes.
74
75
76
77

Create directory `~/.config/systemd/user` and copy `service/player.service` there.  
Enable the service: `systemctl --user enable player.service`  
Reload the daemon: `sudo systemctl daemon-reload`  
birk's avatar
birk committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
And restart the service: `sudo systemctl restart player.service`  

## Defining cronjobs to supervise the player and to delete the log file weekly

Via `crontab -e` add:

```bash
SHELL=/bin/bash
USER=itz

* * * * * /home/itz/madek-broadcaster/service/service_check.sh
0 0 * * 1 rm /home/itz/log
```