Using single quotes is already possible using kid3-cli 3.1.2 or 3.2.0. The problem is that no escaping is done inside single quotes, which is the same behavior as in UNIX shells. However, this does not make much sense in the case of kid3-cli, so I have fixed this to allow escaped single quotes inside strings which are delimited by single quotes. Some examples may explain this better:
Works with 3.2.0, 3.1.2:
kid3-cli.exe -c "set title \"Text with'quote\"" "path\to\file.mp3"
kid3-cli.exe -c "set title 'Text with \"doublequote'" "path\to\file.mp3"
With kid3-git20150325 this works too:
kid3-cli.exe -c "set title 'Text with \'\"both quotes'" "path\to\file.mp3"
As can be seen in the examples, with the fixed version, it is also possible to have both single and double quotes inside the same string. You can find the development release in
I'll update my scripts and generate a new batch. Huge batches of tags can
take hours and hours (especially when I have weird characters that were
crashing things)+
(I should learn Python and stop messing with Excel scripting but it's what
I know.)
Just so I am clear... is there a way with the current release to: (1) put
both single and double quotes inside the title text and (2) only escape the
text around the actual title? I'm am trying to change the original text as
little as possible.
e.g. if my title is: Three Women Sing "That's My Song"
could I do something like:
kid3-cli.exe -c "set title \"Three Women Sing "That's My Song"\""
"path\to\file.mp3"
Or does that break?
--
David C. Sutherland | (310) 729-6411 (c)
Last edit: Urs Fleisch 2015-03-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The correct command for the given example would be:
kid3-cli.exe -c "set title 'Three Women Sing \"That\'s My Song\"'" "path\to\file.mp3"
You'll need the fixed version kid3-git20150325-win32.zip for this. The procedure can be summarized like this:
Enclose the whole command in double quotes
Enclose the argument of the command (e.g. the title string) in single quotes and inside that argument escape all single and double quotes
I am still wondering why it takes hours and hours. Such a simple command executes quite fast. Are you reading repeatedly a large directory just to process a single file? Or how does such a long running command look like?
If you know some JavaScript, you could try the QML script interface, which is available since version 3.2.0. Here you could play with the commands from the Kid3 GUI with the "QML Console" and then write scripts to automate your tasks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the clarity in the examples. Of course ideally I could pass the
title exactly as it appears but enclose it in special delimiters that
aren't likely to be used [ and ] perhaps.
I think it just takes a long time because there are 133,000 files and just
running a DOS batch script that moves a file into a temp directory,
executes the tag, then moves the file back takes a second or three so.
Maybe it only takes an hour. (It's a i3 3.7 ghz machine.)
It does seem like the kid3-cli does have some weird problem finding a file
in a directory of that many files. It doesn't seem it should hang up for
90 seconds or more when there are that many files but that is what it does,
and why I went to that workaround to moving the file in and out of a temp
directory.
Anyway, I am very thankful it works even with the minor limitations. Those
two issues would be my feature requests still: (1) allow a title to be
passed with all sorts of odd characters as long as it's delimited by
special characters (perhaps allow setting the unique delimiter string) and
(2) be compatible with finding an .m4a file in a directory with 100,000
files.
e.g.
instead of:
kid3-cli.exe -c "set title 'Three Women Sing \"That\'s My Song\"'"
"path\to\file.mp3"
perhaps
kid3-cli.exe -c "set title ~!Three Women Sing "That's My Song"~!
"path\to\file.mp3"
or
kid3-cli.exe -c delimit ~! -c "set title ~!Three Women Sing "That's My
Song"~! "path\to\file.mp3"
kid3-cli.exe -c delimit @@ -c "set title @@Three Women Sing "That's My
Song"@@ "path\to\file.mp3"
with the key being that I can pass on the title or comments strings exactly
as they are given without having to manipulate them (adding escape codes.)
But I suppose if all I need to do is run a search and replace on all my
quotation marks and apostrophe and prepend them with a \ symbol that's just
once more step and I can get what I want.
But not massaging (changing) the source text would seem the most ideal, yes?
--
David C. Sutherland | (310) 729-6411 (c)
Last edit: Urs Fleisch 2015-03-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is possible that opening a file deep inside a very populated directory takes long because the file system model loads the directory and all parent directories. This is done by the used Qt framework and not so easy to change. In such situations, it would be much faster to load the directory once and then process all files. kid3-cli is limited for such a task, here a D-Bus (Linux only) or QML/JavaScript script (all platforms) would be better suited.
Are you generating a batch file containing calls to kid3-cli from an Excel sheet? Then you could generate correctly quoted arguments in this step. Or you could generate a QML script from the same data. The QML script would then contain calls like this:
app.openDirectory("path/to/file.mp3")
app.setFrame(tagv2, "title", 'Three Women Sing \"That\'s My Song\"')
The "openDirectory" is a bit strange, but that's the way to open a file by file path. You would have to call app.saveDirectory() before opening a file in a different directory. Quoting is also needed in JavaScript.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Escaping of single quotes in kid3-cli is now implemented in version 3.2.1. I hope this is sufficient. Providing arbitrary delimiters is not possible because part of the quoting is done by the runtime environment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
title should read:
closing single apostrophe should only end command when outside double-quotes
Last edit: turnkit 2015-03-23
Using single quotes is already possible using kid3-cli 3.1.2 or 3.2.0. The problem is that no escaping is done inside single quotes, which is the same behavior as in UNIX shells. However, this does not make much sense in the case of kid3-cli, so I have fixed this to allow escaped single quotes inside strings which are delimited by single quotes. Some examples may explain this better:
Works with 3.2.0, 3.1.2:
With kid3-git20150325 this works too:
As can be seen in the examples, with the fixed version, it is also possible to have both single and double quotes inside the same string. You can find the development release in
http://sourceforge.net/projects/kid3/files/kid3/development/kid3-git20150325-win32.zip
YEAH!!! Thanks!
I'll update my scripts and generate a new batch. Huge batches of tags can
take hours and hours (especially when I have weird characters that were
crashing things)+
(I should learn Python and stop messing with Excel scripting but it's what
I know.)
Just so I am clear... is there a way with the current release to: (1) put
both single and double quotes inside the title text and (2) only escape the
text around the actual title? I'm am trying to change the original text as
little as possible.
e.g. if my title is:
Three Women Sing "That's My Song"
could I do something like:
kid3-cli.exe -c "set title \"Three Women Sing "That's My Song"\""
"path\to\file.mp3"
Or does that break?
--
David C. Sutherland | (310) 729-6411 (c)
Last edit: Urs Fleisch 2015-03-25
The correct command for the given example would be:
kid3-cli.exe -c "set title 'Three Women Sing \"That\'s My Song\"'" "path\to\file.mp3"
You'll need the fixed version kid3-git20150325-win32.zip for this. The procedure can be summarized like this:
I am still wondering why it takes hours and hours. Such a simple command executes quite fast. Are you reading repeatedly a large directory just to process a single file? Or how does such a long running command look like?
If you know some JavaScript, you could try the QML script interface, which is available since version 3.2.0. Here you could play with the commands from the Kid3 GUI with the "QML Console" and then write scripts to automate your tasks.
Thanks for the clarity in the examples. Of course ideally I could pass the
title exactly as it appears but enclose it in special delimiters that
aren't likely to be used [ and ] perhaps.
I think it just takes a long time because there are 133,000 files and just
running a DOS batch script that moves a file into a temp directory,
executes the tag, then moves the file back takes a second or three so.
Maybe it only takes an hour. (It's a i3 3.7 ghz machine.)
It does seem like the kid3-cli does have some weird problem finding a file
in a directory of that many files. It doesn't seem it should hang up for
90 seconds or more when there are that many files but that is what it does,
and why I went to that workaround to moving the file in and out of a temp
directory.
Anyway, I am very thankful it works even with the minor limitations. Those
two issues would be my feature requests still: (1) allow a title to be
passed with all sorts of odd characters as long as it's delimited by
special characters (perhaps allow setting the unique delimiter string) and
(2) be compatible with finding an .m4a file in a directory with 100,000
files.
e.g.
instead of:
"path\to\file.mp3"
perhaps
"path\to\file.mp3"
or
Song"~! "path\to\file.mp3"
Song"@@ "path\to\file.mp3"
with the key being that I can pass on the title or comments strings exactly
as they are given without having to manipulate them (adding escape codes.)
But I suppose if all I need to do is run a search and replace on all my
quotation marks and apostrophe and prepend them with a \ symbol that's just
once more step and I can get what I want.
But not massaging (changing) the source text would seem the most ideal, yes?
--
David C. Sutherland | (310) 729-6411 (c)
Last edit: Urs Fleisch 2015-03-25
It is possible that opening a file deep inside a very populated directory takes long because the file system model loads the directory and all parent directories. This is done by the used Qt framework and not so easy to change. In such situations, it would be much faster to load the directory once and then process all files. kid3-cli is limited for such a task, here a D-Bus (Linux only) or QML/JavaScript script (all platforms) would be better suited.
Are you generating a batch file containing calls to kid3-cli from an Excel sheet? Then you could generate correctly quoted arguments in this step. Or you could generate a QML script from the same data. The QML script would then contain calls like this:
The "openDirectory" is a bit strange, but that's the way to open a file by file path. You would have to call app.saveDirectory() before opening a file in a different directory. Quoting is also needed in JavaScript.
Escaping of single quotes in kid3-cli is now implemented in version 3.2.1. I hope this is sufficient. Providing arbitrary delimiters is not possible because part of the quoting is done by the runtime environment.