INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: Importing Excel or CSV metadata to tag (multiple) albums  (Read 19942 times)

ted_b

  • World Citizen
  • ***
  • Posts: 117
Importing Excel or CSV metadata to tag (multiple) albums
« on: August 12, 2013, 08:04:51 pm »

Gang,
I have been given this challenge by a record label:
They have a test catalog of 200+ albums (4000 rows of individual tracks), all loaded into an Excel spreadsheet, with columns of tag info (artist, track name, etc etc) that they want to use to tag their files (DSF, FLAC, etc).  Is there a simple (or even sophisticated) way of importing the Excel spreadsheet (or comma-delimited CSV if needed) into JRiver's tagging function?  I'd be very willing to do one album (or even one track) at a time, but only via some sort of copy-paste function (i.e not fat fingering all that info in manually).

Thanks
Ted
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #1 on: August 12, 2013, 08:09:10 pm »

Read through this thread to see if it does what you'll want:

   http://yabb.jriver.com/interact/index.php?topic=78971.0
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #2 on: August 12, 2013, 08:36:13 pm »

Yes, it might.  :)  I don't have either the file name setup nor the Excel spreadsheet examples yet.  I'm worried about two aspects:
1)  DSF format.  I am very successful doing DSF tagging myself, but most of it is either simple tag cleanup or some easy mass tagging tricks like "=[Album] /(DSD/)" expression you taught me back several threads ago. :)  For this project I am also not sure all the tags they want will be ID3V2 capable
2)  The filename will get ridiculously long if there are 15 tag fields with data in them (again, I will post when I know something)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #3 on: August 12, 2013, 08:47:31 pm »

The conversion from a spreadsheet and importing of the data is the easy part.  The challenging part may be the connection between these entries and the physical files.

The metadata in MC is tag format agnostic.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #4 on: August 13, 2013, 12:29:45 pm »

So I got the first two examples from the spreadsheet.  They want these tags:
Label (same for all tracks)
Catalog Number (same for all tracks)
Format (should always be DSD so not sure why this is here)
Product Title (album)
Solo Artist(s)  (usually performer/artist or Orchestra name)
Conductor
Other artists (both my examples are blank, but might need)
Composer(s)
Year of release
Barcode (same for all tracks)
track number
work (major part of typical classical track name, eg Firebird Suite)
movement (unique to each classical track within same movement. eg Introduction)
duration/time
ISRC (unique to each track, often sequential within album)

So....putting all this in a filename could be tough (does Windows have a filename character limitation?).  :)  And not sure how many of these tags are ID3V2 compliant and how many would be TXXX like JRiver's Orchestra or UPC tag.

