Importing picture location through ANT ifs script

If you need help on how to use the program
Post Reply
WannaTheater
Posts: 7
Joined: 2007-09-11 02:57:58

Importing picture location through ANT ifs script

Post by WannaTheater »

Another question for the experts:

I now have my ANT catalog in XML format, with pictures linked in. I need to replace about 1200 of these pictures, and I am trying to do it through a simple ANT .ifs script.

Each new cover is of the format "C:\some_directory\Original Title-front.jpg", so I thought I would be able to do something like:

Code: Select all

CoverDir := 'C:\some_directory\';
MovieName := GetField(fieldOriginalTitle);
SetField(fieldPicture, CoverDir + MovieName);
I tried fieldPicture and fieldPictureFilename with no success.

Can this be done this way? Again, the net result would be to replace the "Picture" items in the XML file with a link to the new file

Thank You!
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

It's not possible to load local pictures through scripts.
See also viewtopic.php?t=3701
WannaTheater
Posts: 7
Joined: 2007-09-11 02:57:58

Post by WannaTheater »

Thank you for the reply. My case may possibly be different, as I am not trying to actually load picture data into the database. I am just trying to load the location of the picture.
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

WannaTheater wrote:I am just trying to load the location of the picture.
You might be trying to load "just a location", but as a result, you want the picture to appear on your amc movie list. This is what I call loading or importing a local picture into the database. You could store your location into other fields like "URL" so the picture will open when you hit "Open URL", but if you want to import a picture into your catalog via script you must use the procedure GetPicture. And that will not work for local pictures as there is no field identifier for this that you can access via script - as far as I know.

But there might be a workaround for your problem (I did not test that yet): If you set up a little, temporary local webserver on your computer, you should be able to copy the pictures to a folder that you then can access via script and GetPicture('http://127.0.0.1/pics/xyz.jpg'). You do not need a second computer for that, just a small piece of software. Perhaps something like http://savant.sourceforge.net/index.html or many others - but as I said, I did not test that before (I did not even test the software from the link above, but download seems pretty small, just about 1.2MB).
WannaTheater
Posts: 7
Joined: 2007-09-11 02:57:58

Post by WannaTheater »

Thanks for the advice. The local web server is a great idea!

I think instead I will use a "brute force method".... I will write a small VBscript which will modify my Movies.xml catalog file. Since the pictures are not stored in this file (only the links), it looks like a pretty simple text substitution.

Code: Select all

For each movie entry in the .xml file, i.e. 
    Picture="Along Came Polly.jpg"/>
will be replaced by
    Picture="Along Came Polly-front.jpg"/>
The ideal solution would be to have a direct way to write to this variable in an ifs script, but since I only need to do this batch conversion once, the VBscript should work fine.

The only drawback is that for future movies I add to the database, I will need to drag-and-drop the picture (or manually select it). (I don't use the pictures pulled from ifs scripts, just text data)
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

You can also do a search/replace in notepad in the XML to replace .jpg"/> by -front.jpg"/>

Handling pictures through script will be added in a future version, but do not expect it too soon. A temporary VB solution would be better then ;)
WannaTheater
Posts: 7
Joined: 2007-09-11 02:57:58

Post by WannaTheater »

Even easier, but not as gratifying :D
Post Reply