Skip to main content
Topic: Possible to register titleformatfunction ($something) with foo_ma (Read 4695 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Possible to register titleformatfunction ($something) with foo_ma

As the topic says, is it possible to register/assign/bind a dollar function (e.g. $grouptracks(a,b)) by using the foo_managedwrapper?
Also, a %function% would work just fine...

And dont tell me "thats not what titleformatting is for etc... Im the only one whos gonna use this component, so no worries 

btw, using VB.NET if it has any relevance
Foobar2000 @ Onkyo SE-90PCI @ Sennheiser HD595 :)

Possible to register titleformatfunction ($something) with foo_ma

Reply #1
You'll be able to do at most what you could do with a native component, which means you cannot add global title formatting functions.

Possible to register titleformatfunction ($something) with foo_ma

Reply #2
I guess this is the reason cwb_hooks isnt developed anymore...
Why did you remove the ability to do this, its a great feature if you ask me...
Foobar2000 @ Onkyo SE-90PCI @ Sennheiser HD595 :)

Possible to register titleformatfunction ($something) with foo_ma

Reply #3
Official announcement (pinned in this forum)

Possible to register titleformatfunction ($something) with foo_ma

Reply #4
Quote
If you wish to support fields and functions provided through metadb_display_hooks in your component, you will need to implement a titleformat_hook that calls the metadb_display_hook instances.

Wouldnt a titleformat_hook do the trick in my case then?
Or has all this been completely deprecated?
Foobar2000 @ Onkyo SE-90PCI @ Sennheiser HD595 :)

Possible to register titleformatfunction ($something) with foo_ma

Reply #5
No, title formatting hooks can only be used if your component owns the title formatting object that is evaluated. Think of a playlist viewer, for example, which allows users to define custom column formats. The playlist viewer makes the call to evaluate the format, and could add its own functions there. A popular example is $set_style() in Columns UI.

The limitation is that you cannot make functions available to other components.

May I ask what "$grouptracks(a,b)" is supposed to achieve?

Possible to register titleformatfunction ($something) with foo_ma

Reply #6
ok, no sharing of functions... sort of makes sense i guess...

$grouptracks(a,b) was just something i made up
What i sort of meant what a function that returned an integer of amount of tracks in a playlist group...

The way im doing it now is that i use auto tracknumber on all the files in a folder, then use the %totaltracks% variable, but its inconvenient because i have to retag all the files when i add some new tracks

This is how it is now:
Foobar2000 @ Onkyo SE-90PCI @ Sennheiser HD595 :)

Possible to register titleformatfunction ($something) with foo_ma

Reply #7
What i sort of meant what a function that returned an integer of amount of tracks in a playlist group...

Even with the ability to add global title formatting functions, this would be impossible.

If and how tracks are grouped is entirely up to the playlist viewer and not part of the foobar2000 API.

Possible to register titleformatfunction ($something) with foo_ma

Reply #8
There was this one component which could do it (foo_funcs or something), but it doesnt work anymore because of whats discussed in this thread...

But this made me think, what about a $put/$puts that goes across "sessions"... By sessions, i mean songs, so that i could sort of make this work:

$if($strcmp($substr(%filename%,0,1),a), $pput(nameindex, $add($pget(nameindex), 1)))

$pput/$pget = permanent put/get
So that for every file that starts with a, the first file gets an index of 1, next is 2, 3 and so on...
And then we get to b, the index resets (not in the example code above), and starts at 1 again

All by adding two simple functions... Permanent get and permanent put
Foobar2000 @ Onkyo SE-90PCI @ Sennheiser HD595 :)

Possible to register titleformatfunction ($something) with foo_ma

Reply #9
  • That assumes that the formatting is evaluated once per song and in order
  • It also assumes that all tracks are evaluated
  • It also assumes that there's some way to clean out those "permanent" variables
  • All of the above are not guaranteed in any way and will most likely be broken constantly
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.

Possible to register titleformatfunction ($something) with foo_ma

Reply #10
Maybe proposing a feature request for playlist-only fields like %list_group_index% and %list_group_count% would have better chance than inventing hacks which can't possibly work.
Full-quoting makes you scroll past the same junk over and over.

Possible to register titleformatfunction ($something) with foo_ma

Reply #11
Exactly
Foobar2000 @ Onkyo SE-90PCI @ Sennheiser HD595 :)

 
SimplePortal 1.0.0 RC1 © 2008-2019