Help - Search - Members - Calendar
Full Version: foo_playback_custom/Panels UI: how to show statistics with updated rel
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
M0stblunt3d

I'm currently using the old version of timestamps made by topdownjimmy but i want to upgrade
My foobar version is 0.9.4.5
CWB hooks is 1.2.6



QUOTE
// NATURAL LANGUAGE TIMESTAMPS
// by topdownjimmy
// v0.3.c - Dec 4, 2006
//----------------------------------------
$puts(year,$left(%cwb_systemdate%,4))
$puts(month,$substr(%cwb_systemdate%,6,7))
$puts(day,$substr(%cwb_systemdate%,9,10))
$puts(dayssince,$cwb_datediff(%cwb_systemdate%,%last_played%))
// correct "dayssince" to consider early AM to be an extension of previous day
$puts(dayssince,$sub($get(dayssince),$if($and($greater(7,%_system_hour%),$greater($substr(%last_played%,12,13),6)),1,0)))
$if($and($greater(%_system_hour%,6),$greater(7,$substr(%last_played%,12,13))),$puts(dayssince,$add($get(dayssince),1)),)
// calculate day of week
$puts(calcdayofweek,$add(1,$mod($add($substr(%last_played%,3,4),$div($substr(%last_played%,3,4),4),$select($substr(%last_played%,6,7),6,2,2,5,0,3,5,1,4,6,2,4),$substr(%last_played%,9,10)),7)))
// correct day of week to consider early AM to be an extension of previous day
$puts(calcdayofweek,$sub($get(calcdayofweek),$ifgreater(7,$substr(%last_played%,12,13),1,0)))
$if($strcmp($get(calcdayofweek),0),$puts(calcdayofweek,7),)
// calculate period of day (night, morning, etc.)
$puts(dayperiod,$select($add(1,$substr(%last_played% ,12,13)),Night,Night,Night,Night,Night,Night,Night,Morning,Morning,Morning,Morning,Morning,Afternoon

,Afternoon,Afternoon,Afternoon,Afternoon,Evening,Evening,Evening,Evening,Night,Night,Night))
// calculate natural language timestamp
$if(%last_played%,$put(nat_lang_stamp,$ifgreater($get(dayssince),0,$ifgreater($get(dayssince),1,$ifgreater($get(dayssince),6,$if($and($greater($get(dayssince),21),$not($strcmp(%_system_month%,$substr(%last_played%,6,7)))),$if($not($strcmp(%_system_year%,$substr(%last_played%,1,4))),$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December)' '$substr(%last_played%,1,4),$ifgreater(2,$sub(%_system_month%,$substr(%last_played%,6,7)),'Last Month',$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December))),$ifgreater($div($add($get(dayssince),4),7),1,$div($add($get(dayssince),4),7)' Weeks Ago',Last Week)),$select($get(calcdayofweek),Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Last,Yesterday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Tonight,This $get(dayperiod)))),$put(nat_lang_stamp,Never))
//--------END TIMESTAMP------------





when i use this it works fine, but i'm trying to use the updated version, but I get an error saying unknown function

this is the updated version

QUOTE
/////////////////////////////////////////
// RELATIVE TIMESTAMPS
// formerly known as natural language timestamps
// by topdownjimmy - v0.5.c - May 6, 2007
/////////////////////////////////////////

// calculate days since last play
$puts(dayssince,$cwb_datediff(%cwb_systemdate%,%last_played%))

// correct "dayssince" to consider early AM to be an extension of previous day
$puts(dayssince,$sub($get(dayssince),$if($and($greater(7,$substr(%cwb_systemdatetime%,12,13)),$greater($substr(%last_played%,12,13),6)),1,0)))
$if($and($greater($substr(%cwb_systemdatetime%,12,13),6),$greater(7,$substr(%last_played%,12,13))),$puts(dayssince,$add($get(dayssince),1)),)

// calculate day of week of last play
$puts(calcdayofweek,$add(1,$mod($add($substr(%last_played%,3,4),$div($substr(%last_played%,3,4),4),$select($substr(%last_played%,6,7),6,2,2,5,0,3,5,1,4,6,2,4),$substr(%last_played%,9,10)),7)))

// correct day of week to consider early AM to be an extension of previous day
$puts(calcdayofweek,$sub($get(calcdayofweek),$ifgreater(7,$substr(%last_played%,12,13),1,0)))
$if($strcmp($get(calcdayofweek),0),$puts(calcdayofweek,7),)

// calculate period of day of last play (night, morning, etc.)
$puts(dayperiod,$select($add(1,$substr(%last_played% ,12,13)),Night,Night,Night,Night,Night,Night,Night,Morning,Morning,Morning,Morning,Morning,Afternoon

,Afternoon,Afternoon,Afternoon,Afternoon,Evening,Evening,Evening,Evening,Night,Night,Night))

// calculate natural language timestamp
$if(%last_played%,$puts(rel_timestamp,$ifgreater($get(dayssince),0,$ifgreater($get(dayssince),1,$ifgreater($get(dayssince),6,$if($and($greater($get(dayssince),21),$not($strcmp($left(%cwb_systemdate%,7),$left(%last_played%,7)))),$if($not($strcmp($left(%cwb_systemdate%,4),$substr(%last_played%,1,4))),$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December)' '$ifgreater($get(dayssince),334,$substr(%last_played%,1,4),),$ifgreater(2,$sub($substr(%cwb_systemdate%,6,7),$substr(%last_played%,6,7)),'Last Month',$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December))),$ifgreater($div($add($get(dayssince),4),7),1,$div($add($get(dayssince),4),7)' Weeks Ago',Last Week)),$select($get(calcdayofweek),Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Last,Yesterday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Tonight,This $get(dayperiod)))),$puts(rel_timestamp,Never))

$set_global(rel_timestamp,$get(rel_timestamp))

/////////////////////////////////////////



Let me know you before and after screens

OLD VERSION
IPB Image


NEW VERSION

IPB Image
M0stblunt3d
anyone?
antar3s
QUOTE(M0stblunt3d @ Mar 13 2008, 05:28) *

anyone?

panels_ui doesn't know the $set_global function, thats what causes the unknown function error. to make it work with panels_ui remove the $set_global line and change the code:
$puts stores the value in a variable
CODE
$if(%last_played%,$puts(rel_timestamp,...),$puts(rel_timestamp,Never))

$put prints the value
CODE
$if(%last_played%,$put(nat_lang_stamp,...),$put(nat_lang_stamp,Never))

changing $puts to $put will work, or if you want you can also get rid of the redundant code and use
CODE
$if(%last_played%,...,Never)
M0stblunt3d
QUOTE
/////////////////////////////////////////
// RELATIVE TIMESTAMPS
// formerly known as natural language timestamps
// by topdownjimmy - v0.5.c - May 6, 2007
/////////////////////////////////////////

// calculate days since last play
$puts(dayssince,$cwb_datediff(%cwb_systemdate%,%last_played%))

// correct "dayssince" to consider early AM to be an extension of previous day
$puts(dayssince,$sub($get(dayssince),$if($and($greater(7,$substr(%cwb_systemdatetime%,12,13)),$greater($substr(%last_played%,12,13),6)),1,0)))
$if($and($greater($substr(%cwb_systemdatetime%,12,13),6),$greater(7,$substr(%last_played%,12,13))),$puts(dayssince,$add($get(dayssince),1)),)

// calculate day of week of last play
$puts(calcdayofweek,$add(1,$mod($add($substr(%last_played%,3,4),$div($substr(%last_played%,3,4),4),$select($substr(%last_played%,6,7),6,2,2,5,0,3,5,1,4,6,2,4),$substr(%last_played%,9,10)),7)))

// correct day of week to consider early AM to be an extension of previous day
$puts(calcdayofweek,$sub($get(calcdayofweek),$ifgreater(7,$substr(%last_played%,12,13),1,0)))
$if($strcmp($get(calcdayofweek),0),$puts(calcdayofweek,7),)

// calculate period of day of last play (night, morning, etc.)
$puts(dayperiod,$select($add(1,$substr(%last_played% ,12,13)),Night,Night,Night,Night,Night,Night,Night,Morning,Morning,Morning,Morning,Morning,Afternoon


,Afternoon,Afternoon,Afternoon,Afternoon,Evening,Evening,Evening,Evening,Night,Night,Night))

// calculate natural language timestamp
$if(%last_played%,$puts(rel_timestamp,$ifgreater($get(dayssince),0,$ifgreater($get(dayssince),1,$ifgreater($get(dayssince),6,$if($and($greater($get(dayssince),21),$not($strcmp($left(%cwb_systemdate%,7),$left(%last_played%,7)))),$if($not($strcmp($left(%cwb_systemdate%,4),$substr(%last_played%,1,4))),$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December)' '$ifgreater($get(dayssince),334,$substr(%last_played%,1,4),),$ifgreater(2,$sub($substr(%cwb_systemdate%,6,7),$substr(%last_played%,6,7)),'Last Month',$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December))),$ifgreater($div($add($get(dayssince),4),7),1,$div($add($get(dayssince),4),7)' Weeks Ago',Last Week)),$select($get(calcdayofweek),Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Last,Yesterday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Tonight,This $get(dayperiod)))),$puts(rel_timestamp,Never))

$if(%last_played%,$puts(rel_timestamp,...),$puts(rel_timestamp,Never))

$if(%last_played%,$put(nat_lang_stamp,...),$put(nat_lang_stamp,Never))


/////////////////////////////////////////



this is what im making of what you said, but it doesnt work, im pretty sure i adjusted the code wrongly, can you adjust the code for me and paste it, instead of pasting indiviual lines? thanks..


play count works, but last played just shows a bunch of dots..
antar3s
QUOTE(M0stblunt3d @ Mar 16 2008, 16:18) *

this is what im making of what you said, but it doesnt work, im pretty sure i adjusted the code wrongly, can you adjust the code for me and paste it, instead of pasting indiviual lines? thanks..

play count works, but last played just shows a bunch of dots..

well, the ... represents a part of the code, i thought that is kinda obvious...
this should work
CODE
$if(%last_played%,$ifgreater($get(dayssince),0,$ifgreater($get(dayssince),1,$ifgreater($get(dayssince),6,$if($and($greater($get(dayssince),21),$not($strcmp($left(%cwb_systemdate%,7),$left(%last_played%,7)))),$if($not($strcmp($left(%cwb_systemdate%,4),$substr(%last_played%,1,4))),$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December)' '$ifgreater($get(dayssince),334,$substr(%last_played%,1,4),),$ifgreater(2,$sub($substr(%cwb_systemdate%,6,7),$substr(%last_played%,6,7)),'Last Month',$select($substr(%last_played%,6,7),January,February,March,April,May,June,July,August,September,October,November,December))),$ifgreater($div($add($get(dayssince),4),7),1,$div($add($get(dayssince),4),7)' Weeks Ago',Last Week)),$select($get(calcdayofweek),Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Last,Yesterday)' '$get(dayperiod)),$if($strcmp($get(dayperiod),Night),Tonight,This $get(dayperiod))),Never)
M0stblunt3d
cool.gif

It does work, thanks so much bro... ur GREAT!

Anything you need let me know..

I'm assuming this code is adjusted for leap years, yes?
cmdrpaddy
I'm having trouble with these timestamps. Some files work and some don't, files that haven't been played in a long time say they have never been played despite having playcounts greater than zero and last_played tags. It seems anything over around 20 days or so returns as having never been played.

I've cut down all the code to simply:

CODE

$puts(dayssince,$cwb_datediff(%cwb_systemdate%,%LAST_PLAYED%))
Last Played: $if(%LAST_PLAYED%,$get(dayssince),Never) days ago$char(10)
Played: $if(%PLAY_COUNTER%,%PLAY_COUNTER% times, Never)


this code produces the exact same problem as the full RELATIVE TIMESTAMPS code.

I have cwb_hooks 1.2.6 and play_count 2.0.

cmdrpaddy
IPB Image

The column showing 0 for Love and Mathematics is a days since played, as you can see Passport Radio is played only minutes after yet the column returns [UNKNOWN FUNCTION].

It seems like something gets updated in the file after it plays for a certain length of time. Its almost as if a different playback statistics component is installed except there isn't. I have files play_counter set to update only once 100% of the file plays but the days since played column get updated to 0 once around half the song gets played.
cmdrpaddy
Sorry for bumping but I have no idea what the problem is here. I've done some more investigating and it seems that every song played before february 24th this year can't display how long ago it was played. I used quicksearch with
CODE
%LAST_PLAYED% IS 2008-02-23*
and the results were zero, yet
CODE
%LAST_PLAYED% IS 2008-02-24*
returns results. I can also see that files that return 'Never Played' have been played since the playcounter isn't zero.

I'm very confused.
antar3s
QUOTE(cmdrpaddy date='Mar 19 2008, 17:46 @ Mar 19 2008, 17:46) *

Sorry for bumping but I have no idea what the problem is here. I've done some more investigating and it seems that every song played before february 24th this year can't display how long ago it was played. I used quicksearch with
CODE
%LAST_PLAYED% IS 2008-02-23*
and the results were zero, yet
CODE
%LAST_PLAYED% IS 2008-02-24*
returns results. I can also see that files that return 'Never Played' have been played since the playcounter isn't zero.

I'm very confused.

it seems to me that you are using the unofficial play_count component. therefore the last_played timestamps have a different format and can't work with topdownjimmy's code...
did you update your foobar recently or change the play_count component?
QUOTE
the playcounter isn't zero

which tag exactly isn't zero? play_count or play_counter??
cmdrpaddy
QUOTE(antar3s @ Mar 19 2008, 21:12) *

QUOTE(cmdrpaddy date='Mar 19 2008, 17:46 @ Mar 19 2008, 17:46) *

Sorry for bumping but I have no idea what the problem is here. I've done some more investigating and it seems that every song played before february 24th this year can't display how long ago it was played. I used quicksearch with
CODE
%LAST_PLAYED% IS 2008-02-23*
and the results were zero, yet
CODE
%LAST_PLAYED% IS 2008-02-24*
returns results. I can also see that files that return 'Never Played' have been played since the playcounter isn't zero.

I'm very confused.

it seems to me that you are using the unofficial play_count component. therefore the last_played timestamps have a different format and can't work with topdownjimmy's code...
did you update your foobar recently or change the play_count component?
QUOTE
the playcounter isn't zero

which tag exactly isn't zero? play_count or play_counter??


I'm less confused. biggrin.gif

I only just remembered that I did change my foobar install a while ago. I must have been using the unofficial component and then changed to the official one. The official component doesn't write tags, right?

Is there anyway to convert the unofficial last_played information to the official version?


M0stblunt3d
also, i have a comment, this new code doesnt display the year with the month

for example, the old code used to display "September 2007"

this just displays September..

Please tweak?????!!!! sad.gif
antar3s
QUOTE(cmdrpaddy @ Mar 20 2008, 02:38) *

Is there anyway to convert the unofficial last_played information to the official version?

Well, if you figure out how to calculate the timestamps you could just use a masstagger script.
I have no clue how the timestamps are calculated, but I guess by analyzing topdownjimmy's code it could be possible to figure it out, eg $select($substr(%last_played%,6,7),January,February,March,..) tells you that char 6 and 7 are related to the month...

QUOTE(M0stblunt3d @ Mar 22 2008, 02:22) *

also, i have a comment, this new code doesnt display the year with the month

for example, the old code used to display "September 2007"

this just displays September..

Please tweak?????!!!! sad.gif

I noticed this too, but this is only if it's less than 11months since the track was last played.
Replacing
CODE
$ifgreater($get(dayssince),334,$substr(%last_played%,1,4),)

by
CODE
$substr(%last_played%,1,4)
should bring back old behaviour
Maybe you want to take a look at the Titleformat Reference to be able to figure out such things by yourself one day...
M0stblunt3d
QUOTE(antar3s @ Mar 22 2008, 04:12) *

QUOTE(cmdrpaddy @ Mar 20 2008, 02:38) *

Is there anyway to convert the unofficial last_played information to the official version?

Well, if you figure out how to calculate the timestamps you could just use a masstagger script.
I have no clue how the timestamps are calculated, but I guess by analyzing topdownjimmy's code it could be possible to figure it out, eg $select($substr(%last_played%,6,7),January,February,March,..) tells you that char 6 and 7 are related to the month...

QUOTE(M0stblunt3d @ Mar 22 2008, 02:22) *

also, i have a comment, this new code doesnt display the year with the month

for example, the old code used to display "September 2007"

this just displays September..

Please tweak?????!!!! sad.gif

I noticed this too, but this is only if it's less than 11months since the track was last played.
Replacing
CODE
$ifgreater($get(dayssince),334,$substr(%last_played%,1,4),)

by
CODE
$substr(%last_played%,1,4)
should bring back old behaviour
Maybe you want to take a look at the Titleformat Reference to be able to figure out such things by yourself one day...



thanks bro, it worked! i'd def look @ that to try to figure stufff out.. thanks though! smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.