Package: beets-extended-metadata
Beets Extended Metadata PluginThis is a plugin for the music management toolbeets.This plugin addsExtended Metadatacapabilities to beets.
It extends the beets query syntax, allowing you to query songs based on Extended Metadata and also allows you to write,
update and view Extended Metadata based on queries.SetupInstall the pluginpipbeets-extended-metadataConfigure the pluginEdit yourbeets configuration fileand add the following section:extendedmetadata:query_prefix:'x'input_field:'comments'Also addextendedmetadatato thepluginssection.Thequery_prefixdefines a prefix that you need to add to the parts of your queries which should look into Extended Metadata instead of the normal metadata.Theinput_fieldis the name of the audio tag, according tothis audio file fields list, that contains your Extended Metadata string.
As default, thecommentsfield will be used. Depending on what field you choose some software, including beets, will not be able to handle or persist it.
I recommend using thecommentsfield, since most software out there will be able to work with this field and having any other information in this field is usually unnecessary.LimitationsThe query syntax as well as theemdsub-command syntax have some limitations regarding the characters you can use for tag names / tag values.Tag Name Limitations:A tag name may only contain letters and numbers (including unicode letters) as well as hyphens, underscores and spaces.Tag Value Limitations:A tag value may contain any character except for commas, also it cannot start with a colon.
This limitation is necessary because colons and commas are special characters that cannot be escaped in any way without breaking the query/command syntax.Writing QueriesAssumptions:You configuredxas the query prefix andcommentsas the input field.Your library contains songs with Extended Metadata strings in thecommentsfield.You imported the songs into your beets library after writing the metadata to the files.ExamplesNote: All queries are case-insensitive.
If you have a valueAbcit will match the query valueabc.
If you want to query case-sensitive, useregex queries.Searching for all russian songsThis assumes you have a custom taglanguagecontaining the language of the song.beetlistx:language:russianHere you can see how you can reference a custom tag from your Extended Metadata.
You start a query part with your query prefixx, followed by a colon.
After that the syntax is the same as with normal beets queries, but it will reference tag names and values from the Extended Metadata instead.Searching for all songs that use synthesizer vThis assumes you have a custom tagvocal_synthcontaining the vocal synthesizer used in the song.beetlistx:vocal_synth:"syntheszer v"You can query for values containing spaces by enclosing them in parentheses or quotes.
This is just the way a shell works and is not done by this plugin.Searching for all songs that are either japanese or chineseThis assumes you have a custom taglanguagecontaining the language of the song.beetlistx:language:japanese,chineseBy passing multiple values, separated by commas, you can query files that match one of the provided valuesSearching for all rock variant songsThis assumes you have a custom taggenrecontaining the genre of the song.beetlistx:genre::.+rockHere you can see how you can useregexto make your queries more flexible.
Just like with beets you can specify that your query value is regex by using the double colon::instead of a single colon.Searching for all songs in japanese that to not come from japan from the last 3 yearsThis assumes you have a custom taglanguagecontaining the language of the song and a custom tagorigincontaining the origin country.beetlistx:.language:japanesex:.origin:'!japan'year:2010..2020In this example you can see how to easily combine Extended Metadata queries with normal audio field queries.
It also shows how to negate query values. If you prefix the query tag value with ! it will meannot equals/not contains.Managing Extended MetadataThe query capabilities work as long as the Extended Metadata has been written to the files according to theExtended Metadata documentation.
This means it is not required to use this plugin to write the Extended Metadata to your files.The plugin provides anemdsubcommand to write, update and show Extended Metadata based on beets queries.
The sub command requires a beets query that matches the items you want to apply options to, and a list of options that define what you want to do.
To get an overview of all options you can use the--helpoption:$beetemd--help
Usage:beetemd<query>[options]Options:-h,--helpshowthishelpmessageandexit-y,--yesautomaticallyconfirmsyes/nopromptsthatrequireuserinput-uUPDATE_EXPRESSION,--update=UPDATE_EXPRESSIONupdateormoveatagvalue.Example:"tag1:v1/tag1:v2"or"tag1:v1/tag2:v1"or"tag1:v1/tag2:v2".-rRENAME_EXPRESSION,--rename=RENAME_EXPRESSIONrenameatag.Example:"tag1/tag2".-aADD_EXPRESSION,--add=ADD_EXPRESSIONaddatagvalue.Example:"tag1:v1"or"tag1:v1,v2,v3".-cCOPY_EXPRESSION,--copy=COPY_EXPRESSIONcopyatagvaluefrom/toextendedmetadataornormalmetadata.Tagsprefixedwith.refertotagsofnormalmetadata.Examples:"tag1/tag2",".artist/tag2","tag1/.artist",".artist/.album_artist"-dDELETE_EXPRESSION,--delete=DELETE_EXPRESSIONdeleteatagvalueortag.Example:"tag1"or"tag1:v1".-s,--showshowtheextendedmetadataoftheitemsThe query argument can be passed to theemdcommand in the same way you pass it to thelistcommand.
The options are optional, but you have to set at least one option.
All non-flag options are repeatable. By repeating an option you can apply multiple actions of the same type.ExamplesShow Extended Metadata of matching filesbeetemdartist:ã‚®ã‚¬Palbum:'No title'-sWith theshowoption the Extended Metadata of each matching file will be printed to the screen.
The Extended Metadata will be shown in its json format.
You can also combine this option with any other options,
in which case the shown Extended Metadata represents the resulting Extended Metadata after all other option have been applied.Add tags for a specific artistbeetemdartist:REOL-alanguage:japanese-aorigin:japanHere you can see how to add new tag values to the Extended Metadata of the file.
You can add multiple tags by repeating theaddoption.Remove a tag from all filesbeetemd''-dgenreYou can match all files by simply passing an empty string to thequeryoption.
This deletes thegenretag from all files, regardless of its value.Remove a tag value for certain audio formatsbeetemdpath::*\.flac-dtag:uncompressedHere we do not delete the entire tag but only a certain value of the tag.
You can use a path query to apply the changes to certain directories or, in this case, certain audio formats by using regex.Rename a tag in all filesbeetemd''-rsinger/vocalsWith therenameoption you can rename a tag by passing the old- and the new tag name separated by/.Update a tag valuebeetemdx:origin:germany-ucategory:good/category:favoriteWith theupdateoption you can change a tag value.
The syntax is the same as with therenameoption but it also includes a tag value.Move a tag value in all filesbeetemd''-utag:metal/genre:metalBy defining different tag names ins the old- and new value expression you can move a value from one tag to another.Move and update a tag value in all filesbeetemd''-utag:'thrash metal'/genre:metalBy defining different tags and values in both the old- and new tag value expression you can move and change a tag value at the same time.Copy a value from normal metadata to extended metadata in all filesbeetemd''-c.comments/lyricsIn a copy expression your can use normal metadata tags as source or destination for a copy operation by prefixing the tag name with a dot.
In this example the value from the normal metadata tagcommentswill be copied to an EMD taglyrics.
When the destination tag does not exist it will be created, if it does exist the value will be appended to existing values.Hint:When adding EMD to a file for the first time you can use this to back up existing tag values from the tag that will be used to store the EMD.Everything combinedbeetemdx:origin:germany,austriax:language:'!german'-atag:western,lederhosen-acategory:good-dcircle-ucircle:'hyper hyper'/tag:hyper-rcategory/rating-c.artist:artist-sThis adds the valueswesternandlederhosento the tagtag,
addsgoodto the tagcategory,
deletes the tagcircle,
moves the valuehyper hyperfrom tagcircleto the tagtagand changes it tohyper,
renames the tagoriginto country, copies the value from the normal tagartistto the emd tagartistand prints the resulting Extended Metadata to the screen
for all songs fromgermanyoraustriathat arenotgerman.Here we delete and rename tags that are also referenced in add and update operations.
In general this works, but it is important to be aware of the order in which the options are applied:UpdateRenameAddCopyDeleteShowSo in this example we renamecategorytoratingbefore we add the valuegoodto the tagcategory.
So we basically add a tag with the old name after renaming it.
This is probably not what we want. In this example we could easily fix this by simply using the new tag name for adding the value.