Welcome Guest

Pages: 1 2
Simplest way to write selected metadata to file
CarlinSmithPostDecember 7, 2025, 15:51
Beginner
Posts: 48
Registered:
January 1, 2020, 15:15
Hot topicSimplest way to write selected metadata to file
Quote from 2MR2 on September 11, 2025, 11:30

You're fast 🙂

I just modified my sample to sort.

Download: https://2manyrobots.com/actions/Batch-Export-Fields-to-Text-File.zip

I have been using this script frequently with downstream AI and Python scripts for analytics and quality checks.

I most commonly use an export set of Artist,Album,Track per line. However if any of those fields already contain commas the resulting CSV will be interpreted as more than 3 columns since the inside field level columns are not wrapped with quotes which I think is the standard for CSV.

Thoughts on this?

PS wrote some python code to deal with it after the fact but that is a little messy.

2MR2PostDecember 7, 2025, 16:09
Avatar photo
Administrator
Posts: 2387
Registered:
August 23, 2012, 19:27
Hot topicSimplest way to write selected metadata to file

The action produces a TSV file, ... not a CSV file. Nothing need be quoted in a TSV file. We modify the tabs to be commas after the fact. If I remember correctly, I think you wanted a plain text file.

If you want a CSV file produced. I can modify the action to produce a well formed CSV. CSV files do not require every item to be enclosed in double quote characters ... only those which are necessary.

The sorting will be a little more difficult, but other than that it's a minor change.

Let me know.

CarlinSmithPostDecember 7, 2025, 16:59
Beginner
Posts: 48
Registered:
January 1, 2020, 15:15
Hot topicSimplest way to write selected metadata to file

Yeah if not too much trouble prefer CSV

CarlinSmithPostDecember 7, 2025, 17:06
Beginner
Posts: 48
Registered:
January 1, 2020, 15:15
Hot topicSimplest way to write selected metadata to file

actually don't worry about I just changed my downstream python code to use TSV files

2MR2PostDecember 7, 2025, 17:07
Avatar photo
Administrator
Posts: 2387
Registered:
August 23, 2012, 19:27
Hot topicSimplest way to write selected metadata to file

Still quicker than me 🙂

2MR2PostDecember 7, 2025, 17:10
Avatar photo
Administrator
Posts: 2387
Registered:
August 23, 2012, 19:27
Hot topicSimplest way to write selected metadata to file

There is no header line in the produced TSV file. We were shootiong for a text file. Ensure that your Python code is not dropping the first line.

CarlinSmithPostDecember 7, 2025, 17:13
Beginner
Posts: 48
Registered:
January 1, 2020, 15:15
Hot topicSimplest way to write selected metadata to file

I did that for once I am ahead of you!

My python code takes a command line parm to indicate presence of header line or not

Andy SPostDecember 8, 2025, 11:12
Newbie
Posts: 20
Registered:
May 11, 2017, 11:33
Hot topicSimplest way to write selected metadata to file
Quote from CarlinSmith on December 7, 2025, 15:51

However if any of those fields already contain commas the resulting CSV will be interpreted as more than 3 columns […]

In python, importing the csv library module and using its csv.DictReader class, the data in your csv file gets parsed properly, no matter if fields contain commas and/or quotes.

Pages: 1 2
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.052 seconds.