Foobar2000:0.9 CwBowron's Title formating (foo cwb hooks)

From Hydrogenaudio Knowledgebase
Jump to: navigation, search

foo_cwb_hooks adds various functions and variables to global title formatting. The author's component page may contain more up-to-date information on the plugin.




  • $cwb_urldecode / $cwb_httpclean - decodes characters in URLs
  • $cwb_removethe - removes The and A at the beginning of a string
  • $cwb_ltrim - example: $cwb_ltrim(%artist%,The) $cwb_ltrim(%artist%,The ,A ,La )
  • $cwb_datediff(d1,d2) - number of days between two dates in the format yyyy-mm-dd or yyyy-mm-dd hh:mm:ss


Tagz updated September 11th 2006

  • %cwb_systemdate% - date in the formay yyyy-mm-dd
  • %cwb_systemdatetime% - date and time in the format yyyy-mm-dd hh:mm:ss
  • %cwb_activelist% - active playlist name
  • %cwb_activelist_count% - number of items in the active list
  • %cwb_playinglist% - playing playlist name
  • %cwb_playinglist_count% - number of items in the playing list
  • %cwb_queueindex% - queueindex if in the queue, false otherwise
  • %cwb_queueindexes% - indices of the item in the queue, false otherwise
  • %cwb_queuelength% - length of the queue
  • %cwb_queue_end_playlist% - playlist of the last item in the queue
  • %cwb_next_title% - title of the next song in the playlist of the playing item or the next item in the queue
  • %cwb_next_artist% - artist of the next song in the playlist of the playing item or the next item in queue
  • %cwb_playback_order% - e.g. Default, random, etc.

Known Bugs

  • %cwb_playinglist% and %cwb_activelist% changes won't refresh in displays

Feature Requests

NOTE: These are NOT implemented.

  • Add variables for the following:
    • length of active playlist and playing list
    • %_playbackorder%
    • %_replaygain_mode% - not really possible
    • %_database% - gives back if a file belongs to database or not
      • not easily possibe because you cannot use SDK functions in the title formatting callback
      • only way I could see to do it is to cache the library and test against that
    • %_added% - timestamp when a file was added to database
      • not really possible - timestamp is not stored when added when added to library
      • could be possible with a plugin that stores the date added to the library
      • library_callback implementing on_items_added() to store timestamps

Useful Strings

'Played Today', 'Played Yesterday', 'Played n days ago' or 'No last played info'

$if(%last_played%, $puts(diff,$cwb_datediff(%last_played%,%cwb_systemdate%)) Played $ifgreater(1,$get(diff),Today, $ifgreater(2,$get(diff),Yesterday, $get(diff) days ago)), No last played info)