Help - Search - Members - Calendar
Full Version: foo_ui_columns scripting problem
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
kopf
I want to append $meta(artist) to the end of the artist variable. When I do the following, nothing happens:

CODE
$insert(title,$meta(artist),$len(title))


neither does
CODE
$insert(title,$meta(artist),4)

for that matter. When I do the following, however, the artist names are displayed in the track title column:

$puts(title,$meta(artist))

Anybody got any ideas on where I've gone wrong?
foosion
What exactly are you trying to do? The $insert function is for string manipulation, it cannot alter tags or variables of any kind. The expression $insert(abcd,123,2) results in the string ab123cd.
thuan
title is a variable the way you want it should be written like this:
CODE
$puts(title,$insert($get(title),$meta(artist),$len($get(title))))

or a better way:
CODE
$puts(title,$get(title)$meta(artist))
kopf
QUOTE(foosion @ Jul 12 2007, 09:14) *

What exactly are you trying to do? The $insert function is for string manipulation, it cannot alter tags or variables of any kind. The expression $insert(abcd,123,2) results in the string ab123cd.


As far as I understand it, $meta(title) refers to the actual ID3 tag, and "title" alone refers to a variable that has been defined by this script. The title variable is equalled with the ID3 tag, and then displayed in the correct column.

I've deduced this from the fact that when i do "$puts(title,hello_world)", the displayed titles of all my tracks turn into "hello_world".

What I want to do is have the artist name appended to this - preferably between parentheses, although I didn't specify this in my original post.
Lyx
QUOTE(kopf @ Jul 12 2007, 10:46) *

What I want to do is have the artist name appended to this - preferably between parentheses, although I didn't specify this in my original post.

I dont get why you are making this so complicated - why dont you simply do:
CODE
$puts(title,$get(title) '('%artist%')')


There is no need to "inject" a string - just redeclare the variable.
kopf
QUOTE(Lyx @ Jul 12 2007, 10:04) *

QUOTE(kopf @ Jul 12 2007, 10:46) *

What I want to do is have the artist name appended to this - preferably between parentheses, although I didn't specify this in my original post.

I dont get why you are making this so complicated - why dont you simply do:
CODE
$puts(title,$get(title) '('%artist%')')


There is no need to "inject" a string - just redeclare the variable.


I'm sorry, I'm just not accustomed to programming in this slightly idiosyncratic scripting language. How could I make this happen only if there exists an album artist?
Lyx
CODE
$if($meta(album artist),
$puts(title,$get(title) '('%artist%')')
)


Untested - it may be that you need to use $meta_test(album artist) instead. In the past, such checks were much easier, because %album artist% would only return a value if the metadata field actually exists. Since the %percent fieldmappings% do now follow more complex remapping-rules, such checks are a now a bit less intuitive (though, the gain is that alot of simple formatting is now easier.... so, through field remappings, simple stuff became even more simple, but complex stuff became a bit more complex).

- Lyx

P.S.:
Wait a minute..... i suppose i get what you are trying to achieve..... you are doing a "singlemode playlist with album artist support". In that case, avoiding field remappings is exactly the wrong thing to do, because the remappings were created to make exactly this easy to do...... test the following code to see what i mean:

CODE
[%album artist% - %album% - %tracknumber% - ]%title%[ '('%track artist%')']


So, what you want to add to the title most probably is NOT %artist% but instead %track artist% (check the reference docs to see what it does)
kopf
QUOTE(Lyx @ Jul 12 2007, 10:45) *

CODE
$if($meta(album artist),
$puts(title,$get(title) '('%artist%')')
)


Untested - it may be that you need to use $meta_test(album artist) instead. In the past, such checks were much easier, because %album artist% would only return a value if the metadata field actually exists. Since the %percent fieldmappings% do now follow more complex remapping-rules, such checks are a now a bit less intuitive (though, the gain is that alot of simple formatting is now easier.... so, through field remappings, simple stuff became even more simple, but complex stuff became a bit more complex).

- Lyx

P.S.:
Wait a minute..... i suppose i get what you are trying to achieve..... you are doing a "singlemode playlist with album artist support". In that case, avoiding field remappings is exactly the wrong thing to do, because the remappings were created to make exactly this easy to do...... test the following code to see what i mean:

CODE
[%album artist% - %album% - %tracknumber% - ]%title%[ '('%track artist%')']


So, what you want to add to the title most probably is NOT %artist% but instead %track artist% (check the reference docs to see what it does)


Thanks very much for all your help and your patience, guys smile.gif Some day I'll get around to learning this odd scripting properly..
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.