StayInSameStyleDJ [MM3]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

SatinKnights
Posts: 46
Joined: Wed Jul 18, 2007 9:45 pm

StayInSameStyleDJ [MM3]

Post by SatinKnights »

After a year, I got back to updating this script. It has been converted from JavaScript to a true AutoDJ VBScript.

Stay In Same Style AutoDJ
Download 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.
Image

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 counter hits
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 => Genre2

Ratings: 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.

Image
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.


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

Bugs: 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
0.98 Dec 2007 JavaScript version based on Daniel Webb's MusicMagicDJ script as my teaching template.
Last edited by SatinKnights on Fri May 08, 2009 9:55 pm, edited 3 times in total.
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

Don't have time to test it now, but looks optically very nice! :)

And I understand you! It's a pain if you have much ideas how things would work but you almost can't realize them because you haven't enough experience in VBS. I hate that... :)
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau »

Looks supa nice :D
drjboulder
Posts: 1119
Joined: Mon Apr 09, 2007 12:03 am
Location: Boulder, Colorado, USA

Post by drjboulder »

Gave it a quick try out...
Working very nicely.
Good work! :P

Kinda of a ScrobblerDJ without needing to be connected to the Internet.
D Rock
Image
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

Yeah, would be nice if you could implement last.fm-support... ;)
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan »

Looking good so far.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau »

Because of you I will have to put myself to work to tag may genres and moods :evil: lol

Thanks a lot for this script.
By the way, I love the skip Bomb option.
How can this not be natively in the auto dj?!?
Peke
Posts: 17457
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

If we make things available, provide tools, help, more help and solution what will be left on users to make? ;)

In MM is common that good ideas and new features become parts of MM in Future versions.

Addon: Things will change soon :)
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Dreadlau
Posts: 1967
Joined: Sun Nov 25, 2007 6:49 am

Post by Dreadlau »

For my use, MM3 is simply the best player I've Found. It makes me rediscover my music. I'm kinda addicted to it now lol.

Sadly not everyone have the same opinion on it.
Today there is a review for the official realease of MM3 in a french website.
And the comments of the people who downloaded it to try are really negative.
Like its a bloated software, it's buggy, the interface is archaïc, ...
roupp
Posts: 56
Joined: Sun May 21, 2006 2:58 pm

Post by roupp »

I've tried the script; however, it doesn't restrict the tracks to a single genre. It is bringing up multiple genres and multiple ratings. I set the ratings to an average of 1 star and it keeps bringing up 3 star ratings.
SatinKnights
Posts: 46
Joined: Wed Jul 18, 2007 9:45 pm

Post by SatinKnights »

roupp wrote:I've tried the script; however, it doesn't restrict the tracks to a single genre. It is bringing up multiple genres and multiple ratings. I set the ratings to an average of 1 star and it keeps bringing up 3 star ratings.
If you turn on the logging and extra debugging, what does it give you? The log file is in the scripts directory, called StayInSameStyleDJ.js.log. The first four lines should be close to:
Friday, December 28, 2007 9:22:15 PM: TRACE: ******************************************************************
Friday, December 28, 2007 9:22:15 PM: TRACE: Entered StayInSameStyleDJ
Friday, December 28, 2007 9:22:15 PM: TRACE: seed:, 3, Stay in: Genre=1, Tempo=1, Occasion=1, Mood=1, Unheard=false, SkipBombs=true Days=3 loose=1.
Friday, December 28, 2007 9:22:15 PM: Counted 46 possible tracks with SELECT COUNT(*) FROM Songs WHERE Songs.Genre = 'Alternative' and Songs.Tempo = '' and Songs.Mood = '' and Songs.Occasion = '' and Songs.Rating > 20 and Songs.LastTimePlayed < 39441.887792859

The ratings part is easy to answer. It is the minimum rating that is selected in an SQL query, and the averaging only kicks in after the script has started degrading due to not finding matches. Then, a slightly lower rating will be picked up, as long as the average stays above 1 in your case.
roupp
Posts: 56
Joined: Sun May 21, 2006 2:58 pm

Post by roupp »

Here's what my log file says:

Friday, December 28, 2007 6:59:22 PM: TRACE: ******************************************************************
Friday, December 28, 2007 6:59:22 PM: TRACE: Entered StayInSameStyleDJ
Friday, December 28, 2007 6:59:22 PM: TRACE: seed:, 3, Stay in: Genre=1, Tempo=1, Occasion=1, Mood=1, Unheard=false, SkipBombs=true Days=3 loose=1.
Friday, December 28, 2007 6:59:22 PM: TRACE: Not last song.
Friday, December 28, 2007 7:00:34 PM: TRACE: ******************************************************************
Friday, December 28, 2007 7:00:34 PM: TRACE: Entered StayInSameStyleDJ
Friday, December 28, 2007 7:00:34 PM: TRACE: seed:, 3, Stay in: Genre=1, Tempo=1, Occasion=1, Mood=1, Unheard=false, SkipBombs=true Days=3 loose=1.
Friday, December 28, 2007 7:00:34 PM: TRACE: Not last song.
roupp
Posts: 56
Joined: Sun May 21, 2006 2:58 pm

