I’m trying to write a script that strips off (…) from title tags and appends the contents (between the brackets) to the comment tag, appending the existing comment (or create a new tag).
Here is the script,
I can see the comment and edit it in Picard (showing the tag as ‘comment’) before the script is run. But when this script runs it always returns with ‘No Comment’
I do not understand why,
$if2(%comment%,No Comment)
when there is a comment, that $if2 still returns ‘No Comment’
Why is %comment% empty when I can clearly see in Picard that a comment has been set???
Sorry, I’m rather new to this…
As an aside… is there any debugger for the tag scripts short of applying it and cancelling picard every iteration?
$set(TestComment,%comment%; %_releasecomment%; %_releasegroupcomment%; %_recordingcomment%; no more)
to check which variables are getting set. However, the ‘Comment’ line shown in picard does not appear in this list.
So what I see is that the ‘Comment’ that appears in picard actually comes from a flac tag that I can see with exiftool. This reports,
Comment : Steven Wilson 2014 Remix
But this doesn’t show up in any of the MB variables, e.g. my TestComment variable has
; super deluxe edition; ; ; no more
That implies that _releasecomment does indeed have a value, but is not the value shown in Picard as ‘Comment’
Seems there’s a little bit more going on if there’s a comment tag in the audio file.
Based on the Tag Mapping information in the Picard documentation, you might be able to retrieve the value as %comment:description%. My understanding of the inner workings of the tag handling is limited at best. Perhaps someone like @outsidecontext can better explain why this may or may not work.
Hi again, thanks for taking the time.
So I’ve now made TestComment include your suggestion and also added %comment:% as suggested by outsidecontext…
Eg
$set(TestComment,%comment:description%; %comment:%; %comment%; %_releasecomment%; %_releasegroupcomment%; %_recordingcomment%; no more)
But (with another similar case), this only returns,
; ; ; red tray; ; original studio mix; no more
As you can see, nothing in the sections for '%comment:…% etc. and still nothing to match the comment showing in Picard.
This sort of app arcana keeps us on our toes. In this case, I’m now more interested to have the issue logged, so that others who will undoubtedly encounter this have a chance…
What is the tag name that is stored in the file for the original comment? You may have to read it explicitly, and perhaps it’s something as simple as a case mismatch (%Comment% instead of %comment%). I admit that I’m grasping at straws here.
As I understand you want to preserve existing “comment” tag of the file. I tested this with a FLAC file and $set(OriginalComment,$if2(%comment%,No Comment)) works for me if the FLAC file contains a “COMMENT” tag. The content of the tag will show up in OriginalComment.
A few ideas:
Make sure you are using a recent version of Picard. In Picard before 2.5 the existing file tags where not available in the script.
Try the “View script variables” plugin. When installed and activated you can right click a file and choose “Plugins > View Script Variables” in the context menu. It will show a dialog listing all variable names available.
Alternatively right click the value of the comment tag showing the expected value in the metadata view and select “Edit…”. In the edit dialog you will see the actual internal tag name used by Picard.
For me the name was indeed comment. But maybe you have something else happening here.
Ahh… yes. That’s it. The Mint 20.3 apt package release for Picard is an old 2.3.1, so your observation that file tags are not available now makes it obvious what my problem is.
I’ll try a snap version which is 2.11 (I hope that’s really 2.11 and not 2.1.1).
Thanks for checking this out.
The snap should really be 2.11, if not, shout at me. Be aware that snap is quite restrictive with directory access, though. Outside your home directory you can only access what Snap considers external drives.
Managed to get the snap onto the ‘Open With’ context menu. Checked it out, yes 2.11 and now the flac ‘comment’ appears with %comment% and everything is rosy…
It always seems that snaps or flatpaks have some form of ‘gotcha’ that end up taking a lot of effort to figure out. But it looks like they are the way to go if the repositories are so far out of date.
Thanks for your time.