Command-line tool to tag music?
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Command-line tool to tag music?
I'm going to use XY to tag my music database (store the tag inside the music file), so:
- Which format (i.e ID3v1/ID3v2) allow XY's internal properties such as #mp3.genre ?
- Which command-line tool should I use?
- Which format (i.e ID3v1/ID3v2) allow XY's internal properties such as #mp3.genre ?
- Which command-line tool should I use?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: Command-line tool to tag music?
Currently, I use kid3 but just found out that XY's native properties only read ID3v1, ignore ID3v2.3
Hmn, why not support ID3v2?
Hmn, why not support ID3v2?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: Command-line tool to tag music?
XY does support ID3v2.3 and sometimes 2.4.
Things have improved only slightly since I explored this last year: Still XY claims Preview "cannot decode" MP3s with ID3v2.4 (at least here where I have no codecs installed).
There remain differences between the Meta tab and the columns:
v1.mp3; v1v2.4.mp3; and v2.4.mp3 only show Length & Bit rate in the Meta tab
v2.3.mp3 shows all fields (including comment) in the Meta tab but as you can see its MP3 Comments column is empty.
Maybe the inspiration that Don was waiting on is named binocular222?
Things have improved only slightly since I explored this last year: Still XY claims Preview "cannot decode" MP3s with ID3v2.4 (at least here where I have no codecs installed).
There remain differences between the Meta tab and the columns:
v1.mp3; v1v2.4.mp3; and v2.4.mp3 only show Length & Bit rate in the Meta tab
v2.3.mp3 shows all fields (including comment) in the Meta tab but as you can see its MP3 Comments column is empty.
Maybe the inspiration that Don was waiting on is named binocular222?
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: Command-line tool to tag music?
Oh, that's, I'm testing on Comment field.
btw, why I cannot make XY scripting to work with kid3-cli.exeMaybe something wrong with quoting again? even running directly through cmd.exe not work
btw, why I cannot make XY scripting to work with kid3-cli.exe
Code: Select all
run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c ""select <curitem>"" -c ""set Comment abc"""
Code: Select all
kid3-cli.exe -c select "C:\test.mp3" -c set comment "abc"
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: Command-line tool to tag music?
At least quoting of 1st box doesn't fit quoting of 2nd. (Multiple different parts inside inner quotes.)
And maybe a missing ';' at the end of 1st box?
Maybe us stepping mode, and have a look at the parameters of run.
(If it's a longer script: put a Step; in front of run.)
And maybe a missing ';' at the end of 1st box?
Maybe us stepping mode, and have a look at the parameters of run.
(If it's a longer script: put a Step; in front of run.)
Win11 Pro 223H2 Gerrman
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: Command-line tool to tag music?
ok, found it
Code: Select all
$term = "some genre";
$command = "set genre '" . $term . "'";
run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c ""$command"" ""<curitem>"""
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: Command-line tool to tag music?
I was going to say. try:Their examples show that you are venturing into a land of quoting nightmares.
If you're able to use multi-line scripts I wholeheartedly recommend using heredocs:
Code: Select all
run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c 'select ""<curitem>""' -c 'set comment ""abc""'";
If you're able to use multi-line scripts I wholeheartedly recommend using heredocs:
Code: Select all
run <<<CMD
"D:\Doc\Temporary\kid3\kid3-cli.exe" -c 'select "<curitem>"' -c 'set comment "abc"'
CMD;
Re: Command-line tool to tag music?
I think this should've worked too I'm reasonably certain select, set, comment are builtin commands and shouldn't need to be in quotes.
ed. Okay, I stand corrected.
Code: Select all
::run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c 'select ""<curitem>""' -c 'set comment ""abc""'";
Code: Select all
::$itm = "I:\t e\m.ext"; $cmt = "bla blah"; run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c 'select ""$itm""' -c 'set comment ""$cmt""'";
ed. Okay, I stand corrected.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: Command-line tool to tag music?
Based solely on their examples I don't think that's the case. It looks like anytime the command passed to the '-c' option contains a space it is quoted - so while set and select are builtin commands because they contain more than just the command name the entire parameter specified to the '-c' option needs to be quoted.SammaySarkar wrote:I'm reasonably certain select, set, comment are builtin commands and shouldn't need to be in quotes.
For instance, look at this example:
Code: Select all
kid3-cli -c autoimport -c 'syncto 1' -c fromtag -c playlist \
/path/to/dir/*.mp3
EDIT: And then because some of these commands can contain their own arguments which can contain spaces (comments, file paths) those are also quoted.
So you've got multiple sets of quotes...
Those surrounding application and its arguments.
Those around some kid3 commands (passed to '-c').
Those around some parameters for the kid3 commands (passed to select, etc.).
/edit
See a quoting nightmare!SammaySarkar wrote:ed. Okay, I stand corrected.
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: Command-line tool to tag music?
Oh, there seems to be a bug:
echo <prop #mp3.Comments>
trim off first 3 characters. i.e: ID3v2 comment "abcdef" → XY return "def"
This doesn't happens with ID3v1 comment
echo <prop #mp3.Comments>
trim off first 3 characters. i.e: ID3v2 comment "abcdef" → XY return "def"
This doesn't happens with ID3v1 comment
Last edited by binocular222 on 23 Mar 2015 14:10, edited 1 time in total.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: Command-line tool to tag music?
That looks right to me.binocular222 wrote:Oh, there seems to be a bug:
echo <prop #mp3.Comments>
trim off first 3 characters. i.e: the comment "abcdef" → XY return "def"
What are you expecting?
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: Command-line tool to tag music?
echo <prop #mp3.Comments>
should return "abcdef"
Anyway, this seems to be a correct way to set comments via kid3-cli and also allow <prop #mp3.comments>
should return "abcdef"
Anyway, this seems to be a correct way to set comments via kid3-cli and also allow <prop #mp3.comments>
Code: Select all
$term = "abyz ghi";
$command = "set comment '" . $term . "'";
run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c ""tag 1"" -c ""$command"" ""<curitem>""";
run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c ""tag 2"" -c ""set comment ''"" ""<curitem>""";
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: Command-line tool to tag music?
This goes back to the screenshot/post I mentioned earlier. I believe <prop #mp3.Comments> only pulls comments from the ID3v1 field, so if you only set the comment in ID3v2 XY won't see it.binocular222 wrote:echo <prop #mp3.Comments>
should return "abcdef"
Anyway, this seems to be a correct way to set comments via kid3-cli and also allow <prop #mp3.comments>Code: Select all
$term = "abyz ghi"; $command = "set comment '" . $term . "'"; run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c ""tag 1"" -c ""$command"" ""<curitem>"""; run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c ""tag 2"" -c ""set comment ''"" ""<curitem>""";
I think you might be able to shorten that by doing:
Code: Select all
$term = "abyz ghi";
$command = "set comment '" . $term . "'";
run """D:\Doc\Temporary\kid3\kid3-cli.exe"" -c ""tagformat 1"" -c ""tagformat 2"" -c ""$command"" ""<curitem>""";
Code: Select all
$term = "abyz ghi";
$command = <<<COMMAND
set comment "$term"
COMMAND;
run <<<CMD
"D:\Doc\Temporary\kid3\kid3-cli.exe" -c 'tagformat 1' -c 'tagformat 2' -c '$command' "<curitem>"
CMD;
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: Command-line tool to tag music?
ok, my plan is: Tag music with XY's native tag > copy that into music files' comment field > move files to another computer > copy comment filed to XY's native tag
Sound good? any better plan?
P.S maybe comment field is too volatile, I may use genre field instead
Sound good? any better plan?
P.S maybe comment field is too volatile, I may use genre field instead
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: Command-line tool to tag music?
write comments to a companion file/db. Eg,
.tags are text file that point to files as relative paths, and list tags/comments/labels/what have you, preferably in the same format as XY's tag.db.
The only requirement is the files have to be transferred without changing the relative path structure.
This will be faster and less cumbersome, and cleaner, than writing-reading each mp3 separately.
Code: Select all
.\dir\file.mp3
.\dir\file2.mp3
.\dir.tags
The only requirement is the files have to be transferred without changing the relative path structure.
This will be faster and less cumbersome, and cleaner, than writing-reading each mp3 separately.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]