Auto Rating of Songs & Radio Announcer v5.02 [Script]

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

Moderators: Peke, Gurus

rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy »

thats right you did say that in there. :oops:

but with the 168 this might give you a good test on the lowering of a songs rating part of the script too. so i will let it go for testing that.

as i know it does not play all my songs in a week, i have too many for that. it might take a month for it to play them all atleast once, even at playing them 24 / 7.
:P :lol:

signed in for a while just to surpise every one.
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

rovingcowboy wrote: play count after a week of playing would be set like below.

from 1 to 50 would equal 2 stars.

from 51 to 100 would equal 4 stars.

and anything greater then 101 would be 5 stars.
You can do some calculations here.

You want
100 plays over 168 hours = 4 Stars

Script do:
4 plays / x hours = 4 Stars

Calculation:
100 plays / 168 hours = 0.595 plays an hour

Then you devide the scripts 4 plays by this factor
4 / 0.595 = 6.7 hours

ie.
4 plays over 6.7 hours qualify for 4 stars.

So in your case the ideal hours to set is 6.7 to meet the desired 100 plays a week to receive 4 stars.

I guess this could be taken further.
The script could maybe check max play of any song over a period, and do that as 5 star, and reduce accordingly, but that's for another Easter :D

Added: BTW, the script never rate anything other than the last played song over x time. So it would rate your 'night' songs at night, and 'day' songs at daytime.
Last edited by DiddeLeeDoo on Thu Apr 13, 2006 12:21 am, edited 1 time in total.
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

You can make these various settings an option tab and save them in the ini file relatively easy.

Check out my 'tweakmonkey' script or the more complex scrobbler dj and several others which create a user option page which you can populate with various controls and then save them to the MM ini file.
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Good idea Teknojnky.

Maybe it then becomes more understandable for those who do not want to go 'deep'

I need to attend another job over the next day or so, so if anyone feel like doing options here, they are more than welcome! Team work, hey!

Added: You may notice Teknojnky that your original idea of 2.5 Star as a starting point is in there, plus gradual upgrade of songs. However, since I did not want to touch any other tags than the Rating field, the rating sub-points did not get included.
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy »

well i got good news

and bad news.


first the bad,
i couldn't sleep last night, but with me that is normal 8)

the good is that i stayed up and messed around with the script
testing this and that out. :D

1.

with or with out the trigger vbs in the auto folder, the script works.
no big surprise since the ini was changed. to not even look in the folder.

2.

the new script works automaticly with out having to click a link in the scripts menu.
which is good.

3.

the djamp program and the winscripts do not have any errors now and both work
with the monkey as they did before.

4.

i did all the starting and stoping of the djamp and winscipts my self. we will see what
happens with the task scheduler timers that i use.

but i don't foresee any troubles with them so the code is working as it was said to do.

good job on the coding so it is thanks. :wink: 8)

now don't forget to put the link to this thread in the all scripts message.
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Hard to sleep when cracking problems really. Guess we're build like that, sleep well when all is calm, and be alert when needed.

Anyways, thank you very much for helping making this script more sosially well behaved. It's a pleasure to know that AutoRateSongs have become friends with your other scripts.

I just had a look at Teknojnky's TweakMonkey, and it is impressive. So many people have requested 'hide nodes' and here it is. TweakMonkey! Well done...

I suppose to work, and you Roving Cowboy suppose to sleep... No doubt knowing that you can have all your songs properly rated automatically is rather exciting.. :) I've had it on my....... should do.... list for ages!!

I'll try to do some more 'real' work, but it's rather boring compared to this....
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Judas asked for a 'auto-refresh' window after rating, so he do not have to hit F5 to see how to rating went.

You get that by adding the bold line like indicated below.
(script about to close, and you ask it to refresh your screen before closing)

Int(AR_itm.SongLength/1000)
AR_f.close
'and close
AR_SDB.MainTracksWindow.Refresh
'if lastsong log do not exist,

Not sure if that should be standard though, as it can maybe become annoying to see the screen refesh after every track.

Have to do more reading about an option sheet, so it may become a non-default option. Tried to send you a private message Judas, but it's stuck in the outbox.
MCSmarties
Posts: 251
Joined: Tue Dec 06, 2005 8:01 pm

Post by MCSmarties »

