How to avoid 2 tracks of the same artist?

Hey everybody , thanks for the great work , Libretime is the perfect radio automation that my team and me were looking for to start our radio project.

We have one issue that we can’t solve , we often have two songs from the same artist (not the same song) playing one after another OR playing a few minutes later. We’d like to avoid that . We’re using smartblocks of 4 tracks.

Any idea how to avoid that?



Hmm that isn’t currently a feature of the way the algorithm is written, its pretty much random and can be tweaked to avoid tracks but not artists. This would require rewritten the smart block to take something like this into consideration.

Wouldn’t it be possible to add a criteria to Smart-Blocks like :

Creator is “Last Played” before “X” hours

That’s like adding one criteria inside another one.

So the issue here is there isn’t any data structure that ties all of the tracks together with Last Played. Last Played is a timestamp on the track itself, so I’m not sure the best way to accomplish something like this or if it would be a high priority but it wouldn’t work like that with the current way that Smart Blocks are programmed.

Incase someone wants to try. You would need to code a new option field in Smart Blocks to set a time. Then tap in into ‘cc_playout_history’ for doing the filtering. There you can retrieve the file’s info by using ‘file_id’ with cc_files (to get creator) and then use ‘starts’ in playout history to compare with current server time depending the hour chosen in that option. So then you will just have to filter it out by finding if that creator was played within that hour.

Once I get back to LT, I’ll look into it if nobody has done it yet.


I second that request. I only use smart blocks to play my music but get lot’s of repeated artists within a block. If that could be avoided, that would definitely be a plus. At least as an option it would be desirable.

Our radio programmers keep asking for this one and would very much appreciate it! There’s a lot more they keep asking for haha especially super complicated ad scheduling… though I feel like the people who book the ads just want to disenfranchise use who aren’t on RCS’ products…

Well yeah, we should plan out how we’d like to do more complicated scheduling and figure out a good workflow/UI to make it happen. I know that RadioLogik has better support for ad campaigns etc. This could be a game changer for LibreTime but it also would be a lot of work to implement. As of right now we have no monetization/incentive to push people to really dedicate their time to development. So mostly just getting the scratch an itch type of bug fixes.

So @robbt, are you implying that a temp solution could be what @codenift is suggesting??
I agree with your point that it could be great to plan a “more complicated scheduling tool”, but given the reduced resources available makes it hard to accomplish.
My question is if a simpler/temporary fix would make any sense to try?

It’s possible that this might work but it will require analyzing the database and testing it along with modifying the smartblock form and code to implement it. I haven’t been focused on LibreTime much recently so I can’t say off the top of my head.

It would be great to focus on this one (checking the artist’s last ocurrence) for the time being and leave other parameters for a later task. This one seems to be a frecuent need of radio stations that work closely with record labels (which get upset if an artist of other label gets more plays than theirs :slight_smile:

I can volunteer to help someone more experienced in LT coding if that’s of any help.
Let me know, cheers!

Hi, one of our customers is very interested in this functionality “avoiding 2 tracks of the same artist” and wants to see if anyone is interested in dedicating some time to make it work. He is willing to pay for some freelancing hours. We are both from south america so maybe is not much what he can afford (in terms of us dollars or euros :slight_smile: , but for sure we can find a way combining he’s donation with some hours of my part.
Maybe @codenift or @robbt?? or could you give me some hints on how to find someone?
Thanks a lot!

Or maybe you can lead me on the usual procedure to contribute on things like this…

Maybe someone could point me to the files where I could start checking this?

There’s some good discussion here about how this could work - LibreTime services (and other ways to sustain the project)

That’s a really interesting analysis there! I hope we can collaborate somehow. Thanks

Regarding this:

point me to the files where I could start checking this?

I’d like to dig in and study the smart blocks. So any hints are welcome… :slight_smile:

So as far as smartblock stuff goes I did a bit of work on this in the past.
Here is a wiki page where I tried to layout some ideas about smartblocks -

Here is a PR that touched upon a bit of the Smartblock files to keep them from overflowing the time limit -

And I suspect that airtime_mvc/application/models/Block.php would be the place to dig in.

The issue is that I don’t really think the current database queries are designed in such a way that they factor in any details of the track order. So I suspect you would need to write a function that takes the files returned generateSmartBlock by getListOfFilesUnderLimit and then scan through them and add a conditional check that would only happen if the no repeating artists (or however it was set) was enabled and then before it adds the clip it would try to find another one. It’s not a simple problem to solve because of the way this is setup but it also isn’t super complicated to imagine some solutions.

I hope this is helpful in giving you some ideas.

I’ve opened a “feature request” in case someone wants to keep talking about it: