foo_DAR: auto rating
Reply #145 – 2009-05-19 16:18:14
Hi Kitahei As you know both the official and unofficial playback statistics components store the following date related information: First Played Last Played Added And these values are PER TRACK. The problem for me is that they store that data as a DATE string i.e. a TIMESTAMP. I need a way to turn that TIMESTAMP into an integer value. Furthermore, I need that integer to be related to NOW. What I need is literally what cwb_hooks used to provide with:$cwb_datediff(%added%,%cwb_systemdatetime%) = %Days Since Added% $cwb_datediff(%added%,%first_played%) = %Days Since Added% minus %Days Since First Played% $cwb_datediff(%added%,%last_played%) = %Days Since Added% minus %Days Since Last Played% So, yes, these fields would be per track fields. The problem, as I'm sure you know was with %cwb_systemdatetime% . This was always changing. However, if the component used SYSTEM DAY THAT FOOBAR WAS LAUNCHED it would be a STATIC TIMESTAMP refreshed on fb2k initialisation. From that the component would calculate:%Days Since Added% (NOW TIMESTAMP minus ADDED TIMESTAMP) %Days Since First Played% (NOW TIMESTAMP minus FIRST PLAYED TIMESTAMP) %Days Since Last Played% (NOW TIMESTAMP minus LAST PLAYED TIMESTAMP) And, when do update the track information? I'm not sure I understand the question. In a sense these fields are reading data from track information that is currently provided by both official and unoffical play statistics components (just as %_length_seconds% reads from the TRACK). i.e. %Days Since Added% is simply a calculation based on the %added% timestamp and the (currently non-existent) NOW timestamp. So, since we have to make the NOW timestamp static the %Days Since Added% field is updated once per fb2k session (probably as some background process). I'm not sure if that answers your question, if not, let me know and I'll try again. C. EDIT: Kitahei -- perhaps the problem you are having is related to my clumsy use of the word FIELDS. Perhaps FUNCTION would be a better word. i.e. %Days Since Added% is a FUNCTION that produces an integer value based on existing FIELDS. Does that help?