Export to csv problem with multiple entries in tags


#1

Hi,

I am successfully exporting my collection details to csv and can bring it into excel. I use | as a deliminator. (The default ; didn't work because too many titles have that too). Some of my tags have multiple entries, typically genre, and use // as separator for them. The exported file seems to drop anything after // in genre so I only get the first genre item in the csv

Can I do anything fix this?

Thanks Mark


#2

from the help files:

http://help.mp3tag.de/main_scripting.html#metadata


#3

Hi thanks for that.... looks I need help for the help files!! I have no idea what that all means. It is fun learning though :smiley:

The more I use mp3tag the more I am impressed with it. You can do just about anything but it takes quite a bit learning for a novice and much testing to figure it out.

Thanks, I think that has pointed me in the right direction


#4

When you are exporting your tags, you are using an export script.
Open that script and replace all instances of %genre% with $meta(genre)
You have to do this with all tag fields where you have multivalue tags.


#5

Great, that tip helps a lot.

I had found the export scripts and made a simple change. I changed the default delimiter and saved it as a new script but I must admit to being a bit clueless as to how they worked. Is there a help section to explain how the looping part works? I didn't see it in 'scripting' help section?

Mark


#6

yes, in the export help section http://help.mp3tag.de/options_export.html#syntax :

So if you have something like

$loop(%_filename_ext%)%title%;%artist%;%album%;
 $loopend()

the loop writes %title%;%artist%;%album%; + linebreak for every new %_filename_ext%.

Whereas this loop

$loop(%album%)%albumartist%;%album%;%year%
 $loopend()

would write %albumartist%;%album%;%year% + linebreak for every new %album%. So it would skip all files with the same %album% value after writing the values of the first file.


#7
QUOTE (pone @ Feb 22 2012, 12:29) <{POST_SNAPBACK}>
yes, in the export help section http://help.mp3tag.de/options_export.html#syntax :

So if you have something like

$loop(%_filename_ext%)%title%;%artist%;%album%;
 $loopend()

the loop writes %title%;%artist%;%album%; + linebreak for every new %_filename_ext%.

Whereas this loop

$loop(%album%)%albumartist%;%album%;%year%
 $loopend()

would write %albumartist%;%album%;%year% + linebreak for every new %album%. So it would skip all files with the same %album% value after writing the values of the first file.

Thanks, I now have it working

eg

FLAC tag genre like this:

R&B\Soundtrack\Rock

Replaced %genre% with $meta_sep(genre,\) in csv export script

now xls import of resultant csv has

R&B\Soundtrack\Rock
in genre column

Perfect :sunglasses:

Thanks again for your help, Mark


#8
QUOTE (pone @ Feb 22 2012, 12:29) <{POST_SNAPBACK}>
yes, in the export help section http://help.mp3tag.de/options_export.html#syntax :

So if you have something like

$loop(%_filename_ext%)%title%;%artist%;%album%;
 $loopend()

the loop writes %title%;%artist%;%album%; + linebreak for every new %_filename_ext%.

Whereas this loop

$loop(%album%)%albumartist%;%album%;%year%
 $loopend()

would write %albumartist%;%album%;%year% + linebreak for every new %album%. So it would skip all files with the same %album% value after writing the values of the first file.

Again very useful info. I was having to use Excel Office 2007 and the 'remove duplicates' function to create a simple list of albums and their genres.


#9

Maybe I am pushing my luck too far today...

$filename(csv,utf-16)|Album|Genre|
$loop(%album%)|%album%|$meta_sep(genre,\)|
$loopend()

I was hoping this would produce a single line per album but its giving all tracks for the same album!!


#10

Looks like I forgot something in my examples.

$loop(%album%) only sorts your files by %album%
$loop(%album%,1) sorts your files by %album% and does only write one entrie per %album%.

So try this:

$filename(csv,utf-16)|Album|Genre|
$loop(%album%,1)|%album%|$meta_sep(genre,\)|
$loopend()


#11

yup, that was it. I learnt a lot quickly today thanks to your suggestions. Thanks, much appreciated :sunglasses: