foo_DAR: Date Adjusted Ratings (or Digital Audio Ratings) Formula

CONTENTS:

1) TESTING WITH THE foo_DAR FORMULA TEST SHEET
2) SETUP INTRO
3) COMPONENTS SETUP
4) SETTING UP A FOO_DAR RATINGS COLUMN
5) RATINGS BENCHMARK USING CUSTOM INFO & FOO_DAR
6) RATINGS AUTOPLAYLIST




************************************

1) TESTING WITH THE foo_DAR FORMULA TEST SHEET

************************************

If you want to test the formula before going through the steps below, download the foo_DAR test sheet from: http://www.giantpygmy.net/stuff/foo_DAR/foo_DAR_formula_test_sheet.zip

Note: There are minor discrepencies in the output due to the way foobar2000 and MS Excel handle dates and rounding.




************************************

2) SETUP INTRO

************************************

Firstly, make sure the following components are in foobar2000's component directory.

Components required: 

foo_custominfo.dll (tested with foo_custominfo 0.1.2)
foo_cwb_hooks.dll (tested with cwbowron's title format hooks 1.2.6 [Jan  2 2008 - 15:50:05])
foo_playback_custom.dll (tested with Playback Statistics Custom 1.4.3)
foo_autoplaylist.dll (optional)
foo_ui_columns.dll (optional - but recommended -- has also been tested with 9.5.2 default ui)


Fields used in the ratings formula:

%length_seconds%
%play_counter%
%skip% (skip count)
%added% (this is the date the file was added to the library)
%last_played% (date last played)
%first_played% (date first played)
%cwb_systemdatetime% (time now)


If you use fields other than %skip% (for skipped statistics) and %added% (for date added to the library) then these will need to be replaced in the formula. 


The foo_DAR_full ratings formula is described step by step in "foo_dar_formula_description.rtf" which can be downloaded from: http://www.giantpygmy.net/stuff/foo_DAR/foo_DAR_formula_description.zip




************************************

3) COMPONENTS SETUP

************************************

Preferences, Tools:

Custom Info: 

Storage Method: "custominfo_sqlite_db" is recommended (the ratings are dynamic and constantly changing so tags are not a good way of storing this info)

Under Context Menu Commands 
if you haven't already got a %SKIP% field, select "NEW" and add the following: 

Display name:   eg. Custom Info/Skipped/Skip+1
Field name:  SKIP
Value: $add(%SKIP%,1)

You'll need a date-stamp (i.e. date added to library). 
If you haven't got one set up then you can use this: 

Display name:   eg. Custom Info/Date/Added (today)
Field name:  ADDED
Value: $if2(%ADDED%,%cwb_systemdatetime%)


CWB Hooks:

Perform action on skipped files: 
Select   "Custom Info/Skipped/Skip+1" (or whatever you've chosen to label the Custom Info display name) 


New File Tagger:

Make sure you've some way of date-stamping new additions to the library. If you've not then add the following: 

Make sure "process files added to the library" is ticked, then select 
"Custom Info/Date/Added (today)" from the drop down list (this will be there if you've followed the steps above). 


Playback Statistics Custom: 

Recommended: "Update when playback percentage is":  e.g. 67% or "Update when track is ended".
These are preferable as the rating formula already takes into account the song's duration. 
Selecting either of the other methods is likely to produce less than optimum results. 

Under "Playback Statistics Settings":
I'd recommend selecting: only foo_custominfo_db (but this won't affect the rating equation).




************************************

4) SETTING UP A FOO_DAR RATINGS COLUMN

************************************


Once all the above is in place do (a) or (b) depending on which UI you use.

a) for Columns UI:

Paste the formula below into a new column in Columns UI:
In preferences, go to: Display, Columns UI, Playlist View
Choose the Columns tab
Click "NEW" and name the column something like DAR (or whatever you want). Then under the display tab paste the following: 

$puts(ra,$mul($add(1000,$div($mul(%length_seconds%,$sub(%play_counter%,$div(%skip%,2))),100)),10))$puts(dd,$div($add($cwb_datediff(%added%,%last_played%),50),10))$puts(pp,$div($mul(%play_counter%,10000),$cwb_datediff(%added%,%cwb_systemdatetime%)))$puts(pd,$mul($get(dd),$get(pp)))$puts(pd2,$div($get(pd),100))$puts(pd3,$div($mul($cwb_datediff(%added%,%cwb_systemdatetime%),125),100))$puts(pd4,$div($get(pp),40))$puts(pd5,$div($mul($cwb_datediff(%added%,%first_played%),5),%play_counter%))$puts(pd6,$add($get(pd3),$get(pd5)))$puts(r1,$add($get(pd2),$get(ra)))$puts(r2,$add($get(pd4),$sub($get(r1),$get(pd6))))$puts(r3,$ifgreater($get(r2),0,$get(r2),1))$puts(r4,$ifgreater($cwb_datediff(%added%,%cwb_systemdatetime%),7,$get(r3),10000))$ifgreater(%play_counter%,0,$num($get(r4),5),-----)


b) for Default UI (0.9.5+):

