Tagger Script Auto Value Detection?

Tags: #<Tag:0x00007f7d02490490> #<Tag:0x00007f7d0272ff48> #<Tag:0x00007f7d0272fc50> #<Tag:0x00007f7d0272f8b8>

For files that are going to be saved from the Left:

I’ve encountered a files that are missing ALL tags a few times. Not even a title. Taking care of the title is easy, just if title is ‘’, then title is filename. But the file is missing a tag that comes from the file itself. e.g., Length, Sample Rate, Bit Rate, Channels.

As such there is no value to get from a tag to get the value from so that there is a populated value to use with the naming script when saving from the Left side.

I’ve have had valid playable files load with zero tags. Because those values are not assignable or editable but are used by the script output, how do we trigger them to be computed? Besides “in the DB” as you’d get some others from, the left side does not do any dealing with the DB and I have had files named “02 This is an Audio Track.mp3” come out named as nothing, (1),mo3, (2).mp3, (3).mp3 and so on… how can that value be filled?

I don’t fully follow you here. Of course files sometimes have no tags at all or no useful tags. Part of the reason to use a tool like Picard is to add the tags.

If you want to get tags for such a file there are multiple options when using Picard:

  1. Use AcoustId fingerprinting to identify the file and use the tags from that result
  2. Manually search for the proper metadata on MB and load it into Picard, then tag the file against that
  3. In case the existing file names / folder structure is useful, use the “Tag from filenames” dialog to generate the tags
  4. Manually enter the tags
  5. Do 3) or 4) and then use this metadata to cluster and lookup

Also by default Picard will use the filename as title already if there is no existing data. This if your naming script at least contains %title% this should be part of the generated name.

1 Like

Perhaps I don’t completely grasp your issue here, but this pretty much describes what I remember that confused me a lot when trying out Picard for the first time(s).
Did I say ‘a lot’? Ah yes, I did.

I was used to tagging software that has the most common tags nicely displayed in a certain fixed layout.
There you can easily see which common tags are empty or what there values are, and which ones you will want to edit or populate.

Picard has a completely different approach.
It has no such pre-set fields, and it has no fixed layout for displaying the most essential and basic tags.
It will just display what is present in a file ‘on the left’, and after having done a lookup at MusicBrainz it will display what is available on the server ‘on the right’.

Manual tagging is possible, but it’s no fun.
For that, or for being able to have a quick overview for the most essential tags you will still need other tagging software.

Tag&Rename is one that comes to mind that I like a lot for the initial tagging and preparing of files. E.g. using it’s Freedb lookup works very well and fast.
But there are of course many other tagging programs that have their own strengths and weaknesses.

With regards to %title%, I can’t really see a way -not- to use that variable somewhere along the line. Given that, I have one set of 700 tracks that have -zero- tags of any kind and I figured the filename itself would just carry over.

Reminder: My handling of duplicate named files is different.

I’ve got a couple thousand occurrences of [] [ KHz VBR ch].mp3 .
The brackets, KHz VBR ch are hard coded text in the script. The rest is variables. I’ll change those at some point, too. So here’s my result.

These came from:

I’ve got about 50,000 tracks in sets like that. It’s radio stream rips saved at the track level, though the breaks are not exactly in line with the song. I have no real interest in tagging any of this stuff, I just wanted to gather them all up from the various directories in
iTunes Compilations / Artist / Unknown Album / 999.Song Filename.mp3 .
That they have ended up in.

Clustering included this particular set of 789 files in a larger cluster, so I saved from the left as I know that Artist, Album (Name if the radio stream rip, constant in all files of a group). So it must have done them purely on album name after parsing the directory content. Then there was another couple directories from the same set that stayed separate and I just dropped that onto the same cluster of stuff to add it all there, and hit Save.

As I watched the files go down the screen fast… I was scrolling the window ahead of it to see the ‘wave’ (line turning from light to dark gray) go down the screen.

When at one point every filename turned to [] [ KHz VBR ch].mp3. When I went back to look at those files, they had squat for tags and not even the filename came over.

I just dumped the same tracks from an unprocessed backup volume onto where they belong and re-tagged the whole thing with the album name and “compilation” tags I wanted, and set the track number to the number at the beginning of the file.

For whatever reason, though, it came out with a blank filename and had no length, sample/bit rates, attached in the filenames either, just that ‘blank’ filename made up of the surrounding text and nothing of the original filename.

These groups of tracks will never be MBDB content. The results at finger printing to get “real” data for them is laughable due to the 4 to 6 second overlaps at the beginnings and that much missing at the end. Plus I don’t want to wreck the track #'s (yes, I’d include them on the to be ignored list anyway) as that is the only way that the “album” plays perfectly and displays proper titles/artists.

Maybe it was a fluke of some sort, I just wanted to collect them all from being scattered among a couple thousand directories, back into one location and figured Picard would cluster them all by the Album title. Which it did, and me adding more files to that clustered bunch, having no reason to doubt any of it.

But 800 of those files came through void of filename or file metrics.

That stuff would of course be filled in with a database scan, but as noted, this is one huge “Various Artists” album with bumps between tracks that will never match anything, and the tracks themselves are horrible at matching so I don’t want to Right Side process these kinds of sets at all, just cluster and save back together for organizational purposes, while applying the same Album name and setting the iTunes Compilations tag across of them so when it goes back into iTunes it doesn’t try to store them the hell over the file system again.

I’m still not sure if there is a question hidden in your post or not. But if you wonder why your files end up with empty filenames you have to look at your naming script and which variables it uses.

It does not matter if your files are on the left or the right. If you click on a file you will see the current tags for that file. This is the metadata that gets passed to the naming script. If you see the title tag filled and use the %title% variable in your file naming script, this will be used. If the title does not end up in your naming script, something in your scripting causing this.

If you can’t figure it out feel free to post your naming script.

1 Like

The question at the bottom of it all is - if the file has no tag for bit/sample rate, length and similar, and it’s not going to be fingerprinted (because the results would be pointless) … where do those come from if the file never hits the Right side.

As for the naming script, it’s the one from the other thread.

