IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
Req—Make $swapprefix+$stripprefix work on multi-value fields
Dario
post Oct 27 2012, 19:44
Post #1





Group: Members
Posts: 158
Joined: 20-September 11
Member No.: 93842



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?

This post has been edited by Dario: Oct 27 2012, 19:45
Go to the top of the page
+Quote Post
mjm716
post Nov 19 2012, 05:25
Post #2





Group: Members
Posts: 155
Joined: 27-May 10
From: EST
Member No.: 80935



I can confirm that this is also a problem in Facets.

multiple fields are not correctly handled with swap OR strip prefix.
Go to the top of the page
+Quote Post
Dario
post Apr 20 2013, 18:53
Post #3





Group: Members
Posts: 158
Joined: 20-September 11
Member No.: 93842



I wonder if Peter has noticed this thread. It'd be really awesome if this was fixed.
Go to the top of the page
+Quote Post
db1989
post Apr 20 2013, 19:04
Post #4





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



QUOTE (Dario @ Oct 27 2012, 19:44) *
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.
Go to the top of the page
+Quote Post
foosion
post Apr 20 2013, 23:32
Post #5





Group: FB2K Moderator (Donating)
Posts: 4439
Joined: 24-February 03
Member No.: 5153



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:
Attached Image

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! smile.gif


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
db1989
post Apr 21 2013, 12:47
Post #6





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



Really interesting; thanks! I look forward to seeing whether it creeps into other parts of foobar2000. wink.gif
Go to the top of the page
+Quote Post
q-stankovic
post Apr 21 2013, 20:03
Post #7





Group: Members
Posts: 1741
Joined: 28-May 06
From: Düsseldorf
Member No.: 31251



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
Go to the top of the page
+Quote Post
foosion
post Apr 22 2013, 10:02
Post #8





Group: FB2K Moderator (Donating)
Posts: 4439
Joined: 24-February 03
Member No.: 5153



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.

This post has been edited by foosion: Apr 24 2013, 21:20
Reason for edit: Added link to new topic.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 1st October 2014 - 13:33