diff --git a/demotape.py b/demotape.py index fac952a..47f74e9 100644 --- a/demotape.py +++ b/demotape.py @@ -117,10 +117,10 @@ def process_channel(channel): while True: #print('checking ' + channel['name']) if check_stream(channel['url']): - print(channel['name'] + ': found stream! Downloading ...') + print(channel['name'] + ': stream online! Downloading ...') download_stream(channel) else: - print(channel['name'] + ': no stream') + # print(channel['name'] + ': stream offline') # wait between checks waitingtime = random.randint(20,30) time.sleep(waitingtime) diff --git a/demotape.service b/demotape.service index 6a62896..c244358 100644 --- a/demotape.service +++ b/demotape.service @@ -1,13 +1,16 @@ [Unit] -Description=checks regulary the webstreams of all district parlaments in vienna. Online streams get taped. +Description=Demotape - Automatic stream taping for viennese district parlaments. After=multi-user.target [Service] -Type=idle -User=pi -ExecStart=/usr/bin/python3 /path/to/demotape.py > /var/log/demotape.log 2>&1 +Type=simple +User=root +ExecStart=/usr/bin/python3 -u /home/demotape/demotape/demotape.py /var/www/static-files/ +StandardOutput=file:/var/log/demotape.log +StandardError=file:/var/log/demotape_error.log + Restart=always RestartSec=10 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target