Skip to main content

Topic: Can $if() or TF be used in "Automatically fill values"? (Read 3791 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • 2E7AH
  • [*][*][*][*][*]
Can $if() or TF be used in "Automatically fill values"?
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

  • Zarkon
  • [*][*][*]
Can $if() or TF be used in "Automatically fill values"?
Reply #1
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%.
  • Last Edit: 10 November, 2009, 03:51:54 AM by Zarkon

  • 2E7AH
  • [*][*][*][*][*]
Can $if() or TF be used in "Automatically fill values"?
Reply #2
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
  • Last Edit: 10 November, 2009, 04:07:10 AM by 2E7AH

  • 2E7AH
  • [*][*][*][*][*]
Can $if() or TF be used in "Automatically fill values"?
Reply #3
Here is shortest solution that I run to:

source:
Code: [Select]
\\$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:
Code: [Select]
\\%genre%\\%style%\\%mood%\\%theme%


[edit] Linked here 
  • Last Edit: 10 November, 2009, 05:13:29 AM by 2E7AH

  • Yirkha
  • [*][*][*][*][*]
  • Moderator
Can $if() or TF be used in "Automatically fill values"?
Reply #4
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:
Code: [Select]
$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%)))
Full-quoting makes you scroll past the same junk over and over.

  • 2E7AH
  • [*][*][*][*][*]
Can $if() or TF be used in "Automatically fill values"?
Reply #5
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

  • 2E7AH
  • [*][*][*][*][*]
Can $if() or TF be used in "Automatically fill values"?
Reply #6
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
  • Last Edit: 10 November, 2009, 10:08:36 AM by 2E7AH

  • Yirkha
  • [*][*][*][*][*]
  • Moderator
Can $if() or TF be used in "Automatically fill values"?
Reply #7
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.
Full-quoting makes you scroll past the same junk over and over.

  • ExUser
  • [*][*][*][*][*]
  • Read-only
Can $if() or TF be used in "Automatically fill values"?
Reply #8
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.
  • Last Edit: 10 November, 2009, 10:24:18 AM by Canar

  • 2E7AH
  • [*][*][*][*][*]
Can $if() or TF be used in "Automatically fill values"?
Reply #9
Thanks  Done already: http://www.hydrogenaudio.org/forums/index....st&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!
  • Last Edit: 10 November, 2009, 10:38:31 AM by 2E7AH

  • ExUser
  • [*][*][*][*][*]
  • Read-only
Can $if() or TF be used in "Automatically fill values"?
Reply #10
My version degrades properly if any information is missing and does not need to be executed in sequence.