Script for creating new conditional tag

picard
taggerscript
Tags: #<Tag:0x00007fe3d053a7f8> #<Tag:0x00007fe3d053a690>

#1

Trying to write a script that will set a tag %discversion% based on 2 existing tags, %media%, written by Picard, which may have the value “CD”, and %discogs_format%, written by the discogs component in Foobar, which may contain one or both partial strings “Remaster” or “Reissue” (example string: 1 x CD, Album, Limited Edition, Numbered, Reissue, Remaster). If %media% contains the string “CD”, I want the script to set %discversion% to “Remaster” if %discogs_format% contains that string, “Reissue” if it contains that string but not Remaster, or “1st” if it contains neither. After wracking my brain for most of the afternoon the final script I’ve tried is this:

$if($rsearch(%media%,CD),$if2($if($rsearch(%discogs_format%,Remaster),$set(discversion,Remaster)),$if($rsearch(%discogs_format%,Reissue),$set(discversion,Reissue)),$set(discversion,1st)))

That doesn’t work. I thought maybe the underscore in %discogs_format% was problematic so I tried removing it and that didn’t help. Maybe I’m using $rsearch wrong? Any help would be appreciated.


#2

Picard doesn’t know, what %discogs_format% is, so that can’t work. Maybe if you find out, how foobar2000 stores this in the actual file tags it would help. If you load a file, where foobar has written this information, into Picard, can you see the data somewhere in the tag list at the bottom?


#4

Picard doesn’t know, what %discogs_format% is, so that can’t work.

Do you mean Picard only recognizes a predetermined set of tags and since %discogs_format% isn’t one of them it can’t be used as a variable? Otherwise I don’t understand- the tag already exists in the file and is displayed in Picard’s tag list at the bottom as “discogs_format”. Opening the file in a text editor (notepad++) shows the tag as “DISCOGS_FORMAT=1 x CD, Album, Limited Edition, Numbered, Reissue, Remaster” (This is a flac file using UTF-8 character encoding, if it matters).