So, Mr C, could your zip file be modified for DSF (instead of MP3; I assume it is specific to MP3 cuz you mentioned it in the other thread and said if not you'd modify)?  And what to do with the tags that need to be TXXX?  Thanks for any and all help
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #5 on: August 13, 2013, 02:51:39 pm »

All you need to do is:

  - Create a spreadsheet with columns and headers for your fields mentioned above, and save it as a CSV file.

There is no need to (re-)name the files using your tags.

From that spreadsheet, an MC MPL file can be created.  This MPL file can be imported into MC, and MC will create entries for each row, populating the same-named fields.

The field names will come from the column headers.  So you should use existing MC fields where appropriate (e.g. Track #, Catalog, Composer, etc.).  For your labels that don't have MC fields, you need to create those in MC, or the import process will ignore that field and its data.

If you want to map these entries to existing files, then you need to provide a Filename column with the full Windows path to a file (UNC or Drive Letter:\Path).  Otherwise, the import process will create file-less entries - you can use them, but obviously nothing else can be done with the metadata (since there are no files to play, tag, etc.).  If you don't have this path readily available, but it can be reliably created from one or more of the tags in your spreadsheet, than I can have the program construct that path.  It needs to be reliable, or MC will ignore any incorrect or bogus entries.

Once MC has imported these entries, you're free to tag the files using MC's Update Tags (from Library) command, and use the entries just like any other MC item.

Again, my response is based on your statement that you already have this spreadsheet, and you want to have that as the basis of your starting point.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #6 on: August 13, 2013, 04:15:53 pm »

Thanks.  This may be an iterative set of questions, as I don't know what I don't know.

Filename column?  So, for a test I happen to have the album (23 DSF files) that one of these Excel spreadsheets is for (I've owned it for awhile and it is already well tagged but so what, the tags aren't the same text and I'll know if they indeed change).  And I will eventually have ALL the albums for each of these 200 spreadsheets.  So, are you saying that I can't somehow point the XML import to these files, but instead need the spreadsheet (then converted to XML) to have the path name of EVERY track?  Thanks

Second, is it easy to add fields in the tag editor?  Fields like ISRC or barcode, or movement?  And say I add "movement" and populate it from above..I assume this is a non-ID3V2 tag, a TXXX column, and would not be available outside JRIver?  The project needs it available on their website for their search engine.
Thx
Ted
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #7 on: August 13, 2013, 05:04:44 pm »

Understood.

The process and script created was to help users import files that have no existing metadata within the files themselves.  It connects a spreadsheet full of metadata to files, and used the MC import mechanism to populate the field values.  If files already have metadata, there is no need to employ such a process - just import the files.

I've provided a couple of tools to do this.  One just takes the values from a spreadsheet, and constructs the file name from field values such as Artist and Album.  This is useful for users who have their files already located in well-defined paths, such as ...\[Artist]\[Album]\[Track #] - [Name].ext.  Another variant of the tool did a fuzzy match on [Track #], [Artist] and [Name] to help connect each entry with the existing file paths.

The easiest way for you to get a feel for what an MPL is and what values are there is to select a single Album, and do a File > Export Playlist and select the MPL format, choosing to export only the selection.  Save the file to your Desktop and open it with a text editor.  It is really easy to read, and will show how the MC field names and values are mapped.  This same file can be used to both Import new files and to update metadata for existing files.  The key connection is the Filename field, which you'll see in the MPL file.  Without this field, there is no way to associate an MC entry with a physical on disc file.  So, are you trying to just create entries in MC (essentially virtual entities) or are you trying to populate MC metadata for a set of associated files and then do something with those?

It is trivial to create new user fields.  Tools > Options > Library & Folders > Manage Library Fields... and Add a new user field.  Name it exactly as you need, and it should match exactly your column header in the spreadsheet.  This is the only way to match the spreadsheet columns with the MC fields in the MPL file.

You can ignore ID3V2, etc.  The MPL file uses MC's internal fields, not physical tags as stored in files.  MC maps its tags as necessary to the file format's tag types (Vorbis comments, ID3V*, ...).

Again, I understood that you have a spreadsheet (or two) with tag data for tracks, and you want those imported into MC (for what purpose hasn't been explained).  The tool we've been talking about converts a CSV to an MPL file, and MC will readily import from this file to create virtual or real file entries.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #8 on: August 13, 2013, 06:11:13 pm »


Again, I understood that you have a spreadsheet (or two) with tag data for tracks, and you want those imported into MC (for what purpose hasn't been explained).  

?  Let's start over cuz somehow you missed the entire project..my bad.  You seem to think I want to tag files that already have tags.  No, of course not (it was only mentioned in the previous post as a test example cuz I ALREADY have that album).  I'm well aware of simple tagging, sorry.

The record label has 200 Excel spreadsheets they'll send us.  These have the fields/columns I listed above, and have rows of data in them for each album (not all albums have all colums filled..in some cases there is no "conductor" or "other artist" but they want to standardize a setup so as to get other labels involved).  

The record label will send us 200 DSF album folders of tracks that have NO METADATA in them, none.  They are coming from brand new masters that first become DFF then DSF conversions they'll do in Pyramix.  DFF doesn't support metadata.  The most we'll know about them is that they will be numbered 1-x (track number) and will likley use their catalog number as part of the filename, probably something like 1-32130.dsf, 2-32130.dsf, 3-32130.dsf and so on.  

I want to tell them that we could use JRiver to tag all these albums, and tag them without resorting to doing it manually by hand.  Then these albums (200 folders of 4000 DSF tracks total) will be available for sale, downloaded on their retail website someday soon in the near future.  The site will have a search engine that will allow searching for these tags/fields.

So my questions have to do with this scenario:
I have an untagged DSF album in JRiver.  Say it is in M:\DSF\BSO-Stravinsky No 1\(list of 23 tracks and a CSV file)
What are the steps in JRiver to merge the 23 rows of metadata in the CSV file with the 23 tracks of "blank" DSF music files?  I realize I must make sure all the column names exist in JRiver tag fields, whether existing (i.e artist, album) or created by me (movement, etc)

Note:  As a test...I can try it right now cuz I have the CSV file (sent to me this morning as Excel) and I have the 23 tracks already..I just so happen to have them ripped from my SACD of the same recording of the same record label....yes, they ALREADY have tags but I don't care.  It's a TEST!  I can remove them if that makes your response any easier.  I just wann try one album.  I realize it is tagging something that already once had tags, I don;t care!  And no, I will not tag a virtual file or something that does not exist..?...these tags are only meant for their DSF music file!

Thanks

P.S.  We'd likely rename the filenames once done, to something understandable like "track#-artist-album-name.dsf"

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #9 on: August 13, 2013, 07:00:27 pm »

I don't know where you got the idea I thought your files already had tags. :-)  The entire goal of what we've talked about was taking data from a spreadsheet and using that data to apply to the files as the tags.

What would be most helpful to your cause is to show an example row and its corresponding file name.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #10 on: August 13, 2013, 07:35:23 pm »

I don't know where you got the idea I thought your files already had tags. :-)  

Because you started the last post with this:


The process and script created was to help users import files that have no existing metadata within the files themselves.  It connects a spreadsheet full of metadata to files, and used the MC import mechanism to populate the field values.  If files already have metadata, there is no need to employ such a process - just import the files.

Seemed you either thought I was forgetting what you already said earlier?  or thought my files already had metadata.

The entire goal of what we've talked about was taking data from a spreadsheet and using that data to apply to the files as the tags.

Yes!

What does a spreadsheet row look like?  It can look anyway you tell me.  That's one of the things I'm asking for.  I can put the columns in any order you need.  I can't show them here cuz they are 15 columns wide, with some columns (like work or movement) having long entries.  Here's an ugly copy (not sorted for good reading) of the first two rows of the CSV file:
Label,Catalogue Number,Format,Product Title,Solo Artist(s),Conductor(s),Other Artist(s),Composer(s),Year of Release,Genre,Barcode,Track Number,Work,Movement,Duration,ISRC,,,,,,,,,,,,,,,
Channel Classics,32112,DSD,"Rite of Spring, Firebird Suite, Scherzo, Tango",Budapest Festival Orchestra,Ivan Fischer,,Igor Stravinsky,2012,Classical,723385321125,1,Rite of Spring: Adoration of the Earth (Part 1),Introduction,3.28,NLA460911988,,,,,,,,,,,,,,,
Channel Classics,32112,DSD,"Rite of Spring, Firebird Suite, Scherzo, Tango",Budapest Festival Orchestra,Ivan Fischer,,Igor Stravinsky,2012,Classical,723385321125,2,Rite of Spring: Adoration of the Earth (Part 1),The Augurs of Spring: Dances of the Young Girls,3.17,NLA460911989,,,,,,,,,,,,,,,

We can name the associated DSF music files whatever you need us to (the record company is creating them for us).  For now I assume they will come over as "1-32112.DSF" and "2-32112.DSF" unless told otherwise.  There will be 23 of them for this album (I hate repeating myself but somehow we are not communicating), just like the 23 rows of metadata in the CSV file.

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #11 on: August 13, 2013, 08:02:07 pm »

I can't give you a How yet, until I see the What.  Now I've seen some.

So it appears your files will be named in the form of [Track #]-[Catalogue Number].DSF.  Where will these files live?  I have to modify the script to accommodate your path naming scheme.  This will allow it to output the Filename field for you, so that MC can find the files.  Otherwise, you have to add a Filename column to your spreadsheet it it will need to specify a full path to the file.  Your choice.

Go through each of your column header names, and be sure these are what you want.  Again, find the corresponding field names in MC, and use those whenever possible (e.g. Track Number --> Track #, Composer(s) --> Composer, etc.).

FYI: You can attach a CSV file to your posts (you may need to zip it or modify the suffix to (or add an extra) .txt.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #12 on: August 13, 2013, 08:55:49 pm »

MrC, thanks!  I decided the recording editor could use a break, so I picked a short file naming convention he could easily type while editing (i.e DSD rendering the edit master).  So I chose a unique aspect of each track (track #) and unique aspect of each album (catalog #).  Easy to type 1-30122.

I do not currently know the path yet.  It may not be mine except for testing.  But I think I can edit the script easy enough, right?  I mean isn't it part of the perl cmd line? 

As far as using as many standards as possible, I just got off the phone with my Grammy-winning recording engineer (acting as editor here  :) ) and he says we can convince the boss to rename whatever we need.  And maybe we don;t need all the barcode/ISRC stuff either, dunno yet.  My biggest challenge is making sure we have enough standard stuff that will cross platforms and players (their download customers aren't going to all be using JRiver, although we wish  :)  ). 

One big issue is this idea of work (Firebird Suite)-movement (Introduction) which most classical tags show simply as track name (Firebird Suite -Introduction).  Not sure what we'll do.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #13 on: August 13, 2013, 09:25:19 pm »

So here's an example of the output:

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<MPL Version="2.0" Title="Created from ./csv2mpl.pl">
<Item>
<Field Name="Label">Channel Classics</Field>
<Field Name="Catalog #">32112</Field>
<Field Name="Format">DSD</Field>
<Field Name="Product Title">Rite of Spring, Firebird Suite, Scherzo, Tango</Field>
<Field Name="Solo Artist(s)">Budapest Festival Orchestra</Field>
<Field Name="Conductor(s)">Ivan Fischer</Field>
<Field Name="Composer(s)">Igor Stravinsky</Field>
<Field Name="Year of Release">2012</Field>
<Field Name="Genre">Classical</Field>
<Field Name="Barcode">723385321125</Field>
<Field Name="Track #">1</Field>
<Field Name="Work">Rite of Spring: Adoration of the Earth (Part 1)</Field>
<Field Name="Movement">Introduction</Field>
<Field Name="Duration">3.28</Field>
<Field Name="ISRC">NLA460911988</Field>
<Field Name="Filename">C:\mediapath\1-32112.DSF</Field>
<Field Name="Media Type">Audio</Field>
</Item>
</MPL>

I changed Track Number and Catalogue Number as mentioned above.  The Filename field is generated from a simplistic, hardcoded template based on Track #-Catalog #.  The basepath is hardcoded as "C:\mediapath" until you figure out where items will be located.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #14 on: August 13, 2013, 09:39:38 pm »

Thanks.  So if you would, could you walk me thru the process I would go through (once I make sure the fields exist in MC)?  Do I run this script from the same 'mediapath" parent directory as the music?  Is ActivePerl required?  Is this similar to your perl script on the other thread?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #15 on: August 13, 2013, 09:49:37 pm »

The script requires ActivePerl. Its free, safe, easy, and non-invasive to install. Get the 32- or 64- bit installer for your version of Windows.  Or you can use Cygwin tools, but I'll assume ActivePerl.

This is a command line perl script.  It runs via a Windows command shell (cmd.exe) as follows:

   perl csv2mpl.pl path\to\file.csv

where the path to file.csv is replaced by the path to your CSV file.  You can run the script from anywhere, but will likely find it easy to place it on your Desktop or in the root of the drive.

I've simplistically hardcoded the two fields used to construct the Filename field and the basepath at the top of the file:

   my $basepath = 'C:\mediapath';
   my $filename_p1 = 'Track #';
   my $filename_p2 = 'Catalog #';

You can change these values, but the values must exactly match the columns in the CSV, and of course fields in MC.

As you run it and test out the values, and find change needs, let me know.  To redirect the output to an MPL file that you can Import, just add:
   
   > filename.mpl

to the end of the command.  Use MC's File > Import Playlist command to import that file.  it will import the referenced files, and apply the fields from the MPL.  If the file does not import, it is because the file doesn't exist, or can't be found by MC due to path or file name problems, or because there is some other quick in the MPL that needs to be addressed.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #16 on: August 13, 2013, 09:56:13 pm »

Thanks!  I will try my first conversion tmrw when the actual test DSF files arrive to me (rather than trying the existing ones I have, cuz then I'd first have to rename them, etc etc).  I still need to fix some fields/tags mapping inaccuracies.  I'm excited that this will save us HUGE amounts of time.  Thanks again!
Logged

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #17 on: August 14, 2013, 03:55:51 pm »

MrC, I think I'm getting there.  I've standardized Excel column names as well as possible, added any that are needed in MC, created the CSV and gotten all new 23 DSFD files.  A couple of questions:
1)  The files came across as track#_catalog#.dsf instead of hyphen.  Should I change the filenames (and alert the label) or is it fixable by me somewhere in the script?
2)  You mention to put the path name in the cmd line, but also said one is hard coded in the script (and I see it).  Should I do one or the other?  Dos the path mentioned in the cmd line supercede the script's hard coded one?
3)  You mention to put >filename.mpl if I want the results truly created into an MPL file.  If I don't do that at first, where are the changes going?  What will I see?
4)  Do the raw untagged DSF music files need to be already imported to MC before doing this (i.e should I be doing this in a pathname that is an auto-imported "watched" MC folder).  I added R:\Test\
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #18 on: August 14, 2013, 04:33:27 pm »

Sounds like you're making progress.

1. You can change the script.  Change this line:

    print_mpl '<Field Name="Filename">', join('\\', $basepath, "$fp1-$fp2.DSF"), '</Field>';

to

    print_mpl '<Field Name="Filename">', join('\\', $basepath, "$fp1_$fp2.dsf"), '</Field>';

Note the DSF -> dfs and dash to underbar changes.

2. This version of the script does not accept a command line argument.  It is more difficult to pass path names, and is more error prone, so just change the value of $basepath in the script.  I would assume that basepath will depend upon the album you are working with.  Can the path be calculated from existing fields?  Ideally, you'd have one large spreadsheet with all the values inside for all your albums, and that spreadsheet's values would be used to calculate this path (e.g. ...\Some Static Base Path\Artist\Album), and this would results in a single MPL you can import.  Or you'd drive the script recursively on your folders of music, and that driver script would pass in the base path, and this would create many MPLs (each requiring import).  What would be easiest for you?

3. If you don't redirect, the output just goes to the command window.  There are no changes made anywhere.

4. The files do not need to be imported.  MC will import them, so long as the Filename field is valid, and tag them according to the data in the MPL.  If the files are already imported, only the field data is changed when you import the MPL.  So its one of:

   - Import and apply field values
   - Apply field values only
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #19 on: August 14, 2013, 05:26:38 pm »

2. This version of the script does not accept a command line argument.  It is more difficult to pass path names, and is more error prone, so just change the value of $basepath in the script.  
So cmd line should NOT include path?  So this "perl csv2mpl.pl 32112.csv"?

I would assume that basepath will depend upon the album you are working with.  Can the path be calculated from existing fields?  Ideally, you'd have one large spreadsheet with all the values inside for all your albums, and that spreadsheet's values would be used to calculate this path (e.g. ...\Some Static Base Path\Artist\Album), and this would results in a single MPL you can import.  Or you'd drive the script recursively on your folders of music, and that driver script would pass in the base path, and this would create many MPLs (each requiring import).  What would be easiest for you?

My idea of workflow is this:
Use R:\Test as pathname and simply change the csv file name as appropriate.  Once an album is successfully tagged we rename the files to "track#-artist-album-name" (and stick them into an artist-album folder sometime later).  But their renaming will make them ineligible for any accidental script changes, right, even if they stay in Test for awhile?

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #20 on: August 14, 2013, 05:50:16 pm »

No, this script does not take a basepath as an argument.  If you'd like one, I can add it for you.

Since the Filename field is calculated from your track # and catalog #, once you rename the files, MC won't find them, unless you do the Rename in MC using the Rename tool.

The script never touches your files.

It seems your workflow seems very manual and multi-step (and hence error-prone).  The more automation you can use, not only is the process faster, but more reliable.  Just something to consider.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #21 on: August 14, 2013, 06:13:44 pm »

No, this script does not take a basepath as an argument.  If you'd like one, I can add it for you.
No, not asking you to add anything.  Just wanna know what to type.  Short of that I am confused again.  You wrote this in reply yesterday:
"perl csv2mpl.pl path\to\file.csv where the path to file.csv is replaced by the path to your CSV file"

but now you are saying "no, this script does not take a basepath as an argument.  What should I type then?  And if it includes the pathname, then why is it also hardcoded in the script at all?  Do I type
perl csv2mpl.pl R:\Test\32112.csv

Since the Filename field is calculated from your track # and catalog #, once you rename the files, MC won't find them, unless you do the Rename in MC using the Rename tool.

Yes, I am saying that after all the tagging to the album (say 32112) is done I would rename the files to something readable..using the MC renaming function.  Then they would be moved out of the Test folder to another MC library folder.

It seems your workflow seems very manual and multi-step (and hence error-prone).  The more automation you can use, not only is the process faster, but more reliable.  Just something to consider.
Yes, would love to automate.  That's why I am asking.  But I will not have a CSV with 4000 entries, but instead 200 of them with 15-25 rows each.  Moreover,  I will get the DSF files on a slow regular basis once they are created.  So I need to do this on an album by album basis.   Any and all ideas welcome.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #22 on: August 14, 2013, 06:19:07 pm »

The path to the CSV file is not the same as the $basepath variable in the script.  The basepath will be initial part of the Filename field's value.  The path to the CSV file tells csv2mpl.pl where to find the CSV file.  The two currently have nothing to do with each other (your CSV file might be on the Desktop, and your audio files in R:\Test).

I could make one be derived from the other, so that:

   perl csv2mpl.pl R:\Test\32112.csv

would create a basespath of "R:\Test".  In otherwords, it would always default to using the same location as the CSV file.
   
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #23 on: August 14, 2013, 06:42:10 pm »

Got this:
C:\tedtemp>perl csv2mpl.pl R:\Test\32112.csv >32112.mpl
Can't locate Text/CSV.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .)
 at csv2mpl.pl line 5.
BEGIN failed--compilation aborted at csv2mpl.pl line 5.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #24 on: August 14, 2013, 06:54:58 pm »

Sorry, I forgot you need a module installed.  In the command shell, type:

   ppm install Text-CSV

and hit Enter.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #25 on: August 14, 2013, 07:08:58 pm »

C:\tedtemp>perl csv2mpl.pl R:\Test\32112.csv >32112.mpl
Semicolon seems to be missing at csv2mpl.pl line 46.
syntax error at csv2mpl.pl line 47, near "CS

print_mpl "
Global symbol "$fp1_" requires explicit package name at csv2mpl.pl line 64.
Execution of csv2mpl.pl aborted due to compilation errors.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #26 on: August 14, 2013, 07:10:50 pm »

Check how you modified the script very carefully.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #27 on: August 14, 2013, 07:22:29 pm »

My changes were simply to line 64 (changed dash to underscore, and DSF to dsf) and then changed basepath variable to R:\Test

I changed it back to a dash, renamed the files with a dash, reimported the files, and ran again.  Here's where we are now:

C:\tedtemp>perl csv2mpl.pl R:\Test\32112.csv >32112.mpl
Semicolon seems to be missing at csv2mpl.pl line 46.
syntax error at csv2mpl.pl line 47, near "CS

print_mpl "
Execution of csv2mpl.pl aborted due to compilation errors.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #28 on: August 14, 2013, 07:24:08 pm »

I downloaded the script and both ran it and compared it against my own, so something is different.  Can you zip your version and attach here?
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #29 on: August 14, 2013, 07:41:32 pm »

Will do.  I re-downloaded the script, made the lowercase dsf and R:\Test changes only, then reran.  Now here's what I got!

C:\tedtemp>perl csv2mpl.pl R:\Test\32112.csv >32112.mpl
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 25.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 25.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 26.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 26.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 27.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 27.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 28.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 28.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 29.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 29.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 30.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 30.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 31.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 31.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 32.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 32.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 33.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 33.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 34.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 34.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 35.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 35.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 36.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 36.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 37.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 37.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 38.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 38.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 39.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 39.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 40.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 40.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 41.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 41.
Use of uninitialized value $fp1 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 42.
Use of uninitialized value $fp2 in concatenation (.) or string at csv2mpl.pl lin
e 64, <CSV> line 42.

It's as if the script is seeing additional rows with no metadata and throwing up.  The mpl looks good, otherwise (attached).  Should I simply delete the additional rows in the mpl?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #30 on: August 14, 2013, 07:48:16 pm »

It does appear that there is probably additional garbage at the end of the CSV (lines 25 through 42).  I didn't bother doing a lot of sanity checking, as the script was basically a one-shot.  Have you checked for extraneous lines?

$fp1 and $fp2 are your Track # and Catalog # cell values, so if they are empty, the script will complain.  The should never be empty, or your MPL entries won't map properly to your file names.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #31 on: August 14, 2013, 08:06:15 pm »

I cleaned up the CSV and ran again.  Script ran cleanly, no errors or comments.  All is well (need to name the "Year of release" column to year not date, no big deal)
EXCEPT:
* tracks 1-9 are not getting the tags in MC.  Tracks 10-23 are great!!!!

I am thinking maybe that someone (MC, script, CSV) is looking for a two digit track number?  i.e 01, 02, 03?

Also, why do I need to set PATH=C:\Perl\bin%PATH% each time I get out and re-fire-up command line.  Isn't setting a path permanent?  Supposedly ActivePerl sets path to ProgramFiles\Perl even though one does not exist, and it didn't install there...but that's just what I found out googling the problem.  No idea really.

Anyway, we are wayyyyy well along.,  Thank you so much for all of this!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #32 on: August 14, 2013, 08:10:47 pm »

Great.

The script reads the tracks numbers from the CSV, and is outputting them as MC wants them (no leading 0's).

   <Field Name="Track #">3</Field>

It is computing the Filename without padding the Track #:

   <Field Name="Filename">R:\Test\3-32112.dsf</Field>

Do you need them zero-padded to two or N digits to match your files names?

As for the PATH, when you installed ActivePerl, it should have been installed as an Admin user, so that the installer can modify your PATH in Windows.  You can manually do that (Right-click Computer > Advanced system settings > Advanced > Environment Variables).

ActivePerl 32-bit will be installed in the C:\Perl directory.  64-bit will be installed in C:\Perl64.  So make sure your environment variables are pointing to the right place.  Perhaps you downloaded a different version of perl for your arch. or didn't allow the path to be changed?
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #33 on: August 14, 2013, 08:50:18 pm »

Thanks, yes it was my filenames.  I will ask if they can get them to me as 1-xxxx (instead of 01_xxxx).

Perl fixed...thanks for the tip!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #34 on: August 14, 2013, 09:04:18 pm »

OK, great.

The change is trivial to zero-pad.  Just add the following red line above the line you changed earlier.

    $fp1 = sprintf "%02d", $fp1;
    print_mpl '<Field Name="Filename">', join('\\', $basepath, "$fp1-$fp2.DSF"), '</Field>';

It will zero-pad to always output two digits.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #35 on: August 14, 2013, 09:08:14 pm »

Is that ok even if the spreadsheet has one digit for tracks 1-9 (which it does)?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #36 on: August 14, 2013, 09:09:21 pm »

No, it will always pad.  The only way to resolve that problem would be to test for the presence of the file using both formats.  That's not hard if it helps...
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #37 on: August 14, 2013, 09:40:44 pm »

So...now that the tagging worked, with some of the tags being ID3V2-compliant, how do I get these tags to stick (meaning when I take these files and load them in Audiogate or Foobar the tags (even the simple artist, album, etc) do not show up.  When I use my own SACD rips (DSF) of the same album, and added my owns tag edits, etc (changed album name from "Stravinsky" to "Stravinsky (DSD)" they show up on other players fine. 
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #38 on: August 14, 2013, 09:44:08 pm »

Try Update Tags (from library).
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #39 on: August 14, 2013, 09:50:54 pm »

Try Update Tags (from library).

Bingo!  You da man!  :)
Logged

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #40 on: August 15, 2013, 04:27:29 pm »

MrC, I can't tell you how grateful we are for this script, and your help and guidance.  Thanks

One addtl question:  if we decide work and movement (which is now called "name" in MC and CSV as it acts the most like a typical track name) need to be combined, could your script do that, or maybe I should just look at an Excel function?  Firebird Suite (work) is too general, and Introduction (Movement) is too specific, but that example is too easy; when data in each field is MUCH longer the combined track name could get a bit much.  That's what we are fighting.... thx
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #41 on: August 15, 2013, 07:17:27 pm »

You're welcome, and it is good to hear you're make progress.

I can't advise about how you should format your work and movements, but can provide some guidance to make some decisions.

1. It is easy to combine values automatically in MC; it is the splitting of a combined linguistic value that can be hard or impossible due to ambiguities in language and varying standards.  So use well-defined fields and populate them with the components, and then build up a larger piece when necessary.

2. If you are going to use a combined value, construct it in such a way that software can automatically split it apart.  Consider the ambiguity, for example, of detecting the first name and the last name from Firstname Lastname when either name consists of multiple parts.  It is better to combine as: Firstname_Lastname or Lastname, Firstname.  Tangentially, consider when a Band name is valid instead of a first and last name (e.g. The Beatles, Tom Petty and the Heartbreakers, The The).

3. Consider the final destinations for the tags - which players can and will display various values, and how are they displayed?

4. How will the end result be used for external look-ups (artwork, wiki, AMG, etc.)?

5. Don't drive yourself nuts with Classical naming strategies.  Classical-ists have had centuries to work on this, and have at best produced arcane, bizarre and wholly unworkable schemes littered with the minutiae of eccentric madmen and egotists desirous of leaving their mark.  :-)  But if you decide to forge ahead to conquer this, have a look at these:

   http://yabb.jriver.com/interact/index.php?topic=45824.0
   http://thewelltemperedcomputer.com/SW/Players/JRiver/Classical.htm

Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #42 on: August 15, 2013, 08:35:50 pm »

MrC, LOL on the description of classical-ists.  Made me laugh out loud.  :)

Yes, we are discussing all these aspects already.  My question was simply about HOW one would combine fields or values in MC, if we decide.  Can you point me in a direction to do some Wiki reading or whatever?  Thanks again
Ted
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #43 on: August 15, 2013, 09:06:13 pm »

Here's the entire expression language:

    http://wiki.jriver.com/index.php/Media_Center_expression_language
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #44 on: August 16, 2013, 09:28:59 am »

Thanks.  Ok, one hopefully final request:
*  I thought I had nailed the duration format thing but I guess not.  They send over the duration as (example) 18.40  meaning 18min and 40 sec.  I edited the times to have a colon instead, and made the Excel column/cells a time format (excel thinks it's a clock time but MC seems ok with it).  Seemed to be fine, except that the label does not really want to edit all 4000 rows of their spreadsheets if they don't have to, and if they did, I think it would need to be input as 0:18:40 and custom format of [mm]:ss
  

Is there a way, in the script, to take everything left of the dot and make it minutes, and everything right of the dot and make it seconds?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #45 on: August 16, 2013, 11:52:32 am »

Duration needs to be in seconds.  MC will calculate the value as well, so really it isn't necessary.

Send me CSV with the entry so that I can see the raw data that needs to be converted.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #46 on: August 16, 2013, 12:06:19 pm »

So, although my solution was working, not sure why; my solution was not seconds, it was 18:40  which Excel thinks is 6:40pm but it was tagged as 18min 40 sec in MC...but anything over 24 didn't.  But it was easier for me, all I had to do was re-enter 23 cells in ONE spreadsheet.  

Duration needs to be in seconds.


This means the label folks need to manually re-enter all their 4000 durations in seconds, so nevermind.  They have a BOATLOAD of work to do.

Seems weird that MC needs 18:40  in the duration field to be entered as 1120 sec?
Here is a sample csv where the duration is their unedited min(dot)sec format.

Thx
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #47 on: August 16, 2013, 12:23:45 pm »

Excel automatically does some Date/Time conversion if value looks like date and / or time values.  So when your folks enter 18:40, it converts this into an internal Date/Time format similar to how MC does for Date fields.

I'd say, leave the Duration field out, as it isn't going into the tags anyway.  MC calculates this value.
Logged
The opinions I express represent my own folly.

ted_b

  • World Citizen
  • ***
  • Posts: 117
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #48 on: August 16, 2013, 12:33:27 pm »

Ah really!!  :)  MC will calculate based on file size and sample rate, etc?  Excellent!  Do you think this is true for other players as well?  (They are concerned about more than JRiver's playback capabilities)

So if we leave it in, will MC override it anyway?   I'm wondering - if the label wants it in their spreadsheet for other reasons...we could simply give it a non-field name (like time or something) and the script and import will leave it alone, right?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Importing Excel or CSV metadata to tag (multiple) albums
« Reply #49 on: August 16, 2013, 12:45:54 pm »

I'd believe that all players can determine the duration based on the flie format.  It doesn't need to be a tag, as the file spec indicates the value.

If you leave it in, and MC uses the value, it will leave the value alone until it re-reads the file in the future, as in Update Library (from tags), or an import.

You could change the name of your duration field and import it.
Logged
The opinions I express represent my own folly.
Pages: [1] 2   Go Up