Page 1 of 1

Converting text file for import into AMC

Posted: 2011-12-21 02:08:14
by doveman
I've offered to convert my brother's list of films into an AMC database for him.

Most of the entries are like this:

Mondo Trasho (1969) (87 mins)

or with the format as well like:

Ruth, Roses & Revolver (1987) (WMV) (48 mins)

although there's quite a few that don't fit either, which have no Year information for example. There's quite a few which are TV programmes rather than films as well, so a lot of those probably won't be found when grabbing from IMDB, but he can delete these later if he wants.

What I need to do is convert the list into a CSV so that I can import it into AMC, so I'd be grateful for any advice on the easiest way to do this.

Posted: 2011-12-21 12:38:11
by antp
Using regular expressions it could be easy to do, but all different cases should be known so they will be handled.

Posted: 2011-12-21 12:56:11
by doveman
Sorry, I don't really know what that means. Could you explain how to use regular expressions to convert the examples I gave into suitable comma separated lines for AMC?

Re: Converting text file for import into AMC

Posted: 2011-12-21 13:52:34
by fulvio53s03
from your examples:
Mondo Trasho (1969) (87 mins)
Ruth, Roses & Revolver (1987) (WMV) (48 mins)
1) Open your movies' list with notepad (it is in .txt format, isn't it?)
2) change ' (' to ';' with the apposite command
3) change ' mins)' to ';'
4)..... so on
5) save your file as .csv

now your file .csv can be opened with Excel (or other program you use):
6) open it and check that all titles are in the same column, idem for movie length, kind of codec etc. If not, make needed modifications and save at last your file as .csv.

7) open AMC
8) import from CSV file

is it clear??? ;)


P.S.
You don't need separated lines but fields separated by commas (or semicolons, it depends on your system).

Posted: 2011-12-21 17:06:13
by antp
Problem is that if not all movie contain the same info in parentheses, the columns won't match from one movie to another.

About regular expressions, it you do not know these it is quite hard to use. But it allows much more powerful search/replace operations.

Posted: 2011-12-21 19:49:42
by bad4u
With some basic knowledge on AMC scripting you could even import the list without separating fields (one line to one field) and then use scripting to sort information to appropriate fields. Shouldn't be that hard.

Posted: 2011-12-21 22:34:35
by fulvio53s03
Antp's and Bad4u's words are deeply true.
Anyway, if you expect to extract informations from IMDB, only information you need is original (or translated) title, so most important thing is to isolate it from others informations and this looks to be easy as, using your examples, this is always first information before '('.... ;)

Posted: 2011-12-27 15:55:46
by doveman
Thanks for the tips but by the time I'd learnt how to write a script to do it, I could have probably done it manually several times, so that's what I did in the end ;)

It didn't really take too long cutting and pasting in OpenOffice Calc, to swap around some of the columns where the Codec/Length were the wrong way round, just a bit tedious really. I might look at writing a script if I need to do anything similar in future, but hopefully I won't need to!

Posted: 2011-12-27 16:05:26
by fulvio53s03
doveman wrote:Thanks for the tips but by the time I'd learnt how to write a script to do it, I could have probably done it manually several times, so that's what I did in the end ;)

It didn't really take too long cutting and pasting in OpenOffice Calc, to swap around some of the columns where the Codec/Length were the wrong way round, just a bit tedious really. I might look at writing a script if I need to do anything similar in future, but hopefully I won't need to!
why do you still say you would need a script?
You had only to:

1) Open your movies' list with notepad (it is a .txt or even .csv, it's the same). format, isn't it?)
2) change ' (' to ';' with the apposite command
3) save your file as .csv

now your file .csv can be imported into AMC catalog (all translated/original titles are in the same column, ins't it?)
;)

Posted: 2011-12-27 16:36:58
by doveman
Well not all the fields were in the same column as you can see from the two examples I gave in my first post. I wanted to keep the Format and Length (and Comments, although there weren't many of those) as my brother will probably prefer to see the length of the actual files he's got rather than the nominal one from IMDB. So a script might be useful to put the Format, Length and Comments in the correct fields.

I think I've done all the movies now but there's a load of documentaries which I think I'll make a separate AMC catalog for and try a script with those maybe (if I can work it out!).

Then there's a load of music videos, tv episodes, DVD extras, etc which I'm not sure AMC can do anything with, but if I so I might want to use a script on those as well.

Posted: 2011-12-27 17:01:51
by doveman
To help illustrate the issue with importing the list of documentaries, here's a sample of entries.

Autoschreck / Car-Fright (1994) (MP4/AVI) (16 mins)
Francis Bacon – South Bank Show 1985 (MPG) (55 mins)
The Battle For Jerusalem (Storyville 14.5.08) (49 mins)
The Century Of The Self (4 parts) (58/59/59/59 mins)
Finally Got The News (56/26 mins)

As you can see, after the titles some have (Year) (Format) (Length), some have (Format) (Length) and some just have (Length) and some have (Programme/Channel Date) although thankfully there's not too many of those as they'll probably have to be adjusted manually.

I imagine a script should be able to identify the Length as being in the brackets with the word mins and the Format can be identified from a list of possibles, whilst the Year can be identified as a four-digit number beginning with 19 or 20. It's not too bad importing the list into OpenOffice Calc, using the "(" as separator and then just replacing the ")" with blanks, although I'd need to manually move certain bits (such as Storyville or 4 parts) back on the end of the title first.

Posted: 2011-12-27 17:15:36
by fulvio53s03
OK. ;)

Posted: 2011-12-27 19:13:02
by doveman
I've somehow managed to import all the movies with an extra space on the end of the title! Is there an easy way to remove this?

Posted: 2011-12-27 19:39:53
by soulsnake
You can execute this script to trim all fields.

Code: Select all

program TrimAllFields;
uses
  SoulSnakeUtils;

var
  i: Integer;

begin
  for i:=0 to GetFieldCount+GetCustomFieldCount-1 do
  begin
    SetFieldOrCustomField(i, Trim(GetFieldOrCustomField(i)));
  end;
end.

Posted: 2011-12-28 02:02:55
by doveman
That's great. Thanks :)

Posted: 2012-01-04 10:33:06
by doveman
Hmm, it doesn't like

SoulSnakeUtils;

says "Unit is not found"

Posted: 2012-01-04 10:51:03
by soulsnake
Arf, it is not included in package.
You can find it here: http://mickaelvanneufville.online.fr/AMCU/scripts/
Just copy SoulSnakeUtils.pas in Scripts folder.

Soulsnake.

Posted: 2012-01-04 11:16:32
by doveman
Thanks, all working now :)