libretime / libretime

LibreTime: Radio Broadcast & Automation Platform
http://libretime.org
GNU Affero General Public License v3.0
806 stars 225 forks source link

[Feature request] SmartBlocks - make random track with repeats allowed not play the same track twice in a row #326

Open celianvdb opened 7 years ago

celianvdb commented 7 years ago

Hey, Since a week my webradio is powered by libretime with sound 24/24 7/7 but manage the calendar everyday is long and tedious, we use smart-block to have calm music for morning and more powerfull music afternoon but we often have 2 times ( or more ) the same music or 5-6 musics from the same author and that take lot of time to fix that manually. Little example :) capture du 2017-10-07 20-33-30

I think that can be nice to add somme features on smartblock like new conditional statements to be able to add condition like

previous_music.author != music.author previous_music.title != music.title

Because actually it's tedious to manage a radio using libretime with a correct planning.

Thx in advance ;)

Robbt commented 7 years ago

Indeed. The "randomness" of the Smartblock appears to be somewhat lacking in some regards. We have had other people complain that the same random show 1/500 is selected on a regular basis. I'm not sure how to best implement the specific functionality requested here but your feedback is duly noted and it might not be too much work to fix this. Do you already have unchecked allow duplicate tracks ? Because perhaps that is the issue (or there is an issue with duplicate tracks even when this is not checked).

celianvdb commented 7 years ago

Allow duplicate tracks is checked because i don't have a lot of sound ATM to do 24h of calendar and i want to allow my smart block to have the same music 2 time but not one after the other.

Robbt commented 7 years ago

This is from the forum, but I performed a randomness test with the help of my astrophysicist wife and from everything we can tell the algorithm is pretty random. The issue is most likely with human perception of randomness. Here is a piece that squiggleUK linked too https://labs.spotify.com/2014/02/28/how-to-shuffle-songs/ that explains a good approach we could take in terms of avoiding repeats.

celianvdb commented 6 years ago

I would be happy to code it but i don't understand the code of the smartblock part, it's extremely complicated for a simple feature. Actually, make the show of the day take more than 30min for my radio, so if someone is motivated to explain me how the actual code work for smart block or can code it, it would be a big help for us!

Robbt commented 6 years ago

Yeah, the smartblock code is a little confusing. I planned on writing up a wiki page explaining how it works. Having a far grasp of this based upon trying to trace through it, the challenge in coding this is that the algorithm doesn't keep track of the previous state when its pulling in files. So it could be simple to just add this in and say check to make sure that it wasn't the same as the last file but what if we wanted to check to make sure it wasn't scheduled in the last 3 items. I'll try to look at the code and point out where this code is actually at when I get a chance.

Robbt commented 5 years ago

So in summary the core idea here is that we want to improve the way the randomness is perceived as random by preventing it from repeating the same track in a row. This might be easy enough to accomplish by modifying this code that is ran a smartblock has ran out of tracks and still hasn't met its limit. If the checkbox that allows repeats is turned on then I think it just starts randomly inserting tracks throughout the list.

https://github.com/LibreTime/libretime/blob/29266b0c0d8ba2f31f6a0ba654719c757bd5735c/airtime_mvc/application/models/Block.php#L1357-L1370

This could be modified to prevent it from insert the same track to play twice in a row, as long as there are more than a few different tracks.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had activity in the last 5 months. It will be closed if no activity occurs in the next month. Please chat to us on discourse or ask for help on our chat if you have any questions or need further support with getting this issue resolved. You may also label an issue as pinned if you would like to make sure that it does not get closed by this bot.