Wow guys, I just found this thread and this script looks like an awesome idea!
I was wondering about a few things (maybe I don't quite understand how it works).

1. What happens if you don't start Mediamonkey at all for some time?
Does this affect the ratings in any way? (in other words, is the time variable based on system time, media monkey uptime or actual play time?

2. I wonder if this script could be modified to make synchronizing with a portable device easier.
I don't know if it's possible, but maybe a song can somehow be flagged, or added/removed from a "synchronization autoplaylist"
based on whether its rating has substantially changed.

Example: you suddenly start liking a song rated 2 that you haven't heard in ages and play it all the time.
As a result, the rating jumps up -> the song is automatically added to a synchronization autoplaylist (if it's not there already)

Counter-example: After a while of listening almost permanently to the same song, you're getting tired of it.
You skip it whenever it plays -> rating drops fast and the song gets removed from the synchronization autoplaylist.

At this point, these are just musings. Any thoughts on this?
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

MCSmarties wrote: 1. What happens if you don't start Mediamonkey at all for some time?
The script operates only in real time. Like if you haven't played anything last week, you start fresh and the scripts monitors what you do from now on. (unless you set the hours parameter to include two weeks back, but that will normally create over-rated songs)

The idea is that, say you get a new album, and you don't like it that much, but you tolerate it, the album get rated 3 stars automatically. (one full play of each song, if skipped when unrated, 2.5 star)
You may like a track, and you play it twise, it will get rated 3.5 stars, and so on. If you're nuts about the track, and play it four times within set hours period, it get 4.5 stars.

Setting how long period the script suppose to check for multi plays is a very subjective thing.

One person may tolerate to listen to the same track 5 times in a row, and therefore need to the hours parameters to only an hour or so.

An other person may tolerate to listen to the same track only 5 times during 2 days, and need to set the hours parameter accordingly.

If a track already is rated high, and the play count do not qualify it to go further up, it will keep it's rating. However, if you start skipping the track, it will go down in rating.

If you happen to have a song that is rated 4 stars, and you skip it, it will be reduced by 0.5 star. Basically for this song to be rated 1 star only, you need to skip it 6 times. (which may be a bit extreme, and I'm sure the track deserve to only have 1 star if you've skipped it that often), then again, if you happen to play a frequently skipped track, one full play, it will go back to 3 stars, because you tolerate the song now..

The script also allow you to sample songs without it being considered for rating. That's what the SampleSeconds comes in. If you need 6 seconds to sample a song, that's what you set that parameter to.

Then there is that percentage played variable, basically the idea with that if you've tolerated most of the song, it's not that bad so it will not be downgraded.

In regards to portable devices, I'm not sure, but the script set the ratings, so if you have playlists that scans for current rating, that playlist will be updated too.

Currently I'm looking into a way to make MM display what rating were done, as you have to hit F5 to see what happened. I find it to work best with F5 if I'm browsing under the Library/Location Node.

I'd like to find a way that update the track that was played only, instead of the whole screen. Just have to find out how... :)
Guest

Post by Guest »

i been thinking on that updating the now playing and refreshing the screen after every play.

it might sound good but i don't need it the way i do it. and on some slow computers refreshing that much might bog the cpu down?

not sure how to do it either? since i can't program i have to give ideas and i don't have one for that sorry. :(

roving cowboy / keith hall.
not logged in.

dang playlist for nap time is playing soft music and i been up all day and all night and then all this morning dumb nap time music making me tired.
Guest

Post by Guest »

MCSmarties wrote:Wow guys, I just found this thread and this script looks like an awesome idea!
I was wondering about a few things (maybe I don't quite understand how it works).

1. What happens if you don't start Mediamonkey at all for some time?
Does this affect the ratings in any way? (in other words, is the time variable based on system time, media monkey uptime or actual play time?

2. I wonder if this script could be modified to make synchronizing with a portable device easier.
I don't know if it's possible, but maybe a song can somehow be flagged, or added/removed from a "synchronization autoplaylist"
based on whether its rating has substantially changed.

Example: you suddenly start liking a song rated 2 that you haven't heard in ages and play it all the time.
As a result, the rating jumps up -> the song is automatically added to a synchronization autoplaylist (if it's not there already)

Counter-example: After a while of listening almost permanently to the same song, you're getting tired of it.
You skip it whenever it plays -> rating drops fast and the song gets removed from the synchronization autoplaylist.

At this point, these are just musings. Any thoughts on this?
i am also glad you found it :)

1. answer in short.
if you don't play monkey then the script don't run.
if you don't play it for a week and you have script set to check back 24 hours for songs that were played then it will adjust the rating when the song is played again. it might lower the rating. (might) i mean will since it did on this xp when i tested that by chaning the hour amout.

2. no idea how to sync it?
but it changes the rating in the monkey's database, and i believe monkey changes the ratings tag on the file when you close monkey. so if you put the song on the portable then the new rating will show up.
(atleast that is my guess since i can not test that idea)
8)
roving cowboy/ keith hall.

still tired and not logged in.
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

With a 24/7 play, you would get a pretty huge MM Database I would think, roving cowboy. Mine is only like 40MB, as it is pretty fresh.

While researching, I sort of hopes that an experienced scripter will say, you just do... like onkel_enno did with that write log issue... that was great!!! Thank you again onkel_enno!

Trying to see if maybe ISDBSongData.WriteTags will do the trick. To ensure the file tag is updated too. If lucky that may update the screen for that track too.... That update screen mentioned earlier became annoying pretty quick.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Nice script DiddeLeeDoo! Hopefully you are learning a lot about SQL, so you can become one of the new SQL experts.... we need you :D

I haven't much time (this argument gets "hackneyed", but it's true) so I have read this thread diagonally.

Probably the problem with the script is that you are circumventing MM too much in doing song updates (you update the database directly through the sql "UPDATE" command). That means MM doesn't know about the changes, until it reads the values back in, e.g. during a reload caused by a tracklist refresh.

A more elegant/correct way would be to do all/most updates through MM itself, by using SongData objects (representing the songs), and changing the appropriate fields. Then use one or more of the following: UpdateDB, UpdateArtist, UpdateAlbum, WriteTags (or UpdateAll for a list of SongData objects: the SongList) to update the database and if necessary also explicitly the file's tags.
This will cause MM to internally update the songs (so the tracklist will get updated), the database will be written to, *and also the file's tags* (if that is specified). The last is probably not really necessary in your case, but that's just because your lucky... :wink: (in fact, also the rating field should be updated to the files.)
When you let MediaMonkey do the updates, as default it does 3 updates correct at once (GUI, database, file).

For this mentioned way of working, you only need to get the SongData object for the song you want.
If you have the ID of the song, then you can make a SDB.DataBase.QuerySongs call, for the specified ID.
(in theory, it should also be possible to do SDB.NewSongData and then assign .ID = [specifiedID] to it, but it probably doesn't work in reality. I haven't tested that way anyway.)

Code: Select all

Dim MySong
Set MySong = SDB.Database.QuerySongs("AND Songs.ID = [specifiedID]")
If Not MySong.EOF Then
    MySong.Rating = [ratingPercentage]
    MySong.UpdateDB
End If
and replace [specifiedID] and [ratingPercentage].
No guarantee it's working... I haven't tested it.

Cheers
Steegy (also tired :wink: )
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 »

Steegy, you're a GEM!!

Thank you for these great guidelines.

I had a feeling it all could be optimized. All this SQL'ing basically is the 'idea', then it's getting it to co-operate properly with MM is what 'could make it'.

I've been doing relatively simple SQL'ing for almost 20 years, so it's a comfort zone, but this ‘stand-alone’ scripting is totally new to me, and a lot of fun, as I've just discovered! The 'madam' in the house is not happy with it though, she's become a scripting widow the past few days. :roll: Got her a game, so now she's all happy, having her own 'supa-focus' on her monitor. :wink:

Just hope I can finish this project before she looses the interest of the game, otherwise I'm in trouble! :o

Added:
I just saw that Jiri has guided in this kind of problem before at.
http://www.mediamonkey.com/forum/viewto ... datedb+sql
Pablo understands, but I do not yet... hmm...

Tried this

Code: Select all

				Dim MySong, strWhere
				strWhere = "AND Songs.ID=" & LastSongsID
				Set MySong = SDB.Database.QuerySongs(strWhere)
				If Not MySong.EOF Then
    				MySong.Rating = 50
    				MySong.UpdateDB
				End If
but get Object MySongs.Rating not supported. Feel I do something wrong.
confused

Post by confused »

just a guess here but wouldn't it be a lot simpler to stick a line of code in the script at the end of it that would trigger the same thing pressing the F5 key triggers?
:-?
Post Reply