Version 2.1.4 May 2009
This script was born out the frustration of having Metallica followed by Kenny Rogers when AutoDJ was turned on. When heavy metal is playing, I want the next song to be heavy metal also without manually setting a filter or playlist. There is no "LIKE current" in the autoDJ options, so I wrote my own. Then I layered on some other interesting filters as well. It is designed to be a configure once and forget it script. I have added a few requested functions from the past year and a couple of ideas of my own. So, here is the new script.
The fastest way to describe it is to show the options page.
When the user manually changes the currently playing song, this script notices and any clears it's old queues. It then picks new tracks as needed based upon the selection criteria that is turned on.
The Loose restrictions
is there to deal with the case of only have three albums in a genre. With it off, three songs would be played, and the script gives up. With it on, 98% of the songs on the three albums are played before giving up. Since we are selecting randomly for n retries, 100% play is not always reached. Any song currently in the Now Playing list is always skipped. So, even with loose restrictions set, the script will eventually exhaust the possible match list and give up. When the Retries
1/3 Loose mode: give up on unheard only, Wander Genre;Genre2 => Genre
1/2: drop album/artist already in NowPlaying list restrictions
2/3 Grasping mode: drop the minimum rating, min days before replay. strict library filter, Wander Genre;Genre2 => Genre2Ratings:
Balancing play rates based on ratings is cpu intensive, so I copped out and used a simple linear ratings model. If the user selects one star, then the search is on 1-5 stars, 1.25-5, 1.5-5 etc until we get to 4.5 and reset back to the user's minimum. This will play the 4 and 5 star songs more often while still getting occasional 1 star songs. To select all songs above the minimum equally randomly, turn off the Weighted Ratings
. Ignore OverPlayed
Songs is an option to skip songs that are repeatedly floating to the top. For a given style group, I grab the max(PlayCount) and multiply it by 2/3rds. When searching for a new song, the first few times through the database, I skip songs who's PlayCount is higher than this. An example is Genre=Jazz, Max(PlayCount) = 20, so the DB query includes " AND PlayCount < 14 ". This restriction is dropped in Loose mode or if the count is less than 3.
The Library Filter
code from trixmoto and Bex allows song selections from a library filter that may not be the same as the current active filter. It is useful for setting filters like Bitrate >= 192.Wander Genres
was a requested feature that I have squeezed in. If the genre is "Vocal; Jazz", and the selection pool is getting small, the script will wander to just Vocal, and then if still not satisfied, on to Jazz. Since many factors make the play choice pool dynamic, it returns to the original "Vocal; Jazz" as the first search pool.3.1 only:
The NowPlaying Node
shows what the selection pool of the last database query was. As the ratings weighting is updated, this node will change each song. The title of the node will show the general mode (Choices, Loose, Grasping) of how easy it was to find a selection, the number of tracks available, and the number of tracks skipped because they were already in the NowPlaying list. Caveat:
You have to click off the NowPlaying Node and then back on to it for it to update its track listing. This prevents tracks moving while you are trying to select/edit them.Commercials:
This mode allows tossing occasional "commecials" from another genre. The obvious choice is Christmas music, but any genre can be used. I personally have a whole slew of 20 second commercials from The Onion Radio News that I let slip in occasionally. The Skip Restrictions is in there to cover the possibility that all the commercials are from the same album/artist. There would be no reason to spin hard through several database retries before giving up and grasping from the same album. The displayed example is after a minimum 5 normal songs, add 1 song 5% of the time from the Parody Commercial genre ignoring duplicate artists/albums when selecting.More Commercials:
Since the code was there to do it once, why not again. Just kidding. This is in there for those people that wanted to do a "3 from 3" mix of songs. This method allows a requested option of "3 Hard Rock, 3 Soft Rock, 3 Guitar Rock, repeat" by setting the options as 6 songs, 3 commercials, 100% , Soft Rock for the first line, and 6 songs, 3 commercials, 100%, Guitar Rock for the second line, and the original genre of Hard Rock. The 6 is for 3 main songs plus 3 other commercial songs. Both commercial blocks need to insert the same number of songs and insert 100% of the time. Otherwise, the sequencing will get screwed up. Yes, Hard Rock will play the first time for 6 songs, and then three songs each every other time.Grab Whole Albums:
I didn't want to have to disable my "random choice" script when ever I switched to listening to Audio Books or standup comedy routines. So, this sets specific genres that are to be played sequentially. If the user selects track 4 of an album, 5-end are added to the play list automatically. Then next song randomly chosen in the same genre will force a load of the whole album starting at track 1. The "Skip bombs" option is still honored, so intros, prologues, and silence fillers can be bombed out and excluded.... For All Genres:
trixmoto wanted to do this for all genres, so OK. With both Grab Whole Albums and For All Genres checked, I emulate 75% of his script, but he asked for it.Requirements:
MM3.0 or MM3.1Bugs:
When in Loose Restrictions mode and dropping restrictions, the script can take 3-7 seconds to find an available track that matches all criteria. This does make the display sluggish for the first 3-7 seconds of a song's playing time. I have called the SDB.ProcessMessages function as often as I can. But, if I insert the function inside any more DB query loops, I can collide with other OnPlay scripts that are also reading the DB, which generates errors.History:
2.1.4 May 2009 Fixed for MM3.0, added Ratings=Weighted or Straight, added IgnoreOverlyPlayed
2.1.2 May 2009 Current VBScript version