https://bugs.kde.org/show_bug.cgi?id=426460

--- Comment #1 from Urs Fleisch <uflei...@users.sourceforge.net> ---
The import format "CSV quoted" can only be used if the export was using the
format "CSV quoted" without modifications, and the same is true for other
formats which are present in both the import and the export dialogs. You are
using a custom format for the export

%{track}\t%{tracks}\t%{title}\t%{artist}\t%{album}\t%{year}\t%{comment}\t%{file}

and therefore you need a corresponding custom format for the import

%{track}([^\r\n\t]*)\t[^\r\n\t]*\t%{title}([^\r\n\t]*)\t%{artist}([^\r\n\t]*)\t%{album}([^\r\n\t]*)\t%{year}([^\r\n\t]*)\t%{comment}([^\r\n\t]*)\t

Note that the import formats are more complicated than the export formats,
basically, they are regular expressions with "%{framename}" expressions before
the captures to give the name of the frame where the captured values have to be
set. Only frames can be imported, other things which can be exported (in your
case "tracks" and "file") cannot be imported, in the format given above I have
not used a capture group in these positions, just "[^\r\n\t]*\t" to skip the
values.

The use of regular expressions makes the import quite flexible but also hard to
use. If you just want to import and export CSV files, I recommend using the
"Export CSV" and "Import CSV" actions, which are available in the context menu
of the file list. These functions are less flexible than the "Export" and
"Import" dialogs available from the "File" menu, but they have a few
advantages:

- They export and import all frames (not only the set of "standard frames") in
all tags (e.g. both ID3v1 and ID3v2).
- They can encompass the files of multiple folders, not only of the current
folder.
- The file paths are exported too and when being imported again, they are
correctly matched. If no file can be matched, the file paths are ignored, so it
is also possible to import after the file names have been changed.

Both actions are realized by QML-scripts, you can find them in
qml/script/ExportCsv.qml and qml/script/ImportCsv.qml below the Kid3
installation folder (kid3.app/Contents/Resources/ on macOS). So you could copy
these scripts to adapt them to your needs.

To match the columns to the frame names, a header line is needed in the CSV
files used by "Import CSV". You could add the following header line to your
example tracklist_tracks.txt to make it importable by "Import CSV":

track   Duration        title   artist  album   date    comment Duration

Note that the fields are separated by TAB characters and the use of "Duration"
for the columns which have to be skipped, which is a hack because it can be
seen from the source code ImportCSV.qml that columns with header "Duration" are
skipped.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to