[Pkg-kde-extras] Bug#432953: kid3: kid3 not allowing creation of new export/import formats
Urs Fleisch
urs.fleisch at gmail.com
Fri Jul 13 16:30:25 UTC 2007
The following description of how to edit custom export/import formats was
tested with the original kid3_0.9-0feisty_i386.deb from
http://kid3.sourceforge.net (because I do not run lenny), but it should
work with lenny too:
- Start Kid3, open a directory with audio files in it.
- File/Export, Custom Format
- Now type into the three line edits the following lines and type <Enter>
at the end of each line, so that Kid3 will update the preview:
\\documentclass{article}\n\\begin{document}\n\\begin{enumerate}\n
\\item %s\n
\\end{enumerate}\n\\end{document}
In the preview, you can now see a LaTeX file, now click "Save Settings",
and then export it, e.g. using "To File" or "To Clipboard".
- Close, File/Quit.
If you start Kid3 again, your Custom format is still there.
Now look into ~/.kde/share/config/kid3rc:
(..)
ExportFormatHeaders=,,#EXTM3U,[playlist],<html>\\\\n <head>\\\\n
<title>%a - %l</title>\\\\n </head>\\\\n <body>\\\\n <h1>%a -
%l</h1>\\\\n <dl>\\\\n,<kover>\\\\n <title>\\\\n <text><![CDATA[%a
]]></text>\\\\n <text><![CDATA[%l]]></text>\\\\n </title>\\\\n
<content>,\\\\\\\\documentclass{article}\\\\n\\\\\\\\begin{document}\\\\n\\\\\\\\begin{enumerate}\\\\n
ExportFormatIdx=6
ExportFormatNames=CSV unquoted,CSV quoted,Extended M3U,Extended
PLS,HTML,Kover XML,Custom Format
ExportFormatTracks=%t\\\\t%s\\\\t%a\\\\t%l\\\\t%y\\\\t%g\\\\t%c\\\\t%d.00,"%t"\\\\t"%s"\\\\t"%a"\\\\t"%l"\\\\t"%y"\\\\t"%g"\\\\t"%c"\\\\t"%d.00",#EXTINF:%D\\,%a
- %s\\\\n%p,File%T=%p\\\\nTitle%T=%a - %s\\\\nLength%T=%D, <dt><a
href="%u">%t. %s</a></dt>, <text><![CDATA[%t. %s]]></text>,\\\\\\\\item
%s\\\\n
ExportFormatTrailers=,,,NumberOfEntries=%n\\\\nVersion=2, </dl>\\\\n
</body>\\\\n</html>,
</content>\\\\n</kover>,\\\\\\\\end{enumerate}\\\\n\\\\\\\\end{document}
(..)
These are simple string lists. If you want to add an additional format
called "LaTeX" while not touching the Custom format, use this:
ExportFormatHeaders=,,#EXTM3U,[playlist],<html>\\\\n <head>\\\\n
<title>%a - %l</title>\\\\n </head>\\\\n <body>\\\\n <h1>%a -
%l</h1>\\\\n <dl>\\\\n,<kover>\\\\n <title>\\\\n <text><![CDATA[%a
]]></text>\\\\n <text><![CDATA[%l]]></text>\\\\n </title>\\\\n
<content>,,\\\\\\\\documentclass{article}\\\\n\\\\\\\\begin{document}\\\\n\\\\\\\\begin{enumerate}\\\\n
ExportFormatIdx=0
ExportFormatNames=CSV unquoted,CSV quoted,Extended M3U,Extended
PLS,HTML,Kover XML,Custom Format,LaTeX
ExportFormatTracks=%t\\\\t%s\\\\t%a\\\\t%l\\\\t%y\\\\t%g\\\\t%c\\\\t%d.00,"%t"\\\\t"%s"\\\\t"%a"\\\\t"%l"\\\\t"%y"\\\\t"%g"\\\\t"%c"\\\\t"%d.00",#EXTINF:%D\\,%a
- %s\\\\n%p,File%T=%p\\\\nTitle%T=%a - %s\\\\nLength%T=%D, <dt><a
href="%u">%t. %s</a></dt>, <text><![CDATA[%t. %s]]></text>,,\\\\\\\\item
%s\\\\n
ExportFormatTrailers=,,,NumberOfEntries=%n\\\\nVersion=2, </dl>\\\\n
</body>\\\\n</html>,
</content>\\\\n</kover>,,\\\\\\\\end{enumerate}\\\\n\\\\\\\\end{document}
You just have to add another entry in all four entries
(ExportFormatHeaders, ExportFormatNames, ExportFormatTracks,
ExportFormatTrailers) after a comma. There are a lot of backslashes, this
seems to be how KDE serializes backslashes. In Kid3, you need two
backslashes for one in the output, a single backslash for special
charactes like \n. KDE seems to quadruplicate all those backslashes.
For the Import, it is the same:
- File/Import, Custom Format
- Leave the first line edit empty, in the second type (to import from the
LaTeX file created before):
\\item\s+%s(\S[^\r\n]*\S)\s*
- Click "Save Settings"
- Cancel, File/Quit.
Now look into ~/.kde/share/config/kid3rc:
(..)
ImportFormatHeaders=,,%a(\\\\S[^\\\\r\\\\n/]*\\\\S)\\\\s*/\\\\s*%l(\\\\S[^\\\\r\\\\n]*\\\\S)[\\\\r\\\\n]+\\\\s*tracks:\\\\s+\\\\d+.*year:\\\\s*%y(\\\\d+)?.*genre:\\\\s*%g(\\\\S[^\\\\r\\\\n]*\\\\S)?[\\\\r\\\\n],<[^>]+>%a([^<\\\\s][^\\\\r\\\\n/]*\\\\S)\\\\s*/\\\\s*%l(\\\\S[^\\\\r\\\\n]*[^\\\\s>])<[^>]+>[\\\\r\\\\n]+\\\\s*tracks:\\\\s+\\\\d+.*year:\\\\s*%y(\\\\d+)?.*genre:\\\\s*%g(\\\\S[^\\\\r\\\\n>]*\\\\S)?<[^>]+>[\\\\r\\\\n],,,,
ImportFormatIdx=7
ImportFormatNames=CSV unquoted,CSV quoted,freedb HTML text,freedb HTML
source,Title,Track Title,Track Title Time,Custom Format
ImportFormatTracks=%t(\\\\d+)\\\\t%s([^\\\\r\\\\n\\\\t]*)\\\\t%a([^\\\\r\\\\n\\\\t]*)\\\\t%l([^\\\\r\\\\n\\\\t]*)\\\\t%y(\\\\d+)\\\\t%g([^\\\\r\\\\n\\\\t]*)\\\\t%c([^\\\\r\\\\n\\\\t]*)\\\\t(?:\\\\d+:)?%d(\\\\d+:\\\\d+),"?%t(\\\\d+)"?\\\\t"?%s([^\\\\r\\\\n\\\\t"]*)"?\\\\t"?%a([^\\\\r\\\\n\\\\t"]*)"?\\\\t"?%l([^\\\\r\\\\n\\\\t"]*)"?\\\\t"?%y(\\\\d+)"?\\\\t"?%g([^\\\\r\\\\n\\\\t"]*)"?\\\\t"?%c([^\\\\r\\\\n\\\\t"]*)"?\\\\t"?(?:\\\\d+:)?%d(\\\\d+:\\\\d+),[\\\\r\\\\n]%t(\\\\d+)[\\\\.\\\\s]+%d(\\\\d+:\\\\d+)\\\\s+%s(\\\\S[^\\\\r\\\\n]*\\\\S),<td[^>]*>\\\\s*%t(\\\\d+).</td><td[^>]*>\\\\s*%d(\\\\d+:\\\\d+)</td><td[^>]*>(?:<[^>]+>)?%s([^<\\\\r\\\\n]+),\\\\s*%s(\\\\S[^\\\\r\\\\n]*\\\\S)\\\\s*,\\\\s*%t(\\\\d+)[\\\\.\\\\s]+%s(\\\\S[^\\\\r\\\\n]*\\\\S)\\\\s*,\\\\s*%t(\\\\d+)[\\\\.\\\\s]+%s(\\\\S[^\\\\r\\\\n]*\\\\S)\\\\s+%d(\\\\d+:\\\\d+)\\\\s*,\\\\\\\\item\\\\s+%s(\\\\S[^\\\\r\\\\n]*\\\\S)\\\\s*
(..)
The ExportFormatIdx and ImportFormatIdx do not set the number of entries,
just the index of the entry which will be selected by default. You just
have to make sure to have the same number of strings in
ImportFormatHeaders, ImportFormatNames and ImportFormatTracks.
Regards,
Urs
More information about the pkg-kde-extras
mailing list