Script Request: Use Custom Field to Store Calculated Rating

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

Moderators: Peke, Gurus

CriticalTodd
Posts: 10
Joined: Fri Jun 23, 2006 9:49 am
Location: Houston, TX

Script Request: Use Custom Field to Store Calculated Rating

Post by CriticalTodd »

I'm throwing this one out to all the scripting gurus out there because, basically, I don't know what I'm doing. There, I've said it.

What I'd like to do is use one of the Custom fields to hold a calculated rating that is a formula, a rough version of which I'll outline below. Once this Custom field is populated, I hope to use it for AutoDJ'ing and other stuff.

I'd like the calculated rating to reflect not only how I rate the song but also how many times it's been played and how long ago it was last played. I'd like to take these bits of information, churn it up, and spit out a rating that will reflect songs that I like that I haven't heard often and/or in a long time.

The formula would look something like this:

Calculated Rating = (Rating * Last Played) - Times Played

So that if I had three songs:

Song A - Last Played: 30 days ago; Times Played: 10; Rating: 5*
Song B - Last Played: 1 day ago; Times Played: 1; Rating 4*
Song C - Last Played: 60 days ago; Times Played: 30; Rating 2*

The calculated ratings would be:

Song A - 140
Song B - 3
Song C - 90

I've tried setting up various filters to create this sort of scoring system but each of my attempts seems to fall short on one thing or another.

If anyone has some scripting love out there, I'd appreciate it.
Todd.

"I'll be over there, hanging out with Native American Joe Pesci."
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
CriticalTodd
Posts: 10
Joined: Fri Jun 23, 2006 9:49 am
Location: Houston, TX

Post by CriticalTodd »

Thanks for the reply. I had not seen that. I'll check it out.

Gratzi!
Todd.

"I'll be over there, hanging out with Native American Joe Pesci."
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

I really like your idea - not sure if that script is exactly what you want, but maybe it does. If not, I would like to work on this script - mainly because I'd like to use it! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
CriticalTodd
Posts: 10
Joined: Fri Jun 23, 2006 9:49 am
Location: Houston, TX

Post by CriticalTodd »

Hey Trixmoto,

I've taken that other script and used it as a starting point to make something closer to my ideal.

I'm just muddling around though, I'd love to see what you come up with if you decide to take a stab at it!
Todd.

"I'll be over there, hanging out with Native American Joe Pesci."
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

I'm working on another script at the moment, but I will see what I can come up with if I get some time soon. I love the idea though!
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
CriticalTodd
Posts: 10
Joined: Fri Jun 23, 2006 9:49 am
Location: Houston, TX

Post by CriticalTodd »

Cool.

Do you know how I can set a script to run when a song plays so I can dynamically update the calculated score?
Todd.

"I'll be over there, hanging out with Native American Joe Pesci."
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

The answer has been posted here: http://www.mediamonkey.com/forum/viewto ... 1369#51369

Please don't "crosspost", for everybody's sake. Either (if necessary) continue the discussion here of there please.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
CriticalTodd
Posts: 10
Joined: Fri Jun 23, 2006 9:49 am
Location: Houston, TX

Post by CriticalTodd »

Got it. Thanks.
Todd.

"I'll be over there, hanging out with Native American Joe Pesci."
CriticalTodd
Posts: 10
Joined: Fri Jun 23, 2006 9:49 am
Location: Houston, TX

My Rating Formula So Far...

Post by CriticalTodd »

In case anyone is curious, after much wringing of hands and gnashing of teeth, I've arrive at what I think is a workable formula for my calculated scoring system.

First, I wanted to weigh the overall score to reflect both my rating of the song, how many times it's been played, and when the last time it was played. I ended up with:

50% - Rating
30% - Last Played
20% - Times Played

A couple of notes here: I set the Last Played variable to max out after 45 days. I also compare the title's number played to the title I've played the most to arrive at a relative number.

For the rating, I didn't want to use a straight scale. Instead I wanted to weigh the rating to favor the high rated songs and penalize the low rated ones. To do this, I created an equation in which an 5 star song equated to a value of 1, a 0 star song equated to -1 but where the even point (weighted rating = 0) was at ~3.5 stars.

The formula I arrived at was:

Code: Select all

Weighted Rating = .5*Rating^3 + .5*Rating^2 + Rating - 1
I subtracted 1 to arrive at a percentage value between 100% (5 star) and -100% (0 star).

I then feed this weighted rating into the overall equation to arrive at my weighted score which, for neatness sake, I limit to a number between 0 and 100.
Todd.

"I'll be over there, hanging out with Native American Joe Pesci."
Post Reply