Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Autorating column (Read 29331 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Autorating column

Just create a new column in your columns playlist and copy paste this:

$puts(month,$mul(30,$num($substr(%last_played%,6,7),2)))
$puts(day,$num($substr(%last_played%,9,10),2))
$puts(date,$add($get(month),$get(day)))

$puts(fmonth,$mul(30,$num($substr(%first_played%,6,7),2)))
$puts(fday,$num($substr(%first_played%,9,10),2))
$puts(fdate,$add($get(fmonth),$get(fday)))

$puts(daterange,$sub($get(date),$get(fdate)))
$puts(fix,$div($get(daterange),5))//change 5 to whatether you wish (changes time scale)

$if(%play_counter%,$puts(rating,%play_counter%),$puts(rating,0))
$if($greater(%play_counter%,5),$puts(rating,5))
$puts(rating,$sub($get(rating),$get(fix)))



$repeat($char(9834),$get(rating))
$rgb(122,122,122)
$repeat($char(9834),$sub(5,$get(rating)))




Oh yes you'll need foo_playcount.dll (unofficial) to run this script.
What it does:every time you play a song the rating goes up by 1,if you don't play this song again for 5
days the rating will drop by 1.You can simply change this to be 1 week or 1 day.Enjoy




Note:this code contains mistakes use the other one instead (see below)
Favourite artist:CD-R
Favourite album:700MB


Autorating column

Reply #2
Interesting. If you want to see similar code, just see here:
http://www.hydrogenaudio.org/forums/index....1287&hl=hotness

It may interest you


Well actually i didn't know that this script exists (I've been looking for it) and decided to write one myself.
Anyway the hotness version requires foo_filedate.dll that isn't available for foobar 0.9
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #3
Looking at hotness code gave me some clue about referencing to system date fields so here's
updated and better version of the code (with all the credit to the hotness version) :(FIXED)
Important:You should go to Preferences->Playlist view->Globals and mark the "make date info available" box
Code: [Select]
$rgb()
$puts(month,$mul(30,%_system_month%))
$puts(day,%_system_day%)
$puts(date,$add($get(month),$get(day)))

$puts(fmonth,$mul(30,$num($substr(%first_played%,6,7),2)))
$puts(fday,$num($substr(%first_played%,9,10),2))
$puts(fdate,$add($get(fmonth),$get(fday)))
$if($stricmp($get(fdate),0),$puts(fdate,$get(date)))
$puts(daterange,$sub($get(date),$get(fdate)))
$puts(fix,$div($get(daterange),%play_counter%))
$if($greater($get(fix),0),$puts(fix,$sub($get(fix),1)))
$if($greater(%play_counter%,5),$puts(rating,$sub(5,$get(fix))),
$puts(rating,$sub(%play_counter%,$get(fix))))

$if($greater(0,$get(rating)),$puts(rating,0))
$if($greater($get(rating),5),$puts(rating,5))

$repeat($char(9834),$get(rating))
$rgb(122,122,122)
$repeat($char(9834),$sub(5,$get(rating)))


(You can set your system date to 5 days forward to see how the rating drops)

Favourite artist:CD-R
Favourite album:700MB


Autorating column

Reply #5
I'm sorry if i got it wrong,it's your code and you know better ,i just saw foo_filedate among the plugins
list on your topic
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #6
i've really been wanting to finalize my new version of the algorithm, but haven't been able to because the playcount plugin is lacking certain features.  i've pmed the author but haven't heard anything back.

Autorating column

Reply #7
i've really been wanting to finalize my new version of the algorithm, but haven't been able to because the playcount plugin is lacking certain features.  i've pmed the author but haven't heard anything back.


What features exactly?Maybe it's possible to find a workaround
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #8
Awesome! Ever since I found a function somewhat like this one in some random .fcs I have been trying to implement it into the navigator style. But, when I create a new column with your code, the only thing I get is this:


Autorating column

Reply #9
i got the same problem, i changed "play_counter" to play_count, the symbols changed but the 0 stayed....

btw. nice music taste ^^

Autorating column

Reply #10
Awesome! Ever since I found a function somewhat like this one in some random .fcs I have been trying to implement it into the navigator style. But, when I create a new column with your code, the only thing I get is this:




Ok you right about the zero (i forgot to write $puts instead of $put in one place and i've already fixed it,
see the second version) i also hope that you are using unnoficial version of playcount,for everything else note that if you haven't been listening to some song for about a year (one year date range) then after listening to it once or twice you won't get any rating.If you want the things to run differently just tell me exactly what kind of
feature behavior do you want and i'll try to write it for you.I myself using this code cos it feels right to me


i got the same problem, i changed "play_counter" to play_count, the symbols changed but the 0 stayed....

btw. nice music taste ^^


I fixed the zero problem just take the code you see above,and please don't change play_counter to play_count
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #11
Whenever I've played a song for one minute or so the rating doesn't go up by one but simply jumps to 5... :/
Does anybody have an idea what I'm doing wrong?

Autorating column