Post by roupp »

Yet another log file:

Friday, December 28, 2007 6:59:22 PM: TRACE: ******************************************************************
Friday, December 28, 2007 6:59:22 PM: TRACE: Entered StayInSameStyleDJ
Friday, December 28, 2007 6:59:22 PM: TRACE: seed:, 3, Stay in: Genre=1, Tempo=1, Occasion=1, Mood=1, Unheard=false, SkipBombs=true Days=3 loose=1.
Friday, December 28, 2007 6:59:22 PM: TRACE: Not last song.
Friday, December 28, 2007 7:00:34 PM: TRACE: ******************************************************************
Friday, December 28, 2007 7:00:34 PM: TRACE: Entered StayInSameStyleDJ
Friday, December 28, 2007 7:00:34 PM: TRACE: seed:, 3, Stay in: Genre=1, Tempo=1, Occasion=1, Mood=1, Unheard=false, SkipBombs=true Days=3 loose=1.
Friday, December 28, 2007 7:00:34 PM: TRACE: Not last song.
Friday, December 28, 2007 7:03:12 PM: TRACE: ******************************************************************
Friday, December 28, 2007 7:03:12 PM: TRACE: Entered StayInSameStyleDJ
Friday, December 28, 2007 7:03:12 PM: TRACE: seed:, 3, Stay in: Genre=1, Tempo=1, Occasion=1, Mood=1, Unheard=false, SkipBombs=true Days=3 loose=1.
Friday, December 28, 2007 7:03:12 PM: Counted 1844 possible tracks with SELECT COUNT(*) FROM Songs WHERE Songs.Genre = 'Rock, Alternative' and Songs.Tempo = '' and Songs.Mood = '' and Songs.Occasion = '' and Songs.Rating > 20 and Songs.LastTimePlayed < 39441.91322528921
Friday, December 28, 2007 7:03:12 PM: TRACE: try 1 of 20, found songID = 95466
Friday, December 28, 2007 7:03:12 PM: TRACE: TEST SONG: Reject if So Hott By Kid Rock is in now playing
Friday, December 28, 2007 7:03:12 PM: TRACE: ACCEPT: song is not in now playing.
Friday, December 28, 2007 7:03:12 PM: TRACE: TEST RATING: Reject if So Hott By Kid Rock reduces the playlist average to more than the specified amount
Friday, December 28, 2007 7:03:13 PM: TRACE: ACCEPT: 40 >= 20
Friday, December 28, 2007 7:03:13 PM: TRACE: TEST ALBUM: Reject if album 'Rock and Roll Jesus' (38869) is in now playing
Friday, December 28, 2007 7:03:13 PM: TRACE: Parameters: RestrictAlbum, 10, startIndex, 0, endIndex, 8
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'All the Stars and Boulevards' (38031)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Saturate' (38229)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Time Well Wasted' (38224)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Dirty Dancing (Collector's Edition)' (38140)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Greatest Hits: Barenaked Ladies [1991-2001]' (38070)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'The Wedding Singer' (37946)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Gold: Aerosmith' (37949)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'The Genius of Roger Miller' (39288)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Metal Ballads' (37940)
Friday, December 28, 2007 7:03:13 PM: TRACE: ACCEPT: Album is not in now playing
Friday, December 28, 2007 7:03:13 PM: TRACE: TEST ARTIST: Reject if artist 'Kid Rock' (0) is in now playing
Friday, December 28, 2007 7:03:13 PM: TRACE: Parameters: RestrictArtist, 10, startIndex, 0, endIndex, 8
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Augustana' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Breaking Benjamin' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Brad Paisley' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'John Morris Orchestra' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Barenaked Ladies' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Ellen Dow Plus Sugarhill Gang' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Aerosmith' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Roger Miller' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: checking: 'Lita Ford & Ozzy Osbourne' (0)
Friday, December 28, 2007 7:03:13 PM: TRACE: ACCEPT: Artist is not in now playing
Friday, December 28, 2007 7:03:13 PM: RandomChooseTrack chose 'So Hott' By 'Kid Rock'.
SatinKnights
Posts: 46
Joined: Wed Jul 18, 2007 9:45 pm

Post by SatinKnights »

Well, from that log, I would expect that 'All the Stars and Boulevards' by 'Augustana' has its genre set to 'Rock, Alternative'. From my testing, the comma and a second genre is irrelevant because the match is on the whole string, so I would assume that the Kidd Rock song also has 'Rock, Alternative' as it's genre. If it is set to just 'Rock', then somehow a logical OR is slipping in because of the comma. 30 seconds of googling shows that commas can alter the query in the variable section, but I didn't see anything special when it was in the value section of the matching.
RedX
Posts: 366
Joined: Wed Dec 27, 2006 10:32 am
Location: Germany

Post by RedX »

Don't forget to say you have to restart to be available.

Maybe u should consider auto adding the script entries.

http://www.mediamonkey.com/wiki/index.p ... nstall.vbs


edit: OOPS sry as it seems you have the install for everything but here i had to restart to make sure the buttons and item sheets appeared...
Post Reply