Create a new custom column: 
In preferences, go to: Display, Default User Interface, Playlist View
Click on "Add New"
Enter DAR (or whatever) under Name, and then under "Pattern" paste the following: 

$puts(ra,$mul($add(1000,$div($mul(%length_seconds%,$sub(%play_counter%,$div(%skip%,2))),100)),10))$puts(dd,$div($add($cwb_datediff(%added%,%last_played%),50),10))$puts(pp,$div($mul(%play_counter%,10000),$cwb_datediff(%added%,%cwb_systemdatetime%)))$puts(pd,$mul($get(dd),$get(pp)))$puts(pd2,$div($get(pd),100))$puts(pd3,$div($mul($cwb_datediff(%added%,%cwb_systemdatetime%),125),100))$puts(pd4,$div($get(pp),40))$puts(pd5,$div($mul($cwb_datediff(%added%,%first_played%),5),%play_counter%))$puts(pd6,$add($get(pd3),$get(pd5)))$puts(r1,$add($get(pd2),$get(ra)))$puts(r2,$add($get(pd4),$sub($get(r1),$get(pd6))))$puts(r3,$ifgreater($get(r2),0,$get(r2),1))$puts(r4,$ifgreater($cwb_datediff(%added%,%cwb_systemdatetime%),7,$get(r3),10000))$ifgreater(%play_counter%,0,$num($get(r4),5),-----)

Then in the "playlist" view of foobar2000 right click on any of the existing column headers such as "Title" or "Artist" and select DAR (or whatever you've chosen to call it). Now the ratings should be visible.


NOTE: If all your ratings are 10000, don't worry, this simply means that your %added% date is less than 8 days old and if you are installing foo_DAR and the stats components and cwb_hooks afresh this is what you can expect. For more on this see: 
http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=62864&view=findpost&p=563182




************************************

5) RATINGS BENCHMARK USING CUSTOM INFO & FOO_DAR

************************************


If you want to set the rating (i.e have another column with a fixed rating) to act as a benchmark to see if tracks have become more or less popular over time. This can be done via the Custom Info plugin. Go to its preferences (as above) and add a new field. 

Select "NEW" and add the following: 

Display name:   eg. Custom Info/Rating/Set DAR
Field name:  DARSET
Value:   $puts(ra,$mul($add(1000,$div($mul(%length_seconds%,$sub(%play_counter%,$div(%skip%,2))),100)),10))
$puts(dd,$div($add($cwb_datediff(%added%,%last_played%),50),10))
$puts(pp,$div($mul(%play_counter%,10000),$cwb_datediff(%added%,%cwb_systemdatetime%)))
$puts(pd,$mul($get(dd),$get(pp)))
$puts(pd2,$div($get(pd),100))
$puts(pd3,$div($mul($cwb_datediff(%added%,%cwb_systemdatetime%),125),100))
$puts(pd4,$div($get(pp),40))
$puts(pd5,$div($mul($cwb_datediff(%added%,%first_played%),5),%play_counter%))
$puts(pd6,$add($get(pd3),$get(pd5)))
$puts(r1,$add($get(pd2),$get(ra)))
$puts(r2,$add($get(pd4),$sub($get(r1),$get(pd6))))
$puts(r3,$ifgreater($get(r2),0,$get(r2),1))
$puts(r4,$ifgreater($cwb_datediff(%added%,%cwb_systemdatetime%),7,$get(r3),10000))
$ifgreater(%play_counter%,0,$num($get(r4),5),-----)

Again you'll need to setup a column to show this and under display tab paste the following: 

%darset% (or whatever you've chosen to call it).




************************************

6) RATINGS AUTOPLAYLIST

************************************

To create an Auto Playlist ordered highest rating to lowest in descending order. 
Select "Library" from the menu, then choose "Auto Playlist".

Query: [example:  %play_counter% GREATER 0 OR %skip% GREATER 1 (or something like that)

Sort format: 

AUTOPLAYLIST RATING STRING:


Query:

%play_counter% GREATER 0 OR %skip% GREATER 1       (or something like that)

Sort format:  

$sub($puts(ra,$mul($add(1000,$div($mul(%length_seconds%,$sub(%play_counter%,$div(%skip%,2))),100)),10))$puts(dd,$div($add($cwb_datediff(%added%,%last_played%),50),10))$puts(pp,$div($mul(%play_counter%,10000),$cwb_datediff(%added%,%cwb_systemdatetime%)))$puts(pd,$mul($get(dd),$get(pp)))$puts(pd2,$div($get(pd),100))$puts(pd3,$div($mul($cwb_datediff(%added%,%cwb_systemdatetime%),125),100))$puts(pd4,$div($get(pp),40))$puts(pd5,$div($mul($cwb_datediff(%added%,%first_played%),5),%play_counter%))$puts(pd6,$add($get(pd3),$get(pd5)))$puts(r1,$add($get(pd2),$get(ra)))$puts(r2,$add($get(pd4),$sub($get(r1),$get(pd6))))$puts(r3,$ifgreater($get(r2),0,$get(r2),1))$ifgreater($cwb_datediff(%added%,%cw b_systemdatetime%),7,$num($get(r3),5),10000),100000000)




************************************

END

************************************
