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: "hotness" (Read 201508 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

"hotness"

Reply #375
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

Code: [Select]
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: [Select]
// 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:


"hotness"

Reply #376
How do you get final hotness values to be from 0 to 100? It's bizzare longish figures in my case...

"hotness"

Reply #377
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.

"hotness"

Reply #378
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

"hotness"

Reply #379
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