Foobar2000:Encouraged Tag Standards

From Hydrogenaudio Knowledgebase
Revision as of 19:52, 16 February 2005 by Topdownjimmy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LAST_PLAYED

Basics:

  • the tag-fieldname used for storing info when a song was played the last time is "LAST_PLAYED"
  • tag contains date and time in the following format at the beginning: "YYYY-MM-DD HH:MM:SS" (with 24hours-format)
  • additional info may be appended after the above info

Reasons for deciding on this format:

  • the APE-dateformat (derrived from ISO) is internationally neutral
  • sortable
  • easily readable and recognizable
  • format can be verified with TAGZ
  • can be included in formatting-strings without reformatting it (pro for amateur tagz-coders)
  • choosing a new fieldname avoids confusion with the existing ambigious play_date tag
  • tag-fieldname is easy to understand/recognize/remember and short enough to type in manually

Code snippets:

// verify tag-format (we check the pos. of the first dash and ":")
// using $len for verification is strongly unrecommended!
$if(
$and($strcmp($strstr(%last_played%,-),5),$strcmp($strstr(%last_played%,:),14))
,$puts(last_played_is_valid,1)
)
// disassemble the timestamp for later reformatting or calcuations
$puts(last_played_year,$substr(%last_played%,1,4))
$puts(last_played_month,$substr(%last_played%,6,7))
$puts(last_played_day,$substr(%last_played%,9,10))
$puts(last_played_hour,$substr(%last_played%,12,13))
$puts(last_played_min,$substr(%last_played%,15,16))
$puts(last_played_sec,$substr(%last_played%,18,19))
// display only the date of last_played (without reformatting)
$left(%last_played%,10)
// display only the time of last_played (without reformatting)
// the use of $right is strongly unrecommended!
$substr(%last_played%,12,19)