Help - Search - Members - Calendar
Full Version: foo_cwb_hooks
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9
cwbowron
foo_cwb_hooks adds various functions and variables to global title formatting. It also adds a timestamp action to masstagger scripts, and the ability to run a script on files added to the media library (New File Tagger).

More information on my components page: http://www.bazquux.com/wiki/Foobar2000:Hooks
Silversight
The download works, but the archive is corrupted.
foosion
Is there a special reason why this function is not called "urldecode" like in other languages? Just wondering.
cwbowron
Archive has been fixed. I had forgotten to switch to binary mode when uploading it.

QUOTE(foosion @ Apr 13 2006, 02:26 PM) *

Is there a special reason why this function is not called "urldecode" like in other languages? Just wondering.


I was unaware that it was commonly called urldecode in other languages. I do not do much work in applications that require decoding url's. Based on that feedback, I will make it recognize either function.
mazy
cwbowron, could you, please add other functions to your hook plugin?

- playing playlist's name
- active playlist's name
- queue index of track
year98
I would like to request

-current playback order
cwbowron
I added a couple more things today to foo_cwb_hooks:

QUOTE
Release 1.0.2

* added $removethe() function which removes "The " and "A " at the beginning of a string. Good for removing articles in the names of bands.
* added %systemdate% [yyyy-mm-dd] and %systemdatetime% [yyyy-mm-dd hh:mm:ss]
mazy
thank you for this update, cwbowron. what are you thoughts on the other requests?
Squeller
QUOTE(cwbowron @ Aug 11 2006, 11:23) *
* added $removethe() function which removes "The " and "A " at the beginning of a string. Good for removing articles in the names of bands.

Erm, narrow. What if band names begin with "der, die, das, la, le, les, het, ein, eine, ...etc..."?

What we rather need is a $ltrim, $rtrim in foobars language. Well, that would be really helpful.

$ltrim('The doors','The') = ' doors'
mazy
Squeller, i'm all for new functions in tagz for some tasks that take quite some formatting to do in current version, but i still think that it's not bad idea to have such specialized function like $removethe() available - there could be some failsafe logic implemented ...
saivert
You could make a component that enables the use of LUA in order to expand the possibilities of the title formatting language. like foo_lua_formatting.
vlada
I'd like to vote for queue index. Please see also this thread.
cwbowron
After looking into some of the SDK documentation, I don't know that its possible to safely add functions for activeplaylist, playing playlist or whether an item is in the database. Queue index looks possible, but it might not be that useful depending on what you want to use the queue index for. (if you want to display it in the playlist view, it might not be very useful because the item will not get redrawn if the queue index changes)
vlada
That's sad, that it is not possible to automatically redraw the queue indexes. Then it really won't help in what I planed to do. At least we have a queue viewer.

If somebody got an idea on how to workaround this problem I'd really appreciate it.
Chronial
I don't know if this is possible, but: just redraw all playlist entries of songs that are in the queue?
cwbowron
QUOTE(Chronial @ Aug 17 2006, 11:17) *

I don't know if this is possible, but: just redraw all playlist entries of songs that are in the queue?


I dont know that there is a way for me to tell the playlist to redraw the items.

EDIT: I may have found a way to do this using metadb::dispatch_refresh
cwbowron
I just put up 1.0.3 on my web site, which adds %queueindex%, %playinglist% and %activelist%.

Playlist *will* get updated when the queue index changes. The queue, the playing list and the active list are all cached via callbacks so that during handle formatting, no SDK functions should be called.
roentgen
QUOTE(cwbowron @ Aug 17 2006, 20:07) *

I just put up 1.0.3 on my web site, which adds %queueindex%, %playinglist% and %activelist%.

Playlist *will* get updated when the queue index changes. The queue, the playing list and the active list are all cached via callbacks so that during handle formatting, no SDK functions should be called.

Finally .... great work.

Still... when there are some items in queue, and manually double click an item in the playlist the queue gets erased (why???), but %queueindex% doesn't get updated (reloading info from files seems to solve the display)
Chronial
Great work there smile.gif

