here is example:
source: %tmp%
pattern: $if($strstr(%tmp%,Genre),%genre%)
I wanted to check if string 'Genre' exist in tag %tmp%, and if exist than write %tmp% value to %genre% tag
What am I doing wrong?
Thanks
The pattern field is what it says it is - No titleformatting, you just specify what the pattern of the source is.
The source accepts titleformatting. Set source to $if($strstr(%tmp%,Genre),%tmp%,%genre%) and pattern to %genre%.
OK, here is real example: I have custom tag AMG which might have genre, style, mood and theme words in it. They indicate if that tag exist (should be written) - it's like that last.fm script for MusicBrainz tagger if one knows about it:
%amg% = Genres: rock // Styles: Thrash // Moods: Epic // Themes: Victory
Now I use pattern: Genres: %genre% // Styles: %style% // Moods: %mood% // Themes: %theme%
which is OK, but if some "inner" tag doesn't exist than this pattern fails, (i.e. style is missing it indicator):
%amg% = Genres: rock // Moods: Epic // Themes: Victory
Now using the pattern doesn't results correctly
I'm quite sure there is way to do this but right now I don't know about it
Here is shortest solution that I run to:
source:
\\$if($strstr(%amg%,Genres: ),$substr(%amg%,9,$sub($strstr(%amg%,' \\ '),1)))\\$if($strstr(%amg%,Styles: ),$substr($substr(%amg%,$strstr(%amg%,Styles: ),$len(%amg%)),8,$sub($strstr($substr(%amg%,$strstr(%amg%,Styles: ),$len(%amg%)),' \\ '),1)))\\$if($strstr(%amg%,Moods: ),$substr($substr(%amg%,$strstr(%amg%,Moods: ),$len(%amg%)),8,$sub($strstr($substr(%amg%,$strstr(%amg%,Moods: ),$len(%amg%)),' \\ '),1)))\\$if($strstr(%amg%,Themes: ),$substr(%amg%,$add($strstr(%amg%,Themes: ),8),$len(%amg%)))
pattern:
\\%genre%\\%style%\\%mood%\\%theme%
[edit] Linked here (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=72335&view=findpost&p=666937)
You could use Masstagger with multiple "Guess value from other fields..." actions like "Genres: %genre% \\", "\\ Styles: %style% \\", "\\ Moods: %mood% \\", "\\ Themes: %theme%".
Or shorten a bit that thing of yours using variables:
$if($put(a,$strstr(%amg%,Genres: )),$substr(%amg%,$get(a),8),$sub($strstr(%amg%,' \\ '),1)))\\
$if($put(a,$strstr(%amg%,Styles: )),$substr($substr(%amg%,$get(a),$len(%amg%)),8,$sub($strstr($substr(%amg%,$get(a),$len(%amg%)),' \\ '),1)))\\
$if($put(a,$strstr(%amg%,Moods: )),$substr($substr(%amg%,$get(a),$len(%amg%)),8,$sub($strstr($substr(%amg%,$get(a),$len(%amg%)),' \\ '),1)))\\
$if($put(a,$strstr(%amg%,Themes: )),$substr(%amg%,$add($get(a),8),$len(%amg%)))
And I was thinking where is the saviour
Thanks for reply, it's shorten a bit, but again too long for "normal" usage, so I changed the script for which it was intended.
I used mentioned lastfm script for MusicBrainz tagger in the past and don't remember how I splited their values which were written similarly in %comment% tag. Or maybe I didn't - don't know, anyway it seems strange to me that foobar needs such a long pattern for the example
You could use Masstagger with multiple "Guess value from other fields..." actions like "Genres: %genre% \\", "\\ Styles: %style% \\", "\\ Moods: %mood% \\", "\\ Themes: %theme%".
I wanted to create masstagger script as it's good idea and save it for future use but it's not good solution:
- "\\ Themes: %theme%" won't work, but there must be added some temp tag in front, i.e. "%temp% \\ Themes: %theme%"
- "\\ Styles: %style% \\" won't work if Styles: is missing - %style% will be assigned with wrong value
-
masstagger actions aren't sequenced: when using properties you can use "Automatically fill values" then use other actions in properties dialog in one step without affecting previous action - masstagger can't do this, i.e. you can't assign value from some tag field and then in later action remove that field[edit] corrected
OK, never mind then. I didn't really try it, just thought it could be a better automation than going through "Automatically Fill Values..." multiple times with different patterns manually in Properties, but with those limitations, it's really not possible.
Just made it work with Masstagger. You need 4 "Guess value from other fields" actions, each like this:
Source format: %amg% //
Guessing pattern: %%Style: %style% //%%
Next one:
Guessing pattern: %%Mood: %mood% //%%
etc.
Thanks Done already: http://www.hydrogenaudio.org/forums/index....st&p=667009 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=72335&view=findpost&p=667009)
I fill a bit silly now. I didn't had to literally follow Yirkha's suggestion + masstagger actions ARE sequenced
[edit] Those double percentages works great, although I don't understand them (something like dummy tags?)
thanks
[v] yeah, I'll update the script
done!
My version degrades properly if any information is missing and does not need to be executed in sequence.