IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> Export to csv problem with multiple entries in tags
m4rk
post Feb 22 2012, 10:08
Post #1


Member


Group: Full Members
Posts: 21
Joined: 21-November 11
Member No.: 15609
Mp3tag Version: 2.49



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

This post has been edited by m4rk: Feb 22 2012, 10:08
Go to the top of the page
 
+Quote Post
pone
post Feb 22 2012, 10:42
Post #2


Member


Group: Full Members
Posts: 1688
Joined: 15-March 09
From: Germany
Member No.: 9103
Mp3tag Version: 2.59b



from the help files:
ZITAT
$meta(x)
returns all values of field x (e.g. $meta(artist)). If multiple values of that field exist, they are separated with ", ".

$meta(x,n)

returns the nth value of field x (where n starts at 0, e.g. $meta(artist,1)).

$meta_sep(x,sep)

returns all values of field x (e.g. $meta_sep(artist,; )). If multiple values of that field exist, they are separated with sep.


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



This post has been edited by pone: Feb 22 2012, 10:44
Go to the top of the page
 
+Quote Post
m4rk
post Feb 22 2012, 11:01
Post #3


Member


Group: Full Members
Posts: 21
Joined: 21-November 11
Member No.: 15609
Mp3tag Version: 2.49



QUOTE (pone @ Feb 22 2012, 10:42) *



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 biggrin.gif

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
Go to the top of the page
 
+Quote Post
pone
post Feb 22 2012, 11:14
Post #4


Member


Group: Full Members
Posts: 1688
Joined: 15-March 09
From: Germany
Member No.: 9103
Mp3tag Version: 2.59b



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.

This post has been edited by pone: Feb 22 2012, 11:24
Go to the top of the page
 
+Quote Post
m4rk
post Feb 22 2012, 12:03
Post #5


Member


Group: Full Members
Posts: 21
Joined: 21-November 11
Member No.: 15609
Mp3tag Version: 2.49



QUOTE (pone @ Feb 22 2012, 11:14) *
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.



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

This post has been edited by m4rk: Feb 22 2012, 12:43
Go to the top of the page
 
+Quote Post
pone
post Feb 22 2012, 12:29
Post #6


Member


Group: Full Members
Posts: 1688
Joined: 15-March 09
From: Germany
Member No.: 9103
Mp3tag Version: 2.59b



ZITAT(m4rk @ Feb 22 2012, 12:03) *
Is there a help section to explain how the looping part works? I didn't see it in 'scripting' help section?


yes, in the export help section http://help.mp3tag.de/options_export.html#syntax :
ZITAT
$loop(%fieldname%) starts a new loop. The loop data is sorted by the fieldname.
$loopend() ends a loop.
If you want to limit the loop output to a certain number of entries, simply use $loop(%fieldname%,num). This is useful to eliminate duplicate records (num=1).



So if you have something like
QUELLTEXT
$loop(%_filename_ext%)%title%;%artist%;%album%;
$loopend()

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


Whereas this loop
QUELLTEXT
$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.

This post has been edited by pone: Feb 22 2012, 12:33
Go to the top of the page
 
+Quote Post
m4rk
post Feb 22 2012, 12:45
Post #7


Member


Group: Full Members
Posts: 21
Joined: 21-November 11
Member No.: 15609
Mp3tag Version: 2.49



QUOTE (pone @ Feb 22 2012, 12:29) *
yes, in the export help section http://help.mp3tag.de/options_export.html#syntax :



So if you have something like
CODE
$loop(%_filename_ext%)%title%;%artist%;%album%;
$loopend()

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


Whereas this loop
CODE
$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 cool.gif

Thanks again for your help, Mark

This post has been edited by m4rk: Feb 22 2012, 12:48
Go to the top of the page
 
+Quote Post
m4rk
post Feb 22 2012, 12:51
Post #8


Member


Group: Full Members
Posts: 21
Joined: 21-November 11
Member No.: 15609
Mp3tag Version: 2.49



QUOTE (pone @ Feb 22 2012, 12:29) *
yes, in the export help section http://help.mp3tag.de/options_export.html#syntax :



So if you have something like
CODE
$loop(%_filename_ext%)%title%;%artist%;%album%;
$loopend()

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


Whereas this loop
CODE
$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.
Go to the top of the page
 
+Quote Post
m4rk
post Feb 22 2012, 13:17
Post #9


Member


Group: Full Members
Posts: 21
Joined: 21-November 11
Member No.: 15609
Mp3tag Version: 2.49



QUOTE (m4rk @ Feb 22 2012, 12:51) *
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.



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!!
Go to the top of the page
 
+Quote Post
pone
post Feb 22 2012, 13:40
Post #10


Member


Group: Full Members
Posts: 1688
Joined: 15-March 09
From: Germany
Member No.: 9103
Mp3tag Version: 2.59b



ZITAT(m4rk @ Feb 22 2012, 13:17) *
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!!


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()
Go to the top of the page
 
+Quote Post
m4rk
post Feb 22 2012, 13:54
Post #11


Member


Group: Full Members
Posts: 21
Joined: 21-November 11
Member No.: 15609
Mp3tag Version: 2.49



QUOTE (pone @ Feb 22 2012, 13:40) *
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()


yup, that was it. I learnt a lot quickly today thanks to your suggestions. Thanks, much appreciated cool.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st September 2014 - 03:04