Can $if() or TF be used in "Automatically fill values"?, TF = title formattings :) |
Please read foobar2000 Tech Support Forum Rules before posting and comply with all the points.
Failure to provide all the information pointed out in the above document in your post is considered wasting other people's time and in extreme cases will lead to your topic getting locked without a reply.
See also: Hydrogenaudio Terms of Service.
![]() ![]() |
Can $if() or TF be used in "Automatically fill values"?, TF = title formattings :) |
Nov 10 2009, 09:38
Post
#1
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 |
|
|
|
Nov 10 2009, 09:43
Post
#2
|
|
|
Group: Members Posts: 200 Joined: 7-November 04 Member No.: 18008 |
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%. This post has been edited by Zarkon: Nov 10 2009, 09:51 |
|
|
|
Nov 10 2009, 09:58
Post
#3
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 This post has been edited by 2E7AH: Nov 10 2009, 10:07 |
|
|
|
Nov 10 2009, 11:04
Post
#4
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
Here is shortest solution that I run to:
source: CODE \\$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 \\%genre%\\%style%\\%mood%\\%theme% [edit] Linked here This post has been edited by 2E7AH: Nov 10 2009, 11:13 |
|
|
|
Nov 10 2009, 11:38
Post
#5
|
|
![]() Group: FB2K Moderator Posts: 2359 Joined: 30-November 07 Member No.: 49158 |
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 $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.
|
|
|
|
Nov 10 2009, 11:56
Post
#6
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 |
|
|
|
Nov 10 2009, 15:47
Post
#7
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 - [edit] corrected This post has been edited by 2E7AH: Nov 10 2009, 16:08 |
|
|
|
Nov 10 2009, 15:52
Post
#8
|
|
![]() Group: FB2K Moderator Posts: 2359 Joined: 30-November 07 Member No.: 49158 |
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.
|
|
|
|
Nov 10 2009, 16:20
Post
#9
|
|
![]() Group: Super Moderator Posts: 3267 Joined: 26-July 02 From: princegeorge.ca Member No.: 2796 |
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. This post has been edited by Canar: Nov 10 2009, 16:24
Reason for edit: damn edge cases
-------------------- (atrix|(fb2k->e-mu 0404 usb|audio 8 dj))->hd280|jvc ha-fx35-b
|
|
|
|
Nov 10 2009, 16:25
Post
#10
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
Thanks
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! This post has been edited by 2E7AH: Nov 10 2009, 16:38 |
|
|
|
Nov 10 2009, 16:27
Post
#11
|
|
![]() Group: Super Moderator Posts: 3267 Joined: 26-July 02 From: princegeorge.ca Member No.: 2796 |
My version degrades properly if any information is missing and does not need to be executed in sequence.
-------------------- (atrix|(fb2k->e-mu 0404 usb|audio 8 dj))->hd280|jvc ha-fx35-b
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd May 2013 - 10:50 |