× Warning! This forum is in archival status. New contributions may not work.
Improving Smart Playlist Functionality - feedback requested
  • I am putting some energy towards analyzing the smart playlist feature set that exists in airtime and how I could code some improvements.
    Here are some ideas I've had.

    • Adding additional time based play list Sort Options (DONE)- you could sort by tracks your smart play list picks by Most Recently Played or Least Recently Played in addition to Most Recently Uploaded (currently in 2.5.2 as newest). This would be relatively simple to add.
    • Adding autocomplete to criteria input. - For instance if you select Genre is it would query the database for existing Genres and provide them as options.
    • Adding OR for top-level Criteria. -  Currently the interface only allows you to select one Criteria as primary and any additional Criterias are added as required. For instance there is no way to search for Albums that contain X OR Titles that contain X.
    • Sorting the tracks to attempt to meet length requirements as closely as possible to avoid cut-offs or dead air. - This would be a time consuming sorting algorithm that would dramatically improve the ability to use Airtime to fill the gaps in between shows without dead air. This would insert tracks so they add up to the length as closely as possible. Currently I think it just adds tracks at random until it meets the length which can mean tracks that are far over the requested length. The issue is algorithms like this are typically O^2 but it might be feasible to write something that minimizes over runs without making it completely optimal.
    • Coding Hard Limits to Length (DONE) - an easier to code alternative to the previous option is to simply reject any overflows of tracks going beyond the limits of the length imposed. For instance if you set-up a track limited to 1 minute it could add a track of any length if the criteria isn't tightly confined.
    • Adding Example Smart Playlists to Default Installs - this is just an idea but having airtime include example smart playlists like say top of the hour station ID which would simply be something like Album is "Top of the Hour Station ID" and number = 1 item.
    • Add functionality to add custom tags to tracks via the UI - this currently requires modifying the code base but I could imagine this being extremely useful as a means to build smart playlist. For instance if you could add a boolean "safe harbor only" flag this could be used to prevent the scheduling of tracks with curse words before an appropriate time. Currently the Criteria are hard coded in the Blocks.php file. The most recently updated wiki page provides documentation for how to manually do this.

    So that is what I currently came up with brainstorming and analyzing the code. I think the immediate fixes I plan on making for my custom install and attempting to push back to the codebase are the additional time sorts and something rejecting tracks that overflow beyond smart playlist limits. I'm just posting this here to get feedback from other users/developers and as documentation for myself.

    What are some of the things you wish smart play lists could do or did differently ?

    Post edited by Robbt at 2016-01-09 14:34:42
  • 5 Comments sorted by
  • Ok, so I wrote some code to modify the way Airtime adds files to Smart Blocks to prevent Airtime from scheduling files longer than the Time Limit set for a Smart Playlist.
    It is available on my Github Airtime fork - https://github.com/Robbt/Airtime

    I set it to only iterate through 500 files before giving up vs. potentially the entire library or query. This is because the code simply rejects files that would cause the playlist to go over in length.

    I'm not sure this is the best approach. Another option would be to automatically add a length Criteria < length Limit to queries.

    I also added the code to sort by most recently played, least recently played, most recently modified and least recently modified. If anyone can think of a better way of phrasing these I'm all ears but the code is now on my github fork as well. If the devs will accept it I'll submit it to the master repository.
    Post edited by Robbt at 2016-01-02 23:32:30
  • Will "Adding additional time based play list Sort Options" work on 2.5.1?
  • No I don't think so. I'm pretty sure there is a minor database change that was needed to store the playlist sort. I'm not 100% sure but I believe that was the case.

  • I mean what's the point in massaging the 2.5.x code base any more when Team SF is busy fixing this issue themselves?
  • Vote Up0Vote Down RobbtRobbt
    Posts: 80Member
    Yeah, they've just released this feature yesterday for the SAAS Airtime.pro. I'm not sure when the source code will be available to the public. I just e-mailed the developers. Hopefully the code will be forthcoming even if it isn't release ready.