Comparing track length in Picard

I’ve looked through the variables in the Picard docs, and I don’t see anything about the track length, either as found in the database or in the file itself. Am I missing anything?

I know length wouldn’t be written as a tag, but I was hoping it would be available as a variable because I want to compare the file length and the database length and add a tag that I can refer to later, if there’s a discrepancy. Is there any way to do that?

[Update] Ah, I overlooked it because I was scanning for something about time. I’ve found _length as a file variable now. So that just leaves getting the time as found in MusicBrainz.

That is indeed an interesting one because the same variable %_length% is used for both the track length provided by the file and the track length provided by MusicBrainz. You can see the value from the file as the “Original Value” when the file is matched to a track, and the “New Value” is the value from MusicBrainz. Unfortunately, I don’t know of any way to access the “Original Value” from a script.

The only thing that I can suggest is a plugin that triggers when a file is matched (file_post_addition_to_track_processor() trigger) to compare the values (I’m pretty sure both the “Original” and “New” values are both available) and set a new tag with the comparison results.

1 Like