Hourly news between the current show

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?

1 Like

See if this works for you:

When you Upload those tracks set the Track Type to News

  1. 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)
  1. 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.
  1. 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.

1 Like

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? :smile:

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.

1 Like

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.

Yes, if I change the time manually (in this case to 2:28 minutes) then it works

1 Like

Btw. no problem :wink:
I can wait :stuck_out_tongue_winking_eye:

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 :wink:

1 Like

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 :wink:

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? :smile:

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”

1 Like