Auto Rate by Playcount and Days in Library

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Amerie
Posts: 4
Joined: Wed May 18, 2005 4:14 pm
Location: New Zealand
Contact:

Auto Rate by Playcount and Days in Library

Post by Amerie » Sun Apr 30, 2006 5:56 pm

I stumbled across iRate a while ago now and really liked the formula it uses to rate songs. Unfortunately not having a mac and not wanting to run iTunes means that using iRate is out of the question for me.

Does anyone feel inclined to port this to a MM script?

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Apr 30, 2006 6:58 pm

Seems like the latest version allow you to add a freshness factor to your own ratings on a set of selected songs.

Is that something that would satisfy you?
Image

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Sun Apr 30, 2006 8:24 pm

If this is the formula that iRate uses:
Play Count
Days in Library = current date - date added
Multiplier = #of stars >>> 0 = 1
1 = 1.2
2 = 1.4
3 = 1.6
4 = 1.8
5 = 2.0
Formula:
(Play Count / Days in Library) * Multiplier * 1000 = Rating{integer}
This should be the MM implementation of the formula (with Song as SDBSongData object)

Code: Select all

Song.Comment = [Song.PlayCounter / DateDiff("d", Song.DateAdded, Now)] * (1+Song.Rating/100) * 1000
but what to do with unknown ratings? (use Rating = 50 ?)

Cheers
Steegy

EDITED: Removed unnecessary piece of code
Last edited by Steegy on Sun Apr 30, 2006 9:07 pm, edited 1 time in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Apr 30, 2006 8:29 pm

Yes, something like that and a script could look like this.
Quite a radical way to rate things though... especially with the DateAdded factor.

Code: Select all

Better stuff below
Last edited by DiddeLeeDoo on Sun Apr 30, 2006 9:28 pm, edited 5 times in total.
Image

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Sun Apr 30, 2006 9:04 pm

Quite a radical way to rate things though
Notice that iRate only changes the tracks comment field (not the rating field).
So I suggest to stick with that. And it's nice for people that want to keep the normal rating field manual.

(
Changing the rating field, with calculations based on that same field, seems kind of awkward.
It would give wrong results if the script is run more than once, and there's no way to know if the script has already been run on a track or not.
)

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Sun Apr 30, 2006 9:14 pm

Entry for the "Scripts.ini" file

Code: Select all

[CalculateRating]
FileName=CalculateRating.vbs
ProcName=CalculateRating
Order=14
DisplayName=Calculate Rating
Description=Calculate rating based on the relative playcount and the assigned rating
Language=VBScript
ScriptType=0
CalculateRating.vbs (for the "Scripts" folder)

Code: Select all

Option Explicit

Sub CalculateRating

    Dim i, Songs, Song

    Set Songs = SDB.CurrentSongList
 
    For i = 0 To Songs.Count - 1
        Set Song = Songs.Item(i)
        If Song.Rating = -1 Then
            Song.Comment = (Song.PlayCounter / DateDiff("d", Song.DateAdded, Now)) * (1.5) * 1000
        Else
            Song.Comment = (Song.PlayCounter / DateDiff("d", Song.DateAdded, Now)) * (1 + (Song.Rating / 100)) * 1000
        End If
    Next

    Songs.UpdateAll

End Sub
How to install (FAQ): http://faq.mediamonkey.com/index.php?ac ... artlang=en

Cheers
Steegy
Last edited by Steegy on Sun Apr 30, 2006 9:37 pm, edited 3 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Apr 30, 2006 9:14 pm

I find the theory a bit strange, but like you say Steegy, if it is there just to add a Text Value to a song...

Guess it then would be better to add it to one of the CustomX fields instead of the comments field, but I do not have a portable device..
Last edited by DiddeLeeDoo on Sun Apr 30, 2006 9:21 pm, edited 1 time in total.
Image

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Apr 30, 2006 9:16 pm

Ahh, you just did it! Good one :D .... well now there's a choice...

Still am puzzled with this DateAdded stuff though... must be something that is useful for those who get new music all the time maybe...
Image

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Sun Apr 30, 2006 9:22 pm

Well, it's actually very logical.

If you just bought a nice song last week and you like it, you might have played it 10 times.
If you had bought the same song a year ago, you would have played it much more already.

So the playcount is totally different, while you like the song in the same way.
To account for that, the "relative playcount" is calculated (the playcount per unit of time).

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Apr 30, 2006 9:26 pm

