IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

16 Pages V  « < 14 15 16  
Reply to this topicStart new topic
"hotness", An experiment in "meta-rating"
Anomaly
post Jan 30 2010, 23:52
Post #376





Group: Members
Posts: 8
Joined: 24-August 09
From: Blackpool
Member No.: 72622



Hi all, ive managed to find a way to implement this into elplaylist using wsh panel.
It uses the same method falstaff/br3tt uses in most of his configs, in fact, he uses an auto rating system himself, dont think its quite like this one however.

The problem lies in not being able to get the current date. To get around this i have wsh panel store the date in a files name, and then read the name using the $findfile function integrated in elplaylist (and panel stack)

The code for WSH panel can be added to an existing panel or make another just for this.
Btw, if your not to sure on titleformatting or JScript this might be a little hard to follow so ill try and explain the best i can smile.gif

CODE

function set_current_date(){
var d;
var s,s1,s2,s3;
var opt_read;
d = new Date();
s1 = d.getFullYear();
s2 = (d.getMonth() + 1);
if(s2.length==1) s2 += "0"+s2;
s3 = d.getDate();
if(s3.length==1) s3 += "0"+s3;
s = s1*10000+s2*100+s3;
opt_read = read_option("current_date", s);
update_option("current_date", s);
}

function update_option(optname, optvalue) {

var fso, f1, ts, s;
var ForReading = 1;
var ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");

// Read the contents of the txt file
ts = fso.OpenTextFile(settings_dir + optname + ".txt", ForReading);
s = ts.ReadLine();
ts.Close();
// renaming the empty file used after in the PSS with the new value
f1 = fso.MoveFile(settings_dir + optname + "_" + s, settings_dir + optname + "_" + optvalue);
// updating the txt file with the new value
ts = fso.OpenTextFile(settings_dir + optname + ".txt", ForWriting);
ts.WriteLine(optvalue);
ts.Close();
}


This var also needs to be set at the top above all other code and outside of any brackets.

var settings_dir = fb.ProfilePath+"settings\\";


You then need to navigate to your foobar2000 folder and create a folder called settings. Mine is located at:
C:\Program Files (x86)\foobar2000
So i created a settings folder so now its:
C:\Program Files (x86)\foobar2000\settings

This is where WSH panel will store the date and where elplaylist will retrieve it.

Then bring up elplaylist settings, click on tracklisting and add
CODE

// HOTNESS //
$puts(date, $right($findfile('C:\Program Files (x86)\foobar2000\settings\current_date_*'),8))
$puts(year, $left($get(date), 5))
$puts(month, $right($left($get(date),7),2))
$puts(day, $right($get(date),2))

$puts(baselinefrequency,90) // decrease if songs stay hot too long, or: high to accentuate success, low to accentuate recentness
$puts(baselinedecay,28) // decrease if too many songs are hot, or: high to accentuate success, low to accentuate recentness
// configure playback statistics
$puts(lp,[%last_played%])
$puts(fp,[%first_played%])
$puts(pc,[%play_count%])
$puts(rating,[%rating%])
$puts(avgrating,3)

$puts(lp_mod,$sub($add($add($mul($year(%last_played%),365),$mul($month(%last_played%),30)),$day_of_month(%last_played%)),730000))
$puts(fp_mod,$sub($add($add($mul($year(%first_played%),365),$mul($month(%first_played%),30)),$day_of_month(%first_played%)),730000))
$puts(date_diff,$sub($add($add($mul($get(year),365),$mul($get(month),30)),$get(day)),730000))

$puts(baselinefrequency,$mul($get(baselinefrequency),24))
$puts(baselinedecay,$mul($get(baselinedecay),24))
$puts(lp_age,$add($substr($get(lp),12,13),$mul(24,$get(lp_mod))))
$puts(fp_age,$add($substr($get(fp),12,13),$mul(24,$get(fp_mod))))
$puts(age,$sub($get(lp_age),$get(fp_age)))
$puts(now_age,$add(1,$mul(24,$get(date_diff))))
$puts(recentness,$sub($get(now_age),$get(lp_age)))
$puts(decay,$div($div($mul($get(pc),$get(baselinefrequency),$get(baselinedecay),$if2($get(rating),$get(avgrating)),100),$mul($max($get(age),$get(baselinefrequency)),$get(avgrating))),100))
$puts(rawhotness,$div($mul($max($sub($get(decay),$get(recentness)),0),100),$get(decay)))
$puts(forecast,$div($mul($max($sub($get(decay),$add($div($max(0,$sub($get(baselinedecay),$get(recentness))),2),$get(recentness))),0),100),$get(decay)))
$puts(hotness,$div($add($get(rawhotness),$get(forecast)),2))

$drawtextex($get(hotness), 925, 3, 60, %el_height%, 180-180-180, hcenter )
// END HOTNESS //

In this code you need to change the 2nd line "$puts(date, $right($findfile('C:\Program Files (x86)\foobar2000\settings\current_date_*'),8))" to your directory, for example if your running 32-bit windows this will more likely be: "C:\Program Files\foobar2000\settings\current_date_*" Note the missing "(x86)".
Obv also change the $drawtextex as needed.

And if all works, you should get something like this:

Go to the top of the page
+Quote Post
elenhil
post Jan 31 2010, 11:39
Post #377





Group: Members
Posts: 193
Joined: 7-September 05
Member No.: 24374



How do you get final hotness values to be from 0 to 100? It's bizzare longish figures in my case...
Go to the top of the page
+Quote Post
Anomaly
post Jan 31 2010, 16:54
Post #378





Group: Members
Posts: 8
Joined: 24-August 09
From: Blackpool
Member No.: 72622



QUOTE (elenhil @ Jan 31 2010, 10:39) *
How do you get final hotness values to be from 0 to 100? It's bizzare longish figures in my case...

I was having that problem when it wasnt retrieving the date. Maybe somethings going wrong there? If all works out you dont have to add anything to make it between 0-100, the algorithm does that for you.
Go to the top of the page
+Quote Post
elenhil
post Jan 31 2010, 19:15
Post #379





Group: Members
Posts: 193
Joined: 7-September 05
Member No.: 24374



QUOTE (Anomaly @ Jan 31 2010, 18:54) *
QUOTE (elenhil @ Jan 31 2010, 10:39) *
How do you get final hotness values to be from 0 to 100? It's bizzare longish figures in my case...

I was having that problem when it wasnt retrieving the date. Maybe somethings going wrong there?

Quite possibly. No idea what precisely - I seem to have followed your instructions, at least so far as inserting the function and the variable bits into WSH
Go to the top of the page
+Quote Post
Anomaly
post Feb 2 2010, 10:45
Post #380





Group: Members
Posts: 8
Joined: 24-August 09
From: Blackpool
Member No.: 72622



If you want man, send me a pm with your code from the wsh panel, and the panel stack splitter and ill have a look for ya. Also make sure that you have got a "settings" folder created in your foobar folder. x
Go to the top of the page
+Quote Post

16 Pages V  « < 14 15 16
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd May 2013 - 13:01