Import present values only

is it possible to keep the old tag-value while importing when it's empty in the export-file?

Say I have a file with a tagged %artist% but non-present %title% and I'd export

%artist% - %title%

Then I'll get:

Artist -

Now, the other file I want to import it into already has both %artist% and %title% tagged. If I import this using the pattern from the export configuration, I'd end up with both %artist% and %title% overwritten, which I want for %artist%, but not for %title% that results in an empty/non-present tag.

Can I somehow check if the value in the export file is empty, and only import it when it's not?

EDIT: I just realized the same questions applies to the preview window when using a web source. It seems to work like I want it to for the release-section, but not for the tracks- and additional information-section.

Although I did not quite understand your description in respect of export and import, I want to point to the pseudo placeholder %DUMMY%, which can help to exclude a certain value ​​from the import.

Beside that you are free to import any value into any temporary tag-field and make the decisions later, whether the imported value is useful or not, by using the Mp3tag filter or the scripting language or actions or converters and so on.


Well, I'll try to explain it in a more understandable way. Let's say we have two audiofiles, File 1 and File 2.

File 1 has %artist%=ARTIST1 and %title%=
So, %artist% has a value and %title% not/is non-present.

File 2 has %artist%=ARTIST2 and %title%=TITLE2
Both tags have a value.

If I use the below export pattern with File 1...

%artist% - %title%

... the resulting exportfile will look like:


And if I now import the just exported textfile into File 2, I will end up with:

File 2 (imported values) has %artist%=ARTIST1 and %title%=
Both tags have been overwritten with the values from the export file.

However, since there's no value for %title%, I didn't want to import it in the first place, but keep the original value (TITLE2).

The file I want to get by importing is:
File 2 (intended values) has %artist%=ARTIST1 and %title%=TITLE2

I hope it makes more sense now...

Hm, I hope I understand, so you have currently an import mask string of ...

%artist% - %title%

... which tells Mp3tag to expect two tag-field items, separated by the delimiter string ' - '.

But you want to import only the first string item, so use an import mask string of ...

%artist% - %dummy%

... this should only import the first item, and discard the second item.


I know about %dummy%. The export pattern I presented was just a very simplified example, I don't actually use it. I export a whole lot more tags.
Determining which are empty and adjusting the import pattern accordingly (for each and every track too) would be extremely tedious. I could generate it automatically, yes, but I'd still have to import one track at a time then, since the pattern can change from track to track (just because track 1 has a PERFORMER doesn't mean track 2 does).
I can't change the export pattern to only include value+seperator when the tag has a value either, because then the amount of values in the export file would be variable and I'd have to adjust the import pattern again.

So the only convenient solution that comes to my mind would be to only import values longer than null from the export file (i.e., leave the tag unchanged if the value length is null).

Once you are able to automate it, you can automate the whole process. :wink:

Hm, you have to think over the concept. I will just throw in some ideas.
Note: Before some data has not been imported into a tag-field MP3tag, Mp3tag cannot do any comparison of data.
There is no chance to compare the data, which is 'written on the file's paper', and the data, which is already stored in the target tag-field, or maybe not.
The only chance to control the import process 'half-automatic' is the usage of the %DUMMY% placeholder to discard selected data items while importing.

If you are familiar with the Mp3tag Scripting language, then you can import an entire line from the import text file into a temporary tag-field.
This can be done for all selected files at once resp. for all files grouped by filter.
Then use one or more dedicated actions "Guess values" to import the data into the related tag-fields.

It also seems to be possible to send a dedicated flag field into each line of the external text file while exporting, which later on can control the import process while guessing the values.

You have to find out how to handle the different cases of discarding dedicated items while importing.
Or fill tag-fields selectively, maybe function $if2 can help, anyway.

For me the best way would be to import all external data into a set of temporary fields, then use some actions to fill the target tag-fields, depending on their current content, then remove the temporary tag-fields.