INTERACT FORUM

Please login or register.

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

Author Topic: Importing from csv files?  (Read 3464 times)

zxsix

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1753
Importing from csv files?
« on: January 01, 2006, 03:56:26 pm »

I have a large database of video files in Microsoft Access format.
I'd like to import this into MC.
Can I export a delimited text file of the desired fields and import that into MC like a playlist could be?
Logged

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Re: Importing from csv files?
« Reply #1 on: January 01, 2006, 04:13:03 pm »

MC can import file lists that contain all library fields only in MPL format (XML).

You could export a playlist that contains tagged video files in MPL format and check how the file is constructed.

For importing data from Access you would need to create an Access report that is in the same format MC uses.
Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Re: Importing from csv files?
« Reply #2 on: January 01, 2006, 08:05:27 pm »

For importing data from Access you would need to create an Access report that is in the same format MC uses.

Rather, he needs to export his Access database as an XML file and then transform it to an MPL.  It is very simple for those that know XSLT.

I'd get excited about building some XSLT transforms, but JRiver hasn't opened up their import/export functionality to make it widely usable.  Export is possible with the great (but stalled) MC XML Export plugin.
Logged

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Re: Importing from csv files?
« Reply #3 on: January 01, 2006, 08:36:22 pm »

Rather, he needs to export his Access database as an XML file and then transform it to an MPL. It is very simple for those that know XSLT.

Actually, I meant any kind of exporting the selected data and formatting the output with the internal and/or external tools. I thought the word "report" was commonly used for any data exported from a database program in a structured format.

Personally, I have not used Access for anything serious. Years ago I used dBase 4, but currently Excel tables are enough for my smallish database needs.
Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755

IlPadrino

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 496
Re: Importing from csv files?
« Reply #4 on: January 02, 2006, 12:11:57 am »

Actually, I meant any kind of exporting the selected data and formatting the output with the internal and/or external tools. I thought the word "report" was commonly used for any data exported from a database program in a structured format.

Personally, I have not used Access for anything serious. Years ago I used dBase 4, but currently Excel tables are enough for my smallish database needs.

A "Report" in Access is something very specific - and it doesn't relate to exporting.  I've never heard of the term "report" in reference to an export of relational data...  but there's no sense in being pedantic about it.  Bottom line:  Access 2003 allows you to export relational data as XML.  If the database schema is already "flat" then it is trivial to convert the exported XML to an MPL.

In fact, there's already been an XSLT developed that coverts an MPL to XML ready for import into Access.  In order to import XML into Access, it has to conform to an appropriate schema - but it is trivial.
Logged

zxsix

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1753
Re: Importing from csv files?
« Reply #5 on: January 02, 2006, 09:42:25 am »

I got it working using XML.
The only problem remaining, is that it rejects the movies that are on DVD discs (offline content) and imports only the movies that are online on the hard drive.
Logged

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Re: Importing from csv files?
« Reply #6 on: January 02, 2006, 12:04:47 pm »

I got it working using XML.
The only problem remaining, is that it rejects the movies that are on DVD discs (offline content) and imports only the movies that are online on the hard drive.

You could try Tolga's trick:

For those who maybe trying to hack data into MC, I noticed that MC ignores filename check in MPL files if the filename starts with http://

The filenames should be still unique, so you can add arbitrary records to MC by having files names of the format:

http://unique-ID

I am proud to browse procite database within MC now.

My dream is to browse any database, excel, access, outlook mails, etc.. within MC. (direct access, without importing). MC view schemes is the best browsing system I have seen sofars. (although microsoft is very slowing catching the idea -> see search folders in outlook and longhorn) It is almost a waste that MC is used for media files.

Well, as WinFS is closing, I am sure MC12-13 is going more towards being an explorer replacement.

I have not tested this, but you could add http:// in front of the filenames and after importing use Find and Replace for fixing the names.
Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Re: Importing from csv files?
« Reply #7 on: January 02, 2006, 01:03:34 pm »

Some related posts:

I have also noticed that MC doesn't anymore honor the Date Imported field in MPL files. An MPL import checks unnecessary all imported files and replaces the "Date Imported" tags with the current date thus destroying the history. There should be a quick option that would just add the data in unaltered form without checking the physical files. If I remember correctly all data was preserved when I did it last time over a year ago.

When importing a MPL file, MC 11 does not import entries that don't have a corresponding filename. I don't believe that this should be the default behavior. For example the MPL file might refer files to removable drivers or to network drivers that may not be accessible at a particular time. (for example if you are using a laptop). Since it is now much more easier to detect and filter the missing files, MC should import missing files in MPL playlists.

I admit that my goal is someone different. I use MPL files to import external databases, because MC is an exceptional program to browse a database. My specific problem is that the entries on the database do not nessarily have a corresponding file, in which case, those entries are not imported. (For those who are interested, I am importing Procite bibliographic references to MC. Sometimes they have a corresponding PDF file on my harddisk, sometimes they don't).

I would really like to have an advanced option for not checking the MPL contents. With that option MC could just blindly merge the information to the library without changing or skipping anything.

It would open many possibilities for importing information from external sources as Tolga explained. It might also solve the problem of too big MPL files.

Though, I think dummy filenames would be needed in Tolga's case if the files are not available. I suppose that a library entry must have something in the filename field. The other fields are optional.

I have replaced my cover art locations by exporting the library in XML/MPL format and editing the files. After that I have imported the edited files to a new library.

Though, the MPL import seems to have some limitations. The import process seems to hang if the MPL files contain over about 20000 items. For big libraries the only way to do it is in parts.

MPL Importing is also as slow as the normal import even all library tags are already present in the files. MC goes through every file and checks them, unnecessarily in my opinion.

Last but not least MPL import does not honor the import dates in the files. It replaces the dates with the current date.

I have previously reported about these problems, but I didn't get any answers.

True. MPL files cannot be used for updating the file info. The previously imported library entries must be first cleared from the library. Then mpl files will correctly populate all fields except the Date Imported. I consider the last thing as a bug. MC does not fully trust the mpl info. Instead it unnecessarily scans the files and imports them as new library entries. MC should have a quick "merge" mode for mpl importing. Also, MC cannot import mpl files if they are big (about 20.000 items or more). I have reported these bugs a couple of times

MC can import XML data. The old files must be first removed from the library so it is good to gather them to a playlist before any partial export. Though, the XML import has some problems: The Import Date field will be updated automatically so it is not possible to preserve the original date. I have also stumbled on a size limit. In my case it occurred at about 20000 database files. I had to split a bigger database into separate XML files. The third problem is time. MC unnecessary analyzes every imported file. MC should have a "do a quick and dirty import" button. Then it would take only a few seconds. In addition, that button would make possible to import databases that consist of offline files.

and a link:

http://yabb.jriver.com/interact/index.php?topic=24043.0
Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755

zxsix

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1753
Re: Importing from csv files?
« Reply #8 on: January 02, 2006, 08:20:59 pm »

The http:// trick doesn't seem to work anymore.

Here's what I tried:

<Item>
<Field Name="Media Type">Video</Field>
<Field Name="Album">Collateral</Field>
<Field Name="Year">2004</Field>
<Field Name="Filename">http://www.yahoo.com/vts_01_1.vob</Field>
<Field Name="Image File">f:\dvdart\678149173420f.jpg</Field>
<Field Name="Genre">Comedy</Field>
</Item>
Logged

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Att. Tolga - an MPL question (Re: Importing from csv files?)
« Reply #9 on: January 03, 2006, 07:04:19 pm »

I see Tolga is online...

Can you still use the http:// trick with the recent builds?
Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755
Pages: [1]   Go Up