I have some more suggestions concerning the queue:
foobar stores the playlist of the queued file - could you make this accessible to tagz, so we can check it against %playlist_name% to see if it is really _this_ playlist entry that is enqueued? (I don't think the default %queueindex% should do this - this would keep interesting information away from us ("Is _this file_ enqueued?").

Another problem is the fact that the same file may be enqueued multiple times. It might be usefull to have a comma-seperated list of all indexes that this file is enqueued as (so we have %queueindex% and %queueindexes%).
cwbowron
QUOTE(roentgen @ Aug 17 2006, 14:16) *

QUOTE(cwbowron @ Aug 17 2006, 20:07) *

I just put up 1.0.3 on my web site, which adds %queueindex%, %playinglist% and %activelist%.

Playlist *will* get updated when the queue index changes. The queue, the playing list and the active list are all cached via callbacks so that during handle formatting, no SDK functions should be called.

Finally .... great work.

Still... when there are some items in queue, and manually double click an item in the playlist the queue gets erased (why???), but %queueindex% doesn't get updated (reloading info from files seems to solve the display)


The manual double click thing is out side my control.

I think I know the issue with the not refreshing is, and I will fix it.

EDIT: I did fix it, 1.0.3b has been uploaded to my web site. Get it while it's hot.
q-stankovic
Great thing and thanks, Chris!

I tested %queueindex" and everything worked as it should do! Just like to repeat Chronials request for a comma seperated list of all indexes. But i don't think that an second variable %queueindexes% is necessary


QUOTE(roentgen @ Aug 17 2006, 19:16) *

Still... when there are some items in queue, and manually double click an item in the playlist the queue gets erased (why???)


Why? Ask Peter! biggrin.gif
If i would give an answer i would say: What else should happen?


mazy
just wanted to thank you, cwbowron ... this queue stuff is what many guys here, including me, wanted. %queuesize% would be nice to have (though i realize that with one track queued more than once it wouldn't be enough to find whether given queued track is last in the queue or not).
Chronial
I added some stuff and sent it to cwbowron - hope he likes it ^^.
My current format string (inserted before the tracklength):
$if(%queueindex%,'['%queueindexes%/%queuelength%']')
(With some additional colorcodes)

This gives results like:
[2/5]
[3,4/5]

looks great and gives a perfect overview of the queue.

PS:
QUOTE
If i would give an answer i would say: What else should happen?

The same as in winamp: keep the queue untouched.
vlada
Thanks a lot cwbowron, it works great. The queue indexes was the last feature of Winamp I've been missing in fb2k. But I agree with Chronial, that the queue shouldn't be touched if I double click a file. Is anywhere an official foobar2000 feature request thread, where I could post this?
q-stankovic
QUOTE(vlada @ Aug 18 2006, 00:05) *

But I agree with Chronial, that the queue shouldn't be touched if I double click a file. Is anywhere an official foobar2000 feature request thread, where I could post this?


Post just a new topic under "General". But i don't understand your problem: Why should you define a queue and then start playback by doubleclicking?
cwbowron
I incorporated the changes sent to my by Chronial and released version 1.0.4. In addition to those changes, I renamed all the functions and variables provided by foo_cwb_hooks with a 'cwb_' prefix for potentially faster comparisons and so that i will not have to worry if other devs want to write hooking plugins.

Complete info is available at the website: http://wiki.bowron.us/index.php/Foobar2000#foo_cwb_hooks
bfly
QUOTE(Chronial @ Aug 18 2006, 00:15) *

I added some stuff and sent it to cwbowron - hope he likes it ^^.
My current format string (inserted before the tracklength):
$if(%queueindex%,'['%queueindexes%/%queuelength%']')
(With some additional colorcodes)

This gives results like:
[2/5]
[3,4/5]


I don't get it. Tried putting your line in a new column, tried putting in in front of the length-column, nothing happened, althougs there are songs in the queue.

Can you explain? TIA!
cwbowron
QUOTE(bfly @ Aug 18 2006, 16:46) *

I don't get it. Tried putting your line in a new column, tried putting in in front of the length-column, nothing happened, althougs there are songs in the queue.

Can you explain? TIA!


In the release version I added cwb_ prefixes to all the variables, so that this plugin wont step on any other potential plugins toes and for potentially faster comparisons.

Try:

CODE
$if(%cwb_queueindex%,'['%cwb_queueindexes%/%cwb_queuelength%']')
bfly
Thanks Christopher, that worked. Great plugin, thanks a lot!
year98
Can playback order variable be possible? I think that will be a great feature...^^
vlada
QUOTE(q-stankovic @ Aug 18 2006, 14:29) *

QUOTE(vlada @ Aug 18 2006, 00:05) *

But I agree with Chronial, that the queue shouldn't be touched if I double click a file. Is anywhere an official foobar2000 feature request thread, where I could post this?


Post just a new topic under "General". But i don't understand your problem: Why should you define a queue and then start playback by doubleclicking?


Sometimes I put some songs in a queue which I want to hear. Then I decide, that right now I want to listen do a certain song, so I double click it. But I'd like my queue to continue then.

It is also useful when more people are operating with the player (at a party). You don't want anybody else to delete so simply your queue.

Btw. Is it possible to delete a file from a queue?
thuan
QUOTE
Btw. Is it possible to delete a file from a queue?
No or not yet.
cwbowron
QUOTE(vlada @ Aug 19 2006, 05:31) *

Sometimes I put some songs in a queue which I want to hear. Then I decide, that right now I want to listen do a certain song, so I double click it. But I'd like my queue to continue then.

It is also useful when more people are operating with the player (at a party). You don't want anybody else to delete so simply your queue.

Btw. Is it possible to delete a file from a queue?


Discussion of how the queue operates and suggestions as to how it should work are well outside the scope of this plugin.

vlada
QUOTE(cwbowron @ Aug 19 2006, 16:17) *

Discussion of how the queue operates and suggestions as to how it should work are well outside the scope of this plugin.


Sure, I'm sorry. Let's continue here.
q-stankovic
Some ideas for new variables and functions:

1. %cwb_replaygain_mode%

2. %cwb_hotness% (look here: http://www.hydrogenaudio.org/forums/index....showtopic=31287 , with permission of topdownjimmy)

3. $group()

Examples for the group-function:

$group(%date%,5) creates:

1980 - 1985
1985 - 1990
1990 - 1995
...

$group($cut(%album%,1),3) creates:

A - C
D - F
G - I
...

What do you think?
Chronial
%cwb_replaygain_mode% is not a good idea - if you really want access to the player settings this has to be done with a more general approach - like $cwv_setting(replaygain_mode) - otherwise you will create far to many fields.

About this group function:
so it just simply round down the given value and generate something like
"*roundedvalue* - *roundedvalue*+*step*"
and the same for letters?
thuan
%cwb_replaygain_mode% is for displaying what mode you're using not set it as I see. And I don't think changing player settings with tagz string is a good idea although it seems to be convenient.
cwbowron
QUOTE(thuan @ Aug 20 2006, 20:10) *

%cwb_replaygain_mode% is for displaying what mode you're using not set it as I see. And I don't think changing player settings with tagz string is a good idea although it seems to be convenient.


I dont think anyone was suggesting that we have tagz variables set player settings. I believe the request was to display the replaygain mode, not to be able to change.

And I am not sure that its even possible. Title formatting hooks cannot access SDK functions because they might be called from the main thread. The other functions work by caching the information and they can do this because there are callbacks availble that let know when the playlists change or the playing song changes. I don't know if there are any callbacks that inform plugins when replaygain mode changes.
thuan
If it's so then maybe it should be call $cwb_info(a) with a is replaygain_mode or sth like that. I misinterpret the $cwv_setting(replaygain_mode) part.
Squeller
You have introduced two variables for displaying playlist names. I'd really appreciate variables for both, which indicate the playlists length and the current index position. I personally would like to have a $progress bar with those data in my trackinfo panel...
foosion
QUOTE(cwbowron @ Aug 21 2006, 02:52) *
I don't know if there are any callbacks that inform plugins when replaygain mode changes.
I'm afraid there aren't any, though I already asked Peter about adding that some time ago, since it would be highly useful for things like a ReplayGain toolbar as well.
q-stankovic
QUOTE(Chronial @ Aug 17 2006, 19:21) *


I have some more suggestions concerning the queue:
foobar stores the playlist of the queued file - could you make this accessible to tagz, so we can check it against %playlist_name% to see if it is really _this_ playlist entry that is enqueued? (I don't think the default %queueindex% should do this - this would keep interesting information away from us ("Is _this file_ enqueued?").



Now i know what you mean, Chronial! Can repeat the request and also the demand that %queueindex% shouldn't do it. Great would be a variable like %cwb_entry_inqueue% that is true if the entry is enqueued and false if just the file is enqueued.

Have a nice day, you all! smile.gif
Chronial
unfortunately there is no way to access the name of the playlist the file is in from within the titleformating hook.

%cwb_entry_inqueue% would also be quite problemtic since this doesn't deliver good results if the same file is enqueued multipe times.

So I thought about the problem and in my opinion the only use of such a variable would be to have the answer to one question: "on which playlist will the queue end?" - so I created a field that will hold just this information(%cwb_queue_end_playlist%). You'll have access to it, once cwbrown adds it to his release (if he decides to do so)
rendom
Any ways to get info from specific file from playlist?
cwbowron
Release 1.0.5

* $cwb_datediff(d1,d2) - number of days between two dates in the format yyyy-mm-dd or yyyy-mm-dd hh:mm:ss
* added %cwb_queue_end_playlist% (Chronial)
* fixed $cwb_ltrim to not automatically add a space to the paramaters
Squeller
QUOTE(Chronial @ Aug 21 2006, 10:05) *
So I thought about the problem and in my opinion the only use of such a variable would be to have the answer to one question: "on which playlist will the queue end?" - so I created a field that will hold just this information(%cwb_queue_end_playlist%). You'll have access to it, once cwbrown adds it to his release (if he decides to do so)
I don't understand. So this is useful only in case I add files to playback queue? Now it returns "?" to my trackinfo panel (also to columns global variables)
Chronial
%cwb_queue_end_playlist% returns the playlist the last song of the queue belongs to. If there is not queue, or the llast song hast no playlist, it will return nothing ("?");
q-stankovic
QUOTE(Chronial @ Aug 22 2006, 17:27) *

%cwb_queue_end_playlist% returns the playlist the last song of the queue belongs to. If there is not queue, or the llast song hast no playlist, it will return nothing ("?");


I understand how it works but i can't see what i should use it for. unsure.gif
Chronial
CODE
$if(%cwb_queueindex%,'['$if($strcmp(%cwb_queue_end_playlist%,%playlist_name%),'->'
%cwb_queueindexes%/%cwb_queuelength%']')

I'm not sure if I used $strcmp correctly. But this should be done with color codes, after all.
Russell777
Is it possible to get system time even when no track is playing?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.