$noop(★ MBP YA Magic-Script that does more stuff too. - v1.85 - amd/17500mph ★)
$noop(★                                                                      ★)
$noop(★ Here is a script for music renaming in MusicBrainz Picard            ★)
$noop(★                                                                      ★)
$noop(★ Features :                                                           ★)
$noop(★                                                                      ★)
$noop(★   Individualy Selectable Root Directory Organization Options:        ★)
$noop(★                                                                      ★)
$noop(★ • Directories by [A]rtist Name / [N]ame, Artist or last.fm** category★)
$noop(★ • subDirectory for each main type [Album/Single/EP...]               ★)
$noop(★ • Separate Root directory for compilations [!various]                ★)
$noop(★ • Single Artist Compilations go in Artist Directory                  ★)
$noop(★ • Root directory Audio Books, Podcasts, Others                       ★)
$noop(★                                                                      ★)
$noop(★  ~/MusicRoot/[O]/Oingo Boingo/[Artist Compilations]/                 ★)
$noop(★  ~/MusicRoot/Compilations/K-Tel Hits of the 1980s Vol. 1             ★)
$noop(★  ~/MusicRoot/Audio Books/Ready Player One                            ★)
$noop(★  ~/MusicRoot/Podcasts/Mad Mad Music #29                              ★)
$noop(★                                                                      ★)
$noop(★ - Alphabetize artist without leading "The"                           ★)
$noop(★ - Show Album Release Status on Album Directory                       ★)
$noop(★ - Show Record Label on Directory Name Directory                      ★)
$noop(★ - Show Catalogue Number in Album Directory Name                      ★)
$noop(★ - Show Track Duration in Filename                                    ★)
$noop(★ - Filtered character for files & directory naming                    ★)
$noop(★ - Include media type in directory name [when its not CD]             ★)
$noop(★ - Multi-Disc SubDirectory per Disc in Album Directory                ★)
$noop(★ - Custom directory tag for multi-disc CD/Vinyl [CD1/Disc1 by default]★)
$noop(★ - Put multi-CD release in same directory [names become 101/102/201..]★)
$noop(★ - Vinyl can use musicbrainz style for track [A1/A2/B1...]            ★)
$noop(★ - File Type SubDirectory in Album Directory                          ★)
$noop(★                                                                      ★)
$noop(★ ** Optional Plugin Needed for Last.fm [for category trending]        ★)
$noop(★   -> https://github.com/fdemmer/Picard-Last.fm.ng-Plugin             ★)
$noop(★                                                                      ★)
$noop(★ Do Not Taunt The Happy Tagging Ball                                  ★)
$noop(★                                                                      ★)
$noop(★   Based on the MBP Magic Script  By Ski-lleR                         ★)
$noop(★   Thanks to avibrazil for his filter                                 ★)
$noop(★ > https://github.com/avibrazil/picard-scripting                      ★)
$noop(★                                                                      ★)

$noop(★ INSERT COIN ★)

$noop(Configuration Section - 0-Disable / 1-Enable)

$noop(★ GLOBAL ★)
$set(_separateByTypeInArtistDirectory,1) $noop(Album Name/EP/Single/Live/Tribute etc.)
$set(_separateAlbum,0) $noop(Albums in SubDirectory as well)

$noop(★ Multi-Disc ★)

$noop(★ Format Separation @ Root Level and/or Album Level ★)

$noop(★ orderTypeForRoot ★)
$noop(★  1: Category [Last.fm.ng] ★)
$noop(★  2: Artist first letter ★)

$noop(★ orderTypeForArtist ★)
$noop(★  1: First letter of first name ★)
$noop(★  2: First letter of last name ★)

$noop(★ Tribute / Cover Sorting - Place in Artist being attributed ★)




$noop(★ Other Values Included in Filename ★)

$noop(####################### END SETTINGS #######################)

$noop(★ Unless you're changing appearances, there isn't really anything to do past here ★)

$noop(########## DETECT MUSIC TYPE ###############################)

$noop(★ Detect Album ★)

$noop(★ Detect Single ★)

$noop(★ Detect EP ★)

$noop(★ Detect Broadcast ★)

$noop(★ Detect Audiobook ★)
$if($in(%releasetype%,audiobook),  $set(_isAudiobook,1)

$noop(★ Detect Other ★)

$noop(★ Detect Artist Compilation ★)

$noop(★ Detect Live ★)

$noop(★ Detect Tribute ★)

$noop(★ Detect Cover ★)

$noop(★ Detect Podcast ★)

$noop(★ Detect Soundtrack ★)
$noop(★ Detect Incomplete ★)

$noop(★ Detect Video ★)

$noop(★ Detect Various Artist ★)
$if($eq(%albumartist%,Various Artists),

$noop(★ Re-detect Compilation ★)
	$if($eq(%_isGlobalCompil%,1), $set(_isArtistCompil,0) )

$noop(★ Get Track Length ★)
$noop(########## TAG MANAGE ######################################)

$noop(★ Organize artist by alphabetical Directories excluding leading The ★)
$set(albumartist,$if($eq($left(%albumartist%,4),The ),%albumartistsort%,%albumartist%))

$set(%comment%,%_originalFileName% []%comment%)

$noop(########## TAG CLEANUP  ####################################)

$noop(★ Typography for tags: changes will affect tags on media ★)

$noop(★ ... ➡ …)

$noop(★ No. ➡ №)
$set(album,$replace(%album%, [Nn]o.\\s*\(\\d\), №\\1))
$set(title,$rreplace(%title%, [Nn]o.\\s*\(\\d\), №\\1))
$set(discsubtitle,$replace(%discsubtitle%, [Nn]o.\\s*\(\\d\), №\\1))

$noop(★ [digit]" ➡ [digit]″)

$noop(★ "12" Vinyl" ➡ "12 Inch Vinyl")
$set(media,$rreplace(%media%,\(\\d\)",\\1 Inch))
$set(album,$rreplace(%album%,\(\\d\)",\\1 Inch))
$set(title,$rreplace(%title%,\(\\d\)",\\1 Inch))

$noop(★ "something" ➡ “something” single quote for server/samba)

$noop(★ Typography on file naming only ★)

$noop(★ # ➡ ♯)

$noop(★ ;: ➡ h, m,)

$noop(★ : ➡ ∶)

$noop(★ ? ➡ ⁇)






$noop(Bitrate factors of 8.0 are CBR, Anything else is VBR)
$noop(If it's VBR, What is the bitrate?)
$if($gte(%BrVBR%,320),$set(_filebr, B 320),
$if($lt(%BrVBR%,220),$set(_filebr, V0),
$if($lt(%BrVBR%,190),$set(_filebr, V1),
$if($lt(%BrVBR%,170),$set(_filebr, V2),
$if($lt(%BrVBR%,150),$set(_filebr, V3),
$if($lt(%BrVBR%,140),$set(_filebr, V4),
$if($lt(%BrVBR%,130),$set(_filebr, V5),
$if($lt(%BrVBR%,120),$set(_filebr, V6),

$noop(★ Pathname Generation Starts Here ★)

$noop(★ Root level Path ★)
$noop(   root = '/Volumes/Drive/Music/ ... [Destination Directory Setting])

$noop(★ Separate by Format at root directory ★)
$noop(   rootLevelPath/MP3/Artist/Album ...)

$noop(   Earlier Incomplete Separation for Sorting ...)
$if($eq(%_extraTrackHandling%,1),$if($eq($is_complete(),0),$if($lt($matchedtracks( ),%_totalalbumtracks%),1 - %_incompleteDirectory%)),$if(%_isIncomplete%,1- %_incompleteDirectory%,))/
$noop( %artist%/) Unknown Album/%artist%/
$noop(★ Soundtrack in custom directory ,after soundtracksDirectory?? ★)
$noop(   root/*/Audio Books/Title ...)
$noop(   root/*/Soundtracks/Title ...)
$noop(   root/*/Podcasts/Title ...)

$noop(★ Various in custom directory ★)
	$noop(★ Order root by category ★)

$noop(★ Order root by artist ★)
		$upper($firstalphachar($if2(%_albumartistForFilename%, %_artistForFilename%),#)),
		$if(%_isGlobalCompil%,,$upper($firstalphachar($if2(%_albumartistsortForFilename%, %_artistsortForFilename%),#)))

$noop(★ Artist with first letter of first name ★)
$noop(root/<*>/B/The B-52's)

$noop(★ Artist with first letter of last name ★)
$noop(root/<*>/B/B-52's, The)

$noop(★ Using Alternate Artists Directory For Covers & Tributes  **Uses Order for Album Artist tag [Field]★)

	$noop(root/<*>/O/Oingo Boingo/[Tributes]/DeadBandsParty)


	$noop(★ Organize by type ★)
	$noop(root/<*>/Y/Yes/[Live]/90125 Live)

$noop(root/<*>/B/B-52's, The]/Bouncing off the Satellites/ )
$noop(★ Bouncing off the Satellites [Media-Type]/ ★)
$noop($if($ne(%media%,CD),$if(%media%,[$rreplace(%media%,["″], Inch)])))

$if(%media%,$title( [%media%]),)

$noop($if($and(%media%,$ne(%media%,CD)),$if($in(%media%,Vinyl),$title( [%media%])),$upper( [%media%])))

$noop(★ Bouncing off the Satellites [Vinyl] [YEAR]/ ★)
$if($if2(%date%,%originalyear%,%originaldate%), [$left($if2(%date%,%originalyear%,%originaldate%),4)],[0000])

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Release Status]/ ★)
$if(%releasestatus%,$if($eq(%_showReleaseStatus%,1),$title( [%releasestatus%])))

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [Label]/ ★)
$if(%label%,$if(%_showRecordLabel%, $if(%label%,$title([%label%]))))

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [CAT-Number]/ ★)
$if(%catalognumber%,$if($eq(%_showCatalogueNumber%,1),$title( [%catalognumber%])))

$noop(★ Complete Albums with Extra Tracks are not marked as Incomplete - _extraTrackHandling,1 - Separate Album Directory for duplicates at the same Level. ★)
$noop(★ Complete Albums with Extra Tracks are treated as Incomplete - _extraTrackHandling,0 ★)

$noop(★ _incompleteDirectory,1 Specify Partial/Incomplete Album Directory Name. ★)
$noop(★ _incompleteDirectory,0 Do not use a separate Directory for Partials/Incompletes/Overcompletes [Albums with Extra or Missing Tracks] ★)

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ ★)
$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001] - Incomplete/ ★)
$if($eq(%_extraTrackHandling%,1),$if($eq($is_complete(),0),$if($lt($matchedtracks( ),%_totalalbumtracks%), - %_incompleteDirectory%)),$if(%_isIncomplete%,- %_incompleteDirectory%,))/

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ MP3 / ★)
$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ Bouncing off the Satellites MP3 / ★)
$if($eq(%_albumLevelTypeSeparation%,1),$if($eq(%_albumNameAtTypeSeparation%,1),%_albumForFilename% ,)$upper(%_extension%))/

$noop(★ Bouncing off the Satellites [Vinyl] [1986] [Official] [MCA] [AB-DC001]/ .../ Disc # ★)
	)$if($lt(%totaldiscs%,10),$set(_discnumber, %discnumber%),$set(_discnumber,$num(%discnumber%,2)))$noop(
		)$if($and(%_discsubtitleForFilename%,$eq(%_showDiscSubtitle%,1)),$set(_nameForDiscDirectory,%_nameForDiscDirectory% - %_discsubtitleForFilename%))$noop(

$noop(★ Track. Title --%_filebr% -- %bitrate% -- %BRType% -- %BrVBR% --  ★)  
		)$if(%_musicbrainz_tracknumber%,%_musicbrainz_tracknumber%. )$noop(
	)$if(%tracknumber%,$if($gt(%totaldiscs%,1),$if($and($eq(%_useSubDiscDirectory%,0),$eq(%_mergeDiscWhenNotUsingSubDirectory%,1)),%discnumber%))$num(%tracknumber%,2). ))
$noop(★ GAME OVER ★)

$if($eq(%_showBandwidth%,1), [%_filebr%$left(%_bitrate%,3) %_sample_rate%KHz %BRType% %BrVBR%%_channels%ch])  

$noop(★ 00 CREDITS ★)

bitrate etc. come from the file itself (depending on the format), it’s actually not data stored in the tags. For MP3 files those should always be available, e.g. the bitrate is available as %_bitrate%. I see in your naming script you use a variable called %bitrate%, but that must be a custom tag you create, likely in a separate script in Options > Scripting. Since those scripts are not run automatically you have two options:

  • If you only want to use the bitrate in the filenaming, use the %_bitrate% variable in the naming script.
  • If you actually want this custom bitrate variable saved to the tags, you have to run the script that sets this variable manually (right click the files and choose the script in the “Run script” submenu)

Okay, … yup. The custom crafted output. Though that is based on what the file has to offer, and that’s the first time I’ve ever seen it produce zero results. But I can add a check in there that if the value is 0,none, then use %_underscoreVariant% directly.

I know I’m posting a lot, if it’s too much, tell me to can it, though even when I find my own solution, I do like to put it there so others can find it, too.

This is great stuff! I’ll probably end up doing some video’s on using Picard for YouTube… though I know there’s lots out there, more can’t hurt, and not everyone connects with every method of teaching. So, the more the merrier.

1 Like