DADA Auto-Rating (DAR v.2.0.1) for foobar2000 v.1.1+ ---------------------------------------------------- [LAST UPDATED: 5th April 2015] CONTENTS: I. CHANGELOG II. SETUP INSTRUCTIONS III. DAR INDEXED RATING (WITH DOTS) IV. MAKING AN AUTOPLAYLIST RANKED BY DAR V: PREVIOUS VERSION (1.6.4) CODE ************************************************************************ Changelog DAR 2.0.1: - Fixed a minor error in the Fall Rate Mechanism (since 2.0.0) which defines how fast tracks fall when not played. It was a minor error, users should see a minor uptick in the ratings of low rated tracks that haven't been played for a good while. DAR 2.0.0: - Major upgrade to the Low Playcount Penalty. - Removed the floor from the ratings system and added a simple Auto-Boost mechanism (on by default). - Simplified and improved the robustness of the Fall Rate Mechanism which defines how fast tracks fall when not played. For details on these changes see: http://www.giantpygmy.net/gptxt/?post=dada-music-auto-rating-algorithm-foobar2000#-Recent-Changes:-v.2.0.1%C2%A0-(05.04.15) DAR 1.6.4: Changed the old track suppression multiplier from a static to a dynamic variable. This reduces the "performance burden" of older tracks with each additional year in the collection. The lib0 variable can be altered for those with very large or small collections. For a library of less than 5000 tracks I'd recommend a minimum of 1900 (which will be close to the DAR 1.6.3 default) or 1950. For most the default (2000) will work very well. If you have a large 30k+ library AND you are seeing newer tracks dominating the ratings, try increasing the lib0 to 2001, then 2002 etc... but do not go beyond the age of your oldest track. So, if your stats begin in 2007, the max for the lib0 variable will be 2007. I would suggest that to go to the maximum (i.e. in this example, 2007) would only be appropriate for users with a very large music collection (say, in the 50k+ region). Relevant line to edit: $puts(lib0,$date_diff(2000)) DAR 1.6.3: Introduced Super Long Track duration suppression (this only affects songs > 60 mins). The original DAR didn't foresee tracks longer than the duration of a CD. Though rare, such tracks do exist. This update ensures their ratings are not artificially high. ************************************************************************ I. SETUP INSTRUCTIONS If you've previously installed (foo_dynra), firstly uninstall it (remove it from foobar2000's component directory). [For new users] After you've installed foobar2000, foo_playcount.dll, foo_dynfil 1) In foobar2000 go to: File > Preferences > Media Library > Dynamic Fields 2) Click on the + button, and type " dynamic_rating " (without the inverted commas) 3) Paste the code below (and only the code) into the blank "Title Formatting Expression" box. 4) Set the recalculation interval, then 5) Click "Okay" and "Okay" again and foobar2000 will restart. 6) Create a custom column and enter: %_dynamic_rating% (note the %_underscore at the beginning) 7) If you haven't already played some tracks (i.e. you haven't got any playback stats) do so, then: 8) Incase the library hasn't done its initial calculation, go to: Library > "recalculate dynamic fields", foo_dynfil will do this according to the recalculation interval set earlier. $puts(pc,%play_count%) $puts(x,$add($date_diff(%added%),2)) $puts(y,$date_diff(%added%,%last_played%)) $puts(z,$sub($get(x),$get(y),2)) $puts(l,%length_seconds%) $puts(lib0,$date_diff(2000)) $puts(lib1,$div($add($mul($sub(100,$div($date_diff(%added%),$div($get(lib0),100))),15),2600),30)) $puts(pc1,$add($get(pc),2)) $puts(pc3,$mul($get(pc1),$get(pc1),$get(pc1))) $puts(b1,$add($div($date_diff(2015),5),0)) $puts(b2,$add($div($get(b1),50),500)) $puts(d0,$ifgreater($get(l),3599,$muldiv(9000,$get(l),3600),9000)) $puts(d1,$muldiv($add($get(l),540),1,4)) $puts(d2,$muldiv($get(l),$get(l),$get(d0))) $puts(d3,$add($get(d1),$get(d2))) $puts(r0,$mul($add(1000,$muldiv($get(d3),$get(pc),100)),10)) $puts(dd,$div($add($get(y),50),10)) $puts(pp,$muldiv($get(pc),10000,$get(x))) $puts(2,$muldiv($get(dd),$get(pp),100)) $puts(3,$muldiv($get(x),$get(lib1),100)) $puts(4,$div($get(pp),50)) $puts(5,$div($muldiv($add($div($date_diff(%added%,%first_played%),5),5000),$get(b2),$add($div($get(l),20),140)),$add($div($get(pc3),58),3))) $puts(6,$muldiv($get(pc),625,$get(x))) $puts(7,$add($get(3),$get(5),$get(6))) $puts(r1,$add($get(2),$get(r0))) $puts(r2,$add($get(4),$sub($get(r1),$get(7)))) $puts(r2a,$ifgreater($get(r2),0,$get(r2),1)) $puts(r3,$sub($get(r2),$div($mul($get(r2a),$get(z),3),50000))) $puts(r4,$add($get(r3),$get(b1))) $ifgreater($get(pc),0,$num($get(r4),5),-----) ************************************************************************ II. DAR INDEXED RATING (WITH DOTS) If you want a visual reprentation of the DAR results (i.e. dots) as per this screenshot: https://www.giantpygmy.net/gptxt/data/uploads/img/audio-posts/gpa-archive/DAR_v2.0.0_dar_index_dots.png Then create a custom column in foobar2000 and enter the following code: 1. For Columns UI (CUI) users: MAX 10 dots Settings: Set the maxdar to the minimum value that will achieve 10 dots, all ratings above that will get the maximum 10 dots. A general rule to set the mindar value is to take your lowest rated track's DAR Rating, round up to nearest 1000 and then add 500 (then another 500 until you're happy). Display: A rating of 6 will show 6 dark grey dots with 4 trailing light grey dots. $puts(maxdar,10000) $puts(mindar,5000) $puts(maxsub,$sub($get(maxdar),0)) $puts(r3,$ifgreater(%_dynamic_rating%,$get(maxsub),$get(maxsub),%_dynamic_rating%)) $puts(r4,$ifgreater($get(r3),0,$get(r3),1)) $puts(minmax,$sub($get(maxdar),$get(mindar))) $puts(darind1,$sub($get(r4),$get(mindar))) $puts(darind2,$div($mul($get(darind1),10),$get(minmax))) $puts(darind3,$ifgreater($get(darind2),1,$get(darind2),1)) $puts(display,$rgb(100,100,100)$repeat($char(9679),$get(darind3))$rgb(220,220,220)$repeat($char(9679),$sub(10,$get(darind3)))) $puts(notplayed,$rgb(200,200,200)- n/a -) $ifgreater(%_dynamic_rating%,0,$get(display),$get(notplayed)) 2. For Columns UI (CUI) users: MAX 5 dots Settings: Set the maxdar to the minimum value that will achieve 10 dots, all ratings above that will get the maximum 10 dots. A general rule to set the mindar value is to take your lowest rated track's DAR Rating, round up to nearest 1000 and then add 500 (then another 500 until you're happy). Display: A rating of 3 will show 3 dark grey dots with 2 trailing light grey dots. $puts(maxdar,10000) $puts(mindar,5000) $puts(maxsub,$sub($get(maxdar),0)) $puts(r3,$ifgreater(%_dynamic_rating%,$get(maxsub),$get(maxsub),%_dynamic_rating%)) $puts(r4,$ifgreater($get(r3),0,$get(r3),1)) $puts(minmax,$sub($get(maxdar),$get(mindar))) $puts(darind1,$sub($get(r4),$get(mindar))) $puts(darind2,$div($mul($get(darind1),5),$get(minmax))) $puts(darind3,$ifgreater($get(darind2),1,$get(darind2),1)) $puts(display,$rgb(100,100,100)$repeat($char(9679),$get(darind3))$rgb(220,220,220)$repeat($char(9679),$sub(5,$get(darind3)))) $puts(notplayed,$rgb(200,200,200)- n/a -) $ifgreater(%_dynamic_rating%,0,$get(display),$get(notplayed)) 3. For Default UI (DUI) users: MAX 10 dots Settings: Set the maxdar to the minimum value that will achieve 10 dots, all ratings above that will get the maximum 10 dots. A general rule to set the mindar value is to take your lowest rated track's DAR Rating, round up to nearest 1000 and then add 500 (then another 500 until you're happy). Display: A rating of 6 will show 6 dark grey dots (with no trailing light grey dots). $puts(maxdar,10000)$puts(mindar,5000)$puts(maxsub,$sub($get(maxdar),0))$puts(r3,$ifgreater(%_dynamic_rating%,$get(maxsub),$get(maxsub),%_dynamic_rating%))$puts(r4,$ifgreater($get(r3),0,$get(r3),1))$puts(minmax,$sub($get(maxdar),$get(mindar)))$puts(darind1,$sub($get(r4),$get(mindar)))$puts(darind2,$div($mul($get(darind1),10),$get(minmax)))$puts(darind3,$ifgreater($get(darind2),1,$get(darind2),1))$puts(display,$repeat(<<$char(9679)>>,$get(darind3)))$puts(notplayed,- n/a -)$ifgreater(%_dynamic_rating%,0,$get(display),$get(notplayed)) 4. For Default UI (DUI) users: MAX 5 dots Settings: Set the maxdar to the minimum value that will achieve 10 dots, all ratings above that will get the maximum 10 dots. A general rule to set the mindar value is to take your lowest rated track's DAR Rating, round up to nearest 1000 and then add 500 (then another 500 until you're happy). Display: A rating of 3 will show 3 dark grey dots (with no trailing light grey dots). $puts(maxdar,10000)$puts(mindar,5000)$puts(maxsub,$sub($get(maxdar),0))$puts(r3,$ifgreater(%_dynamic_rating%,$get(maxsub),$get(maxsub),%_dynamic_rating%))$puts(r4,$ifgreater($get(r3),0,$get(r3),1))$puts(minmax,$sub($get(maxdar),$get(mindar)))$puts(darind1,$sub($get(r4),$get(mindar)))$puts(darind2,$div($mul($get(darind1),5),$get(minmax)))$puts(darind3,$ifgreater($get(darind2),1,$get(darind2),1))$puts(display,$repeat(<<$char(9679)>>,$get(darind3)))$puts(notplayed,- n/a -)$ifgreater(%_dynamic_rating%,0,$get(display),$get(notplayed)) 5. As a currently playing track indicator: Non-playing tracks will show, for example, "Artist - Title", however, the currently playing track will show the DAR indexed rating with a maximum of 10 dark grey dots followed by "Artist - Title". If you'd rather have this out of 5 dots, you can change the "$puts(darind2 ..." line from 10 to 5. Set your titleformatting track display for your (probably left-most) column in the "trackinfo" line below (3rd line down). $puts(maxdar,10000) $puts(mindar,5000) $puts(trackinfo,%artist% - %title%) $puts(maxsub,$sub($get(maxdar),0)) $puts(r3,$ifgreater(%_dynamic_rating%,$get(maxsub),$get(maxsub),%_dynamic_rating%)) $puts(r4,$ifgreater($get(r3),0,$get(r3),1)) $puts(minmax,$sub($get(maxdar),$get(mindar))) $puts(darind1,$sub($get(r4),$get(mindar))) $puts(darind2,$div($mul($get(darind1),10),$get(minmax))) $puts(darind3,$ifgreater($get(darind2),1,$get(darind2),1)) $puts(display,$repeat($char(9679),$get(darind3))) $puts(notplayed,$char(9679) first play >) $puts(rateplay,$ifgreater(%play_count%,0,$get(display),$get(notplayed))) $puts(noplay,$get(trackinfo)) $puts(play,$get(rateplay) $get(trackinfo)) $ifgreater(%isplaying%,0,$get(play),$get(noplay))) ************************************************************************ III. MAKING AN AUTOPLAYLIST RANKED BY DAR To create an autoplaylist ranked according to the DAR algorithm: 1) Go to: Library > Search > and paste: " %_dynamic_rating% GREATER 0 " (without the inverted commas) into the search box. 2) Click on the [...] button and select: "Create Autoplaylist" 3) Right click on the New Playlist and select "Autoplaylist properties" 4) Enter " $sub(99999,%_dynamic_rating%) " in the box as per this screenshot: https://www.giantpygmy.net/gptxt/data/uploads/img/audio-posts/gpa-archive/DAR_v1.6.2_autoplaylist_properties.png ************************************************************************ IV: PREVIOUS VERSION (1.6.4) CODE Should anyone wish to revert to the prior version for any reason, here's the code: $puts(pc,%play_count%) $puts(x,$add($date_diff(%added%),2)) $puts(y,$date_diff(%added%,%last_played%)) $puts(z,$sub($get(x),$get(y),2)) $puts(l,%length_seconds%) $puts(lib0,$date_diff(2000)) $puts(lib1,$div($add($mul($sub(100,$div($date_diff(%added%),$div($get(lib0),100))),15),2600),30)) $puts(d0,$ifgreater($get(l),3599,$muldiv(9000,$get(l),3600),9000)) $puts(d1,$muldiv($add($get(l),540),1,4)) $puts(d2,$muldiv($get(l),$get(l),$get(d0))) $puts(d3,$add($get(d1),$get(d2))) $puts(r0,$mul($add(1000,$muldiv($get(d3),$get(pc),100)),10)) $puts(dd,$div($add($get(y),50),10)) $puts(pp,$muldiv($get(pc),10000,$get(x))) $puts(2,$muldiv($get(dd),$get(pp),100)) $puts(3,$muldiv($get(x),$get(lib1),100)) $puts(4,$div($get(pp),50)) $puts(5,$div($muldiv($add($date_diff(%added%,%first_played%),2000),500,$add($div($get(d3),6),70)),$add($mul($get(pc),$get(pc)),1))) $puts(6,$muldiv($get(pc),625,$get(x))) $puts(7,$add($get(3),$get(5),$get(6))) $puts(r1,$add($get(2),$get(r0))) $puts(r2,$add($get(4),$sub($get(r1),$get(7)))) $puts(r3,$sub($get(r2),$div($mul($get(r2),$get(l),$get(z),$get(pc)),500000000))) $puts(r4,$ifgreater($get(r3),0,$get(r3),1)) $ifgreater($get(pc),0,$num($get(r4),5),-----) ************************************************************************ That's it. Hope you enjoy the results! Any feedback, questions etc., please go to the DAR thread at Hydrogen Audio: http://www.hydrogenaudio.org/forums/index.php?showtopic=83954 [END]