Reply #12
Whenever I've played a song for one minute or so the rating doesn't go up by one but simply jumps to 5... :/
Does anybody have an idea what I'm doing wrong?


Hmm.Strange it works for me like a charm.Try the following:take some track with playcount=0
or manualy delete the playcount and try to play it.Tell me what happens,or if you wish to wait half an hour i can
write you new code.
P.S. What code have you been using? Use the one marked "FIXED"
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #13
Hmm.Strange it works for me like a charm.Try the following:take some track with playcount=0
or manualy delete the playcount and try to play it.Tell me what happens,or if you wish to wait half an hour i can
write you new code.
P.S. What code have you been using? Use the one marked "FIXED"


I used the fixed code. I've only downloaded the playcount (And yes, I am using the unofficial one) component just now, so all playcounts are not set... :/

Autorating column

Reply #14
I know what is your problem people!! Go to Preferences->Playlist view->Globals and mark the
"make date info available" box.It wont work without it,cos it uses the system date fields.
I completely forgot about it,sorry.

and just for those who didn't feel comfortable with the previuos version i post this code:the main difference is that it doesnt increase or decrease rating according to the date range\playcount ratio but simply
decreases every given time range (by default 5 days) and increases every time you play the song.

PS just fixed a problem with rating increase (23:13)

Code: [Select]
$rgb()
//Change "decreaserange" value to the desired period after which the rating drops (in days)
$puts(decreaserange,5)
$puts(month,$mul(30,%_system_month%))
$puts(day,%_system_day%)
$puts(date,$add($get(month),$get(day)))

$puts(fmonth,$mul(30,$num($substr(%first_played%,6,7),2)))
$puts(fday,$num($substr(%first_played%,9,10),2))
$puts(fdate,$add($get(fmonth),$get(fday)))
$if($stricmp($get(fdate),0),$puts(fdate,$get(date)))
$puts(daterange,$sub($get(date),$get(fdate)))
$puts(fix,$div($get(daterange),$get(decreaserange)))
$if($greater($get(fix),5,),$puts(fix,5))
$if(%play_counter%,$puts(rating,%play_counter%),$puts(rating,0))
$if($greater(%play_counter%,5),$puts(rating,$sub(5,$get(fix))),
$puts(rating,$sub($get(rating),$get(fix))))

$if($greater(0,$get(rating)),$puts(rating,0))
$if($greater($get(rating),5),$puts(rating,5))

$repeat($char(9834),$get(rating))
$rgb(122,122,122)
$repeat($char(9834),$sub(5,$get(rating)))
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #15
Thanks, I think it's working now ^_^

*plays some more songs*

Yup, it's working :)


Autorating column

Reply #17

Awesome! Ever since I found a function somewhat like this one in some random .fcs I have been trying to implement it into the navigator style. But, when I create a new column with your code, the only thing I get is this:




Ok you right about the zero (i forgot to write $puts instead of $put in one place and i've already fixed it,
see the second version) i also hope that you are using unnoficial version of playcount,for everything else note that if you haven't been listening to some song for about a year (one year date range) then after listening to it once or twice you won't get any rating.If you want the things to run differently just tell me exactly what kind of
feature behavior do you want and i'll try to write it for you.I myself using this code cos it feels right to me


Ah, thank you! Your latest posted version works super. But, I am like Generalverdacht using the official version of foo_playcount, so I also changed it to %play_count%. Why isn't this a good idea? Is it worth the trouble to switch to the unofficial version?
Anyways, thanks alot for the coding

And thank you, Generalverdacht. Folk metal rules

Autorating column

Reply #18
You see it's ok to switch to whatever version you like as long as you know what you are doing.
A lot of users are not familiar with titleformatting so its best for them to stick to whatever is prooved
to work.Anyway if you have any other questions\requests just post it here
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #19
You see it's ok to switch to whatever version you like as long as you know what you are doing.
A lot of users are not familiar with titleformatting so its best for them to stick to whatever is prooved
to work.Anyway if you have any other questions\requests just post it here


Ah, yes, okay. I consider myself familiar with the syntax basics
And thanks again!

Autorating column

Reply #20
Cool code

One question: I'm using this code with the official playcoun component (only %play_count% and %last_played%), will this also work as expected? I mean, I don't have the first played values, but I assume that the rating/score will decay after 5 days the song isn't played... am I wrong?

Thanks.

Autorating column

Reply #21
Cool code

One question: I'm using this code with the official playcoun component (only %play_count% and %last_played%), will this also work as expected? I mean, I don't have the first played values, but I assume that the rating/score will decay after 5 days the song isn't played... am I wrong?

Thanks.

