Good evening,
I wanted to ask if there was any way that there would be automatic news every hour. The times of the news always change a little and are pre-produced. Is there any way to do this? Is there any way to do this? Is there a possibility with the API?
See if this works for you:
When you Upload those tracks set the Track Type to News
- Create New Smart Block
- you can name it âNews Updatesâ
- In search criteria choose Track Type > Is > News
- Limit to 1 item
- In Advanced Options set it to Newest (this way it play the latest news you upload)
- Create New Playlist
- Give it a name, eg âTop of the hourâ
- Drag the smart block you created to this playlist. You can also create a
Station ID smart block and add it before the News Update in this Playlist this way the Station ID can play before the News Update.
- Now go to Settings
Intro Autoloading Playlist > Choose the playlist you created
Edit: Actually, this won't work unless all the shows are 1 hour long.
I think the only way would be if you make a Smart Block for your music and set the limit to an hour (or 57 minutes depending how long your news will be), then include the âNews Updatesâ Smart Block and then drag the music Smart Block again depending on how long your shows are.
Example on how your playlist will look if the show is 3 hours:
News Updates Smart Block
R&B Smart Block
News Updates Smart Block
R&B Smart Block
News Updates Smart Block
R&B Smart Block
You would have to play around with the timing.
Okay thank you very much. But now a slightly different question, if I create such a SmartBlock, would it be possible to play all 2 songs in between Jingles? If yes how?
And how can I upload a file through the API?
Yeah, it probably wouldnât work as great, even if trying to add different smart blocks in order to get close to near the top of the hour since songs have different length if you limit them by item then timing might be off, and if you try to limit them by time (hrs or mins) you might get a lot of songs being cut to early. But if it works for you, then you will just need to play around with it a little.
Example.
News Updates Smart Block
R&B Smart Block (limit 2 items) Most radio edits are around 3 minutes 15 seconds
Jingles Smart Block (limit 2 items) mostly 15 seconds each, depends what you have
R&B Smart Block (limit 2 items)
Jingles Smart Block (limit 2 items)
R&B Smart Block (limit 2 items) ⌠until you have about an hour worth, then repeat with News Updates.
News Updates Smart Block
ect (more smart blocks)âŚ
I canât speak too much on uploads via API since I havenât paid attention to it as of yet but know I might need it soon for my website⌠so Iâm not sure if itâs something I will need to add, or if itâs there already. But I think the only way around it is doing it as if they were podcasts. So youâre able to include a podcast feed and that will automatically grab the files as you add them to your site, just make sure to have them uploaded to your site 1 hour before a show starts. If there is breaking news updates, something that just happened then you will have to upload it manually in LT.
Okay, thank you very much, it all works. Only when the news file is imported is the length somehow always set to 6.4 seconds, even though the file is significantly longer.
Can somebody help me pls?
I havenât had much time to look into this. Did you test it. What happens when you play it? Is it cut short?
Yes Iâve tried it sometimes, always the same. Also when I play it in the schedule. But when I play it alone in the prewiev it plays the whole file.
Perhaps something is causing the CUE OUT to be set shorter when importing.
Could be
Try giving a longer length. Example, if itâs 6 minutes and 42 seconds.
00:06:42.0 just to see if it works.
Maybe thereâs a typo in the code, making it shift numbers or something. Has to be looked into.
Btw. no problem
I can wait
Kia ora. We do almost exactly what youâre doing for news and we have the issue where the duration of the news always changes slightly. Currently this is an issue for us and hopefully I can write a patch to fix this.
We are using watch folders which hasnât been merged into the master branch of LibreTime yet. Since I donât know the API either (and I donât know if itâs easily designed for something like this) watch folders allow us to upload news to a folder automatically and the news items are scheduled into our shows via playlists. With auto loading the playlists are loaded/scheduled an hour before the show. So if our news is updated before an hour when itâs supposed to play supposedly the proper duration of the news will show up in the schedule. However if we update the news minutes before itâs meant to play, then unless someone manually goes in and schedules the news the schedule will have the incorrect length for the news.
I think the smart block option mentioned by @codenift would solve the problem I have with duration changes, but unless youâre manually scheduling you can still have cases where your news might get cut short or have some dead air afterwards.
Are your file names exactly the same for your news? I know with the old Airtime if file names were the same (and possible a few other metadata) it would replace an existing item in the database rather than add it as a new one. Iâm wondering if that could be related to why your file durations arenât accurate. Another possibility is variable bitrate encoding - though usually for us this meant a 10 second station ID would show up as a 40 second station ID.
Thank you @kmahelona, maybe I can give you a little update on my situation. Somehow, the duration has resolved itself. No idea how, I just re-created the podcast with the xml file, but now it works. My problem now is that the news is either played too early or too late and because the playlists have been preloaded and over several hours goes, the news are not updated. But in itself it works, not perfect, but it works
Magnus, We made another solution with python/sh files, first i crated a newsfile of 2 minutes silence and put this in a playlist called news_dummy, we schedule always this news dummy on top of every hour, we download the news 3 minutes before every hour from our agent, the news is from 1.50 to 2.10 in length , in a python script we calculate the actual length and send it on a time so it will end exact at hour +2 minutes, we send as live broadcast in master source account with auto switch on, so the news is always actual news (3 minutes old) The pyton files are scheduled in a cron task.
Okay I already had this idea, but how exactly did you do it by sending the audio file. I tried that with ffmpeg, from then on I canât go over the master source. Maybe you can post part of the scrip
Magnus, in crontab -e add:
59 8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 * * * 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â))â
This is static and always the same length, but now i use a dynamic script to calculate length of the news and call it with variable delay on 59 minutes. In my playlist are station tune, hour beep and time announce
Okay nice, thank you. And how can I make it dynamic?
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â