Hello for the TOH news i use a smartblock where the news file will be loaded only if it was uploaded 3 minutes or less ago. The latest news is dowloaded from our news agent 4 minutes before the hour and added to the database by a python script in a crontab task. In this case the file will not play but if i set the uploaded time to 63 minutes ago in the smartblock it is playing (but not the actual) news. So it seems that the update of the database took a longer time than 4 minutes. Is there a possibility to force the update to take place for example 1 minute before the hour. Thanks,
So if you are using an autoloading playlist to add the smartblock this currently happens an hour before a show is set to air, there isn’t currently a way to modify in the UI but the code is there and the idea of making this variable on a global or even per show basis is definitely a feature that would be useful for someone to contribute.
So I suspect this is what is happening to make the news out of date. Let me know if this makes sense. If you need help modifying the time I can point out where it is hardcoded and can be changed.
Thanks for the info,so i have to look for another solution. Maybe i’ll try to make a live stream (as master source) of the news which interrupt the running show and after the news (approx 2 minutes) restart it
I could probably provide you with a pointer to the section of code so that you could try modifying it. Making this a customizable feature was a development goal.
Robbt, thanks but my suggested solution works, i just have to fine tune it, in libretime i add every hour a 2 minutes dummy file (silent) and at the same time the master source takes over with the news (downloaded 2 minutes ago) a cron task started on 58 minutes takes care of it.
FYI My solution:
The news ends always exact on the hour+2 minutes, so it has to start in minute 59 of the hour before.
The length of the file and the delay time is calculated after the downloading.
To execute this i made some tasks which are called in contrab (in this case to play the news from 9…23),
in terminal:
crontab -e
add:
57 8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 * * * curl or wget for your download from your newsagent
after that set a contrab task to call a python file i.e.
59 8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 * * * cd /home/omroep/nosnieuws && python /home/omroep/nosnieuws/uurnieuws.py
script uurnieuws.py:
#################################################################################
#!/usr/bin/python
from mutagen.mp3 import MP3
from mutagen.easyid3 import EasyID3
from datetime import datetime
from shutil import copyfile
import mutagen.id3, time, subprocess
delaytime = 60
filename = ‘/home/omroep/nosnieuws/nosnieuwsnuldb.mp3’
file_error = ‘/home/omroep/nosnieuws/nieuwsfiller.mp3’
try:
mp3file = MP3(filename, ID3=EasyID3)
except:
copyfile(file_error, filename)
finally:
mp3file = MP3(filename, ID3=EasyID3)
seconds = (mp3file.info.length)
if int(seconds) >= 150 or int(seconds) <= 90:
copyfile(file_error, filename)
else:
delaytime = 166 - (int(seconds))
now = datetime.now()
uur = str(now.hour)
uurfile = “/home/omroep/nosnieuws/tijdmelding/” + uur + “.mp3”
copyfile(uurfile, “/home/omroep/nosnieuws/uur.mp3”)
time.sleep(delaytime)
subprocess.call([’/home/omroep/nosnieuws/uurnieuws.sh’])
#end uurnieuws.py
####################################################################################
and uurnieuws.sh:
####################################################################################
#!/bin/bash
liquidsoap ‘output.icecast(%mp3, host=“localhost”, port=8038, user=“user_name”, password=“user_password”, mount=“your_mount i.e. live”, fallible=true, on_stop=shutdown, playlist.once(“your_playlist.m3u”))’
####################################################################################
the playlist:
####################################################################################
uurjingle.mp3
uur.mp3
nosnieuwsnuldb.mp3
####################################################################################
and the files in /home/omroep/nosnieuws/tijdmelding/
9.mp3
10.mp3
11.mp3
ext until
22.mp3
announce the actual hour + 1 for example 10.mp3 says: “It’s now eleven o’clock”