-
Hello! I often use your (very useful!) Metatogger software to manage my music library, and this time I want to fill the I tried to copy the first tag value from the Do I made something wrong? Thanks in advance! // Describe here what the script does
// Copy the first value of a tag to another one
using System.Linq;
using Metatogger.Data;
// For each active file ...
foreach (var file in files)
// ... copy tag value to another tag -- (Do not work ...)
file.SetTag("Composer", file.GetFirstValue("Album"));
// ... set "Test" value to another tag -- (Work well)
//file.SetTag("Composer", "Test");
// The "files" variable contains the collection of audio files checked in Metatogger
// Dictionary<string, List<string>> AudioFile.GetAllTags() => returns all tags of an audio file
// List<string> AudioFile.GetValues(string tag) => returns all values of a tag
// string AudioFile.GetFirstValue(string tag) => returns first tag value for a tag
// AudioFile.SetTag(string tag, string value, bool overwrite = true, bool addIfExists = false) => add, overwrite or remove tag values (if value = null)
// AudioFile.SetTagValue(string tag, string oldValue, string newValue) => replaces the value of a tag by a new value |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
By convention, tag name should be in uppercase. So, replace: file.SetTag("Composer", file.GetFirstValue("Album")); by: file.SetTag("COMPOSER", file.GetFirstValue("ALBUM")); or you can use the file.SetTag("COMPOSER", file.GetFirstValue(TagName.Album)); But if you're simply copying the value of one tag to another, there's no need to use a script. Further information: https://www.luminescence-software.org/en/metatogger/documentation#how-to-add-or-modify-tags |
Beta Was this translation helpful? Give feedback.
By convention, tag name should be in uppercase.
So, replace:
by:
or you can use the
TagName
static class for known tags:But if you're simply copying the value of one tag to another, there's no need to use a script.
Instead, use the manual tag editing tool, and enter the identifier
|ARTIST|
(identifier is case insensitive) as the target value for the COMPOSER tag.Further information: https://www.luminescence-software.org/en/metatogger/documentation#how-to-add-or-modify-tags