XYtag from/to music file's metadata

Discuss and share scripts and script files...
Post Reply
binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

XYtag from/to music file's metadata

Post by binocular222 »

As XYplorer cannot read metadata of some music container (i.e: m4a; ape...). I have to use 3rd party app: MediaInfo and Kid3 to read/write. This simple example sync "genre" between XYtag and music file's metadata info:

Code: Select all

"Write XYtag to music file's metadata"
	foreach($item, <selitems |>, "|") {
		$term = replace(property("#Tags",$item),  ',' ,  ';');
		$command = "set genre '" . $term . "'";
		Run """C:\Kid3\kid3-cli.exe"" -c ""$command"" ""$item""";
	}

"Write music file's metadata to XYtag"
	foreach($item, <selitems |>, "|") {
		$Tag = replace(runret("C:\MediaInfo\MediaInfo.exe ""--Inform=General;%Genre%"" ""$item"""), '/', ',');
		tag $Tag,$item,1,1;
	}
MediaInfo cli: https://mediaarea.net/en/MediaInfo/Download/Windows
Kid3 cli: https://kid3.sourceforge.io/
I wonder whether there's more effective ways to sync between XYtag and music file's metadata?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

jupe
Posts: 2758
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: XYtag from/to music file's metadata

Post by jupe »

binocular222 wrote:I wonder whether there's more effective ways to sync between XYtag and music file's metadata?
This is just a suggestion, it might not suit you and still doesn't avoid using an external tagger, but if you use columns to display that data in XY's list currently, and it sounds like you always like XY tags to be synced with the files internal tags, then you could make it so that when you view a folder a custom column does something like this:
  1. if a file has a XY tag = display it as normal.
  2. if a file doesn't have a XY tag = it reads it from the file metadata and tags the file, then displays the new XY tag.
then all you would have to do is view a folder and everything would sync up (except writing tags to the actual file), granted initial viewing would be slower on non XY tagged folders, but it would require no interaction.

This doesn't involve writing tags to the file, although that could be added, but I'd personally leave that for a manual task.

You have probably already thought of this approach anyway but I thought I would suggest it for anyone else that may read this.

Post Reply