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

From Hydrogenaudio Knowledgebase
No edit summary
(→‎Description: Added latest functions)
Line 1: Line 1:
'''foo_cwb_hooks''' adds various functions and variables to global title formatting.<br>
'''Download:''' [http://foobar.bowron.us/foo_cwb_hooks.zip foo_cwb_hooks.zip]
=Description=
=Description=
==Functions==
*$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
==Variables==
*%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
==Known Bugs==
*%cwb_playinglist% and %cwb_activelist% changes won't refresh in displays
==Feature Requests==


* Add variables for the following:
* Add variables for the following:
** Playing playlist's name
**length of active playlist and playing list
** Active playlist's name
**%_playbackorder%
** Queue index of track
**%_replaygain_mode% - not really possible
* Useful for cleaning up paths of streaming music.
**%_database% - gives back if a file belongs to database or not
* Example usage: $http_clean(%artist%) for artist column.
***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)


=Link=
=Link=

Revision as of 14:52, 24 August 2006

foo_cwb_hooks adds various functions and variables to global title formatting.
Download: foo_cwb_hooks.zip

Description

Functions

  • $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

Variables

  • %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

Known Bugs

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

Feature Requests

  • 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)

Link