If you are using the official playcount you need to go through the code and change  %play_counter%
to %play_count%.
As for decay:in the first version the rating is computed by %play_counter%-(daterange/%play_counter%)+1,
in the second one (that you're asking about) it just drops every X days no matter what.
It will be possible to make version in which the rating drops only if a song hasn't been played for X days
as soon as quicktag plugin will be ported to 0.9
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #22
If you are using the official playcount you need to go through the code and change  %play_counter%
to %play_count%.
As for decay:in the first version the rating is computed by %play_counter%-(daterange/%play_counter%)+1,
in the second one (that you're asking about) it just drops every X days no matter what.
It will be possible to make version in which the rating drops only if a song hasn't been played for X days
as soon as quicktag plugin will be ported to 0.9

I've tried (without too much understanding, I've just get out of bed ) to make a version of your code that will drop rating when a song hasn't been played in the last 5 days (as your first version), just using the %last_played% values and the current date. I hope what I've done makes sense and it's not stupid. If it's please let me know

Code: [Select]
$rgb()
$puts(decreaserange,5)
$puts(month,$mul(30,%_system_month%))
$puts(day,%_system_day%)
$puts(date,$add($get(month),$get(day)))

$puts(lmonth,$mul(30,$num($substr(%last_played%,6,7),2)))
$puts(lday,$num($substr(%last_played%,9,10),2))
$puts(ldate,$add($get(lmonth),$get(lday)))
$if($stricmp($get(ldate),0),$puts(ldate,$get(date)))
$puts(daterange,$sub($get(date),$get(ldate)))
$puts(fix,$div($get(daterange),5))
//change 5 to whatether you wish (changes time scale)

$if(%play_count%,$puts(rating,%play_count%),$puts(rating,0))
$if($greater(%play_count%,5),$puts(rating,5))
$puts(rating,$sub($get(rating),$get(fix)))

$repeat($char(9834),$get(rating))
$rgb(122,122,122)
$repeat($char(9834),$sub(5,$get(rating)))

Autorating column

Reply #23
Quote
I've tried (without too much understanding, I've just get out of bed wink.gif) to make a version of your code that will drop rating when a song hasn't been played in the last 5 days (as your first version), just using the %last_played% values and the current date. I hope what I've done makes sense and it's not stupid. If it's please let me know smile.gif


It's funny,you got into the same old problems that i did when first wrote this code:
lets say you have a song with playcount=2,now you don't listen to it for 10 days
(system date-last played date=10) so your rating  now equals zero,in one bright morning you decide to listen
to that song again,just as you play it the %last_played% tag is being updated to the current date plus
%play_count% increased by 1,so now system date-last played date=0 and %play_count%=3,so the rating
jumps straight from 0 to 3  (I had the same headache).In addition you have to make sure that your rating
doesn't get negative value cos in that way you will get more than 5 symbols displayed for your rating.
BTW what you did totaly make sence and not stupid try one more time and you'll succeed.
Favourite artist:CD-R
Favourite album:700MB

Autorating column

Reply #24
It's funny,you got into the same old problems that i did when first wrote this code:
lets say you have a song with playcount=2,now you don't listen to it for 10 days
(system date-last played date=10) so your rating  now equals zero,in one bright morning you decide to listen
to that song again,just as you play it the %last_played% tag is being updated to the current date plus
%play_count% increased by 1,so now system date-last played date=0 and %play_count%=3,so the rating
jumps straight from 0 to 3  (I had the same headache).In addition you have to make sure that your rating
doesn't get negative value cos in that way you will get more than 5 symbols displayed for your rating.
BTW what you did totaly make sence and not stupid try one more time and you'll succeed.


Finally I see that your last code is smarter, since it start dropping the rating after 5 days, but increase it once you play again the track, and then the decrease range is reset. So, I've just make it work with the official playcount, by replacing %play_counter% by %play_count% and %first_played% by %last_played%. Here'"s the code if someone is interested:

Code: [Select]
$rgb()
//Change "decreaserange" value to the desired period after which the rating drops (in days)
$puts(decreaserange,5)
$puts(month,$mul(30,%_system_month%))
$puts(day,%_system_day%)
$puts(date,$add($get(month),$get(day)))

$puts(lmonth,$mul(30,$num($substr(%last_played%,6,7),2)))
$puts(lday,$num($substr(%last_played%,9,10),2))
$puts(ldate,$add($get(lmonth),$get(lday)))
$if($stricmp($get(ldate),0),$puts(ldate,$get(date)))
$puts(daterange,$sub($get(date),$get(ldate)))
$puts(fix,$div($get(daterange),$get(decreaserange)))
$if($greater($get(fix),5,),$puts(fix,5))
$if(%play_count%,$puts(rating,%play_count%),$puts(rating,0))
$if($greater(%play_count%,5),$puts(rating,$sub(5,$get(fix))),
$puts(rating,$sub($get(rating),$get(fix))))

$if($greater(0,$get(rating)),$puts(rating,0))
$if($greater($get(rating),5),$puts(rating,5))

$repeat(har(9834),$get(rating))
$rgb(122,122,122)
$repeat(char(9834),$sub(5,$get(rating)))


BTW, does someone knows if ti can be used in Playlist Tree or autoplaylist, to generate a 'Hot tracks' playlist and sort it by rating? Maybe making this work as globals, dunno...

I'm also using 'hotness' code alongside with this code (in another column), to see how they behave and decide wich one seems more appropiate to me.