Skip to main content

Topic: Req—Make $swapprefix+$stripprefix work on multi-value fields (Read 1647 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Dario
  • [*][*][*]
Req—Make $swapprefix+$stripprefix work on multi-value fields
So, the <%field%> syntax, when used in the Album List, allows a single tag with multiple values to be split and present in multiple branches.

For example, if the genre tag has is defined as Post-rock; Electronic (two genres), then <%genre%> will place it in two brances— ‘Post-rock’ and ‘Electronic,’ while just %genre% will place it under ‘Post-rock, Electronic’ (a single branch, with the items separated with a comma).

However, if you use $swapprefix(), along with <%album artist%> (or a related field where you'd want the prefixes to be swapped), you’ll experience some weird behavior. In a situation where the album artist tag is defined as We All Inherit the Moon; The Ascent of Everest (two album artists), $swapprefix(<%album artist%>) will fail to swap the prefix of the second artist, so it’ll end up under ‘The Ascent of Everest’ instead of ‘Ascent of Everest, The’ (with the prefix at the end, as it should be).

The same behavior is present with $stripprefix(), too. I’d really appreciate it if this thing was fixed.

EDIT: Can a mod shorten the title so that it doesn't overflow?
  • Last Edit: 27 October, 2012, 02:45:15 PM by Dario

  • mjm716
  • [*][*][*]
Req—Make $swapprefix+$stripprefix work on multi-value fields
Reply #1
I can confirm that this is also a problem in Facets.

multiple fields are not correctly handled with swap OR strip prefix.

  • Dario
  • [*][*][*]
Req—Make $swapprefix+$stripprefix work on multi-value fields
Reply #2
I wonder if Peter has noticed this thread. It'd be really awesome if this was fixed.

  • db1989
  • [*][*][*][*][*]
  • Global Moderator
Req—Make $swapprefix+$stripprefix work on multi-value fields
Reply #3
EDIT: Can a mod shorten the title so that it doesn't overflow?
I started doing this but then decided to go with a more general title as the lack of functionality is not specific to the Album List; it affects multi-value fields in general.

I can understand the absent functionality from the point of view of a title-formatting engine that is currently configured to process single values. Adding this ability would require parsing for dividing symbols and splitting the input field into chunks to be processed individually. This would be a good feature to add. However, whether it is as easy as it sounds in terms of the current code, and/or likely to be added, is something about which I can’t speculate.

  • foosion
  • [*][*][*][*][*]
  • Moderator
Req—Make $swapprefix+$stripprefix work on multi-value fields
Reply #4
Interesting idea, but how do you handle cases like "$left(%<artist>%,1)|%<artist>%"? Even if the $left() function can process and return a list of values, the whole script would return all combinations of artists and their first letters instead of pairing each artist with its first letter.

Fortunately there is another approach which makes it possible to use any function on a multi-value field like %<artist>%. It comes with other drawbacks of course. I have recently dusted of a prototype of this approach and uploaded a tech demo to the just now. It is available from the official component repository. Note that the component does not affect the way other components like Album List or Facets work at all!

After you install the component there is a new command in the context menu called "Multi-formatting Tech Demo". If you select this command the following window will open:
[ Specified attachment is not available ]
On the top you can enter some title formatting code. The component supports the same extensions as the Album List, i.e. %<artist>%, $meta_branch_remap(artist) and $meta_branch(artist). You have to explicitly click the Format button to update the results in the lower part of the window (no auto-update for now). The list box in the lower left part contains all results and the text box in the lower right part contains the full text of the selected result.

I plan to provide more details and the source soon. Happy experimenting!
http://foosion.foobar2000.org/ - my components for foobar2000

  • db1989
  • [*][*][*][*][*]
  • Global Moderator
Req—Make $swapprefix+$stripprefix work on multi-value fields
Reply #5
Really interesting; thanks! I look forward to seeing whether it creeps into other parts of foobar2000.

Req—Make $swapprefix+$stripprefix work on multi-value fields
Reply #6
It would be amazing to see that not only into other parts of foobar2000 but of foobar2000 itself, means: imdependent of any component and everywhere you place tf expressions. If the techdemo prooves that it is realible how probable it would be that Peter implements it?
german support forum: www.foobar-users.de / user: qwert73

  • foosion
  • [*][*][*][*][*]
  • Moderator
Req—Make $swapprefix+$stripprefix work on multi-value fields
Reply #7
My new technique does have its pitfalls, mainly because it expects custom title formatting functions (i.e. ones provided by third-party components instead of the core) to adhere to certain rules which are stricter than the rules imposed by the SDK. I'll create a second tech demo with some functions that demonstrate this.

I expect that this technique will be adopted by developers on a case-by-case basis. If its capabilities and limitations fit the use case of a particular component, it might be integrated otherwise not. As far as integration into the core is concerned I have no idea how likely that is. In particular there are situations when only a single result from a title formatting script is desired.

See the foo_multiformat topic for further discussion about my technique.
  • Last Edit: 24 April, 2013, 04:20:27 PM by foosion
http://foosion.foobar2000.org/ - my components for foobar2000