Displaying user friendly date tags |
This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.
See also: Hydrogenaudio Terms of Service.
![]() ![]() |
Displaying user friendly date tags |
Jun 11 2012, 15:13
Post
#1
|
|
|
Group: Members Posts: 175 Joined: 22-March 07 Member No.: 41742 |
Hey guys, is there any title formatting that I can use to display the date in a more user friendly manner. For example:
Last played: today | yesterday | n days ago | n weeks ago | n months ago. instead of Last played: 06-10-2012, etc.. I have no idea on how to compare the date string in the %last_played% and compare it with system date strings. EDIT: Found the following thread http://www.hydrogenaudio.org/forums/index....showtopic=45282. Will test it out. This post has been edited by D.Sync: Jun 11 2012, 15:15 |
|
|
|
Jun 11 2012, 16:47
Post
#2
|
|
|
Group: Members Posts: 175 Joined: 22-March 07 Member No.: 41742 |
I have tried out the natural date script as posted in post #1, however it only works with columns playlist. Is there any way to get the global value from the Panel Splitter?
|
|
|
|
Jun 11 2012, 17:22
Post
#3
|
|
![]() Group: Members Posts: 881 Joined: 18-June 06 From: Germany Member No.: 31980 |
Try using foo_dynfil. It probably is the cleanest way of calculating date-dependent field values.
-------------------- http://freemusi.cc/
|
|
|
|
Jun 11 2012, 17:32
Post
#4
|
|
|
Group: Members Posts: 175 Joined: 22-March 07 Member No.: 41742 |
Try using foo_dynfil. It probably is the cleanest way of calculating date-dependent field values. Thanks but I have no idea on how to use it. Care to point me to some direction here? |
|
|
|
Jun 11 2012, 19:34
Post
#5
|
|
![]() Group: Members Posts: 881 Joined: 18-June 06 From: Germany Member No.: 31980 |
1. Install the component. Restart.
2. Go to Preferences > Media Library > Dynamic Fields. 3. Click on the green plus icon. Enter a fieldname. Example: "relative_last_played". 4. Enter any valid title formatting code into the text box. Note the help icon, which explains the additional date/time functionality. Example code (taken from your linked thread): CODE ///////////////////////////////////////// // RELATIVE TIMESTAMPS // formerly known as natural language timestamps // by topdownjimmy - v0.5.c - May 6, 2007 // modified for foo_dynfil by ojdo - June 11, 2012 ///////////////////////////////////////// // calculate days since last play $puts(dayssince,$date_diff(%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(%now%,12,13)),$greater($substr(%last_played%,12,13),6)),1,0))) $if($and($greater($substr(%now%,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,$day_of_week(%last_played%)) // 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(%now%,7),$left(%last_played%,7)))),$if($not($strcmp($left(%now%,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(%now%,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)) // and display $get(rel_timestamp) 5. Press apply. Addding/removing/renaming fields needs a restart. 6. Use the new field with %_relative_last_played% like a usual tag value. This post has been edited by ojdo: Jun 11 2012, 19:35 -------------------- http://freemusi.cc/
|
|
|
|
Jun 12 2012, 06:25
Post
#6
|
|
|
Group: Members Posts: 175 Joined: 22-March 07 Member No.: 41742 |
Thanks for the effort ojdo.
There seemed to be one improvement that could be made though. So far what I noticed is the year will only displayed if it is 1 year before now. E.g. If the track is last played on July 2011, it will displayed simply as July ; if it is last played on May 2011, then the exact string (with year appended) is displayed. Perhaps an additional check on whether the year is the current year is needed. If it is the current year, then omit the %year%, else just display it. Too bad I'm unsure on where to put that. |
|
|
|
Jun 12 2012, 07:57
Post
#7
|
|
|
Group: Members Posts: 175 Joined: 22-March 07 Member No.: 41742 |
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 19th June 2013 - 10:45 |