Maybe you can do a complete one, based on your understanding, and I'll take away that very 'radical' script above.. I just thought it was fun doing a 'currrently selected songs' script... :)
Image

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Sun Apr 30, 2006 9:42 pm

"complete" script (now with scripts.ini entry) has been posted above.

I changed the name to "CalculateRating", because the calculation is not exacly iRate's, and maybe the calculation will have to be changed in the future.

The script is only useful if you have a lot of files with PlayCount > 0.
For one or another reason, fost of my tracks PlayCount's are 0. :-?

It writes to the "Comment" field (as the original iRate program), but that can easily be changed to "Custom1", "Custom2", "Custom3" or something else.


If the script is "approved", then maybe a "NeutralRating = 1.5" setting can be added, together with the field where to write the calculated rating to.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Apr 30, 2006 9:56 pm

At least that version you did there do not change the ratings like the one I did..... I ended up with Bombs, since I have not any new music at the moment :lol:

Guess Amerie can comment on what he really wants, and take it from there. MM certainly seems to be able to do just about anything with a few scripting lines.

BTW: I just see that multiplier is not in there yet.
Worth checking the theory out I guess.

I just have a problem with DateAdded, as most of my songs do have the same DateAdded date.
Image

Amerie
Posts: 4
Joined: Wed May 18, 2005 4:14 pm
Location: New Zealand
Contact:

Post by Amerie » Sun Apr 30, 2006 10:44 pm

Thanks, I really appreciate the help.

I thought it might help if I explained why this works for me. My music collection used to live on my laptop and I played everything through MM and that was great, but now I mostly only listen to music on my iPod mini.

One of my problems now is that my playcounts are very low and slow to increment as I only sync my iPod every 1 - 2 weeks and even though i will have listened to some songs far more than others during that time, they all get incremented by 1 only. So playcount alone means nothing in the short term, but over time it all sorts itself out.

Also, given the lack of ability to update anything about a song on the iPod apart from rating, I use this in an ultra simplified way:
- not rated
x hate it or filler track (e.g. album intros and interludes)
* needs attention
** don't overly like but it completes an album
*** like it
**** love it
***** all time favourite

This means I have very little definition in my ratings (most of my collection falls into the four star group), and its my ratings that influence what ends up on my iPod.

I plan to use this new rating in my autoplaylist conditions as I'm hoping it will let me circulate my music collection a little more but still within the context of my ratings, which I will continue to use as normal.

Does that make any sense? I don't know if it'll work but it's worth a try.

The script looks great and you completely beat me to it on a couple of things (field to write to, multiplier value for unknown rating). Thanks so much! Now I just need to wait a few more hours before I can go home an try it out.

The only other thing I'm stuck on is grouping the results in the context of a rating value. I had a look at what iRate does but I think I would have to try it to understand the logic:
> 750 = 100
> 401 = 80
> 201 = 60
> 101 = 40
> 41 = 20
0-41 = 0

I also think I'd want a few more groupings for real value add, but don't know what kind of thresholds to set. Any ideas?

(@DiddeLeeDoo: Amerie = she, not he)

Teknojnky
Posts: 5524
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Sun Apr 30, 2006 10:46 pm

DiddeLeeDoo wrote:most of my songs do have the same DateAdded date.
Yea, this would be a situation where your most/all of your library was pre-existing and haven't added much to it, where as folks who have start with a smaller library and/or are constantly adding to it might favor this type of system.

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Sun Apr 30, 2006 10:58 pm

most of my songs do have the same DateAdded date.
That's no problem, is it.
In your case, almost all "relative playcounts" correspond with the real play counts, that's all.
The rating is still based on the playcount and the specified rating.



@ Amerie:
(similar to "Amelie", a French girls name, from the movie "Le Fabuleux destin d'Amelie Poulain")
The only other thing I'm stuck on is grouping the results in the context of a rating value. I had a look at what iRate does but I think I would have to try it to understand the logic:
> 750 = 100
> 401 = 80
> 201 = 60
> 101 = 40
> 41 = 20
0-41 = 0
Yes, the iRate calculation doesn't have a maximum value and can go to virtually infinite. These "thresholds" you mention here have to be chosen by yourself. It (too) much depends on your personal listening habits (e.g. currently, I have no songs above 101).
I also think I'd want a few more groupings for real value add, but don't know what kind of thresholds to set. Any ideas?
Sorry, I don't understand what you mean. Do you want something changed in the script, or do you need this outside the script?

Cheers
Steegy
Last edited by Steegy on Sun Apr 30, 2006 11:07 pm, edited 2 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

Post Reply