Slypheed's Batch Import Script + IMDB regex fixes

Please use this forum to post feedback and suggestions related to VCD-db.
You can also post any questions here that are on your mind.

Moderators: Carpo, Saviq

Slypheed's Batch Import Script + IMDB regex fixes

Postby slypheed » Sat Oct 18, 2008 9:40 pm

I've created a batch import script of movies for my own use, and thought the community might find it helpful.

grab it here:
http://slypheed.com/files/vcddb/importer.php.txt

How to use in a nutshell:
    1. Rename 'importer.php.txt' to 'importer.php'
    2. Place 'importer.php' in your vcddb site root.
    3. Create a "movies.txt" in your vcddb site root (see below for example of this).
    4. In your web browser go to http://<mydomain.com>/<vcddb_directory>/importer.php
    5. Depending on how big your list is, wait a while (for ~800 movies it took an hour or two)

'movies.txt' format:
grab example file from:
http://slypheed.com/files/vcddb/movies.txt
Basically just one movie name per line in a plain text file.

Other things:
My version of vcddb (0.991) had errors in the regular expressions for the year and poster.
Fix it by either:
First Method:
    1. grab my patch file from here:
    http://slypheed.com/files/vcddb/VCDFetch_imdb.php.diff
    2. copy it to <vcddb_dir>/classes/fetch/
    3. cd to that directory (i.e. "cd /var/www/vcddb/classes/fetch")
    4. run this command from the terminal (no quotes):
    "patch -p0 VCDFetch_imdb.php < VCDFetch_imdb.php.diff"
Second Method:

Notes:
    1. This is a total hack...I basically traced through how vcddb fetched and inserted new movies and copied/hacked that code into this script -- it works quite well for me but YMMV.

    2. It is ONLY for IMDB -- feel free to hack it up to work with others though :)

    3. It will ocassionally grab the wrong movie -- this is because it assumes that the first result fetched from the list of matching movies is the correct one. -- In my experience this is true about 95% of the time.

    4. It will ocassionally fail (i.e. the script will stop and you'll have to start it again)
    If this happens:
    a. either restart it (it'll skip any movies already added -- but will still take the time to fetch them from IMDB)
    b. Simply look at the script output in your browser -- see the last one added -- and trim your movies.txt file and start again (it goes sequentially through the file).


Feel free to post issues you find and/or feature requests. No promises though =)
(NOTE: I have no plans whatsoever to change it to import from anything besides plain text files -- if you have it in excel I'm sure you can figure out how to convert it to the simple one-movie-name-per-line movies.txt format)

anyway, hope someone finds it useful and let me know if anything is totally screwed up.

(oh and make sure allow_url_fopen is set to ON in your php.ini -- curl doesn't seem to work for image retrieval)

Suggestion for the forum:
As VCD-DB appears to be abandoned by its creators -- if anyone still has admin on this forum -- it might be useful to setup a "patches/additions" Section -- as well as setting up a new source control repository.

One more thing -- I avoid Windoze like the plague, so feel free to ask, but...

--slypheed
slypheed
 
Posts: 3
Joined: Sat Oct 18, 2008 8:15 pm

Postby Saviq » Sat Oct 18, 2008 9:55 pm

Thanks for the patch, just two things:
- use 'diff -Naur' to create a proper patch,
- use latest svn version to patch against

The poster worked for me in svn, I've just commited the year fix.

About the forums, unfortunately I only have moderator rights so I can't really do anything here.

I've tried to contact Konni, no luck I'm afraid... I think he got stuck in Real Life :/
Saviq
Site Admin
 
Posts: 401
Joined: Mon May 30, 2005 12:39 pm
Location: Poland

Postby slypheed » Sat Oct 18, 2008 11:24 pm

I've updated the diff patch per your suggestion.

Thanks for the SVN link, I'll check that out and update my code when I get a chance.
slypheed
 
Posts: 3
Joined: Sat Oct 18, 2008 8:15 pm

Re: Slypheed's Batch Import Script + IMDB regex fixes

Postby jenko22 » Sun Oct 19, 2008 9:54 am

slypheed wrote:3. It will ocassionally grab the wrong movie -- this is because it assumes that the first result fetched from the list of matching movies is the correct one. -- In my experience this is true about 95% of the time.


One thought about this, if its for bulk updating of existing movies couldn't you extract the imdb field from vcd_IMDB for every entry and output to a text file, then assuming that you picked the correct film when originally entered it will always update from the correct one.

it seems like this would be a better solution if possible.

Code: Select all
SELECT imdb FROM `vcd_IMDB` INTO OUTFILE '/VCDROOT/movies.txt'
jenko22
 
Posts: 9
Joined: Wed Jan 16, 2008 10:06 pm

Postby kmmartins » Sat Nov 08, 2008 9:15 am

Thanx for your script slypheed,

I was trying to changed the script to do the next thing: I want to update all my imdb movies with only a new cover/thumbnail. (I've lost all my pictures).

Could you help me with that?
kmmartins
 
Posts: 7
Joined: Wed Aug 01, 2007 1:17 pm

Postby glecko » Sun Nov 09, 2008 6:06 am

Slypheed! THANK YOU SO MUCH!
This should save me a whole weekend manually entering my collection.

Seems that I came upon this product a bit late...

Either way, I have a problem importing my movies from a TXT file. It imports 2-3 titles, and stops. I restart the importer.php... and again 2-3 titles.

Am i doing somethign wrong?

thank you again!!!
glecko
 
Posts: 1
Joined: Sun Nov 09, 2008 5:31 am

Re: Slypheed's Batch Import Script + IMDB regex fixes

Postby wmcius » Sat Jan 10, 2009 10:36 pm

Hi slypheed. Thanks for the script. It seems to be promising, but so far it hasn't worked out for me.

When I add a few movies to movies.txt and then load the importer.php file, it gets stuck on the first movie and only gives me the various names/aliases of that movie.

I receive the following error:

Fatal error: Uncaught exception 'Exception' with message 'Fetch ID is null' in /home/movie/public_html/movies/classes/fetch/VCDFetch.php:114 Stack trace: #0 /home/movie/public_html/movies/importer.php(21): VCDFetch->fetchItemByID(NULL) #1 {main} thrown in /home/movie/public_html/movies/classes/fetch/VCDFetch.php on line 11

Any ideas?
I'd really like for this to work. Therefore your helo would be greatly appreciate.

Thanks
wmcius
 
Posts: 2
Joined: Sun Jan 04, 2009 2:40 am

Re: Slypheed's Batch Import Script + IMDB regex fixes

Postby jmdsdf » Wed Feb 11, 2009 8:41 pm

The problem is pretty simple. Add:

flush();
$movie = trim($movie);

right after:

foreach($movies as $i => $movie) {

It appears that the whitespace throws off of the imdb search causing the search to return no matches. Also, calling flush will cause php to output the data to the browser as the script runs. I used this to add by imdb #s, I also added in some extra debugging output. If anyone is interested in those changes to the script, let me know. A big thanks to Slypheed!
jmdsdf
 
Posts: 1
Joined: Wed Feb 11, 2009 8:36 pm

Re: Slypheed's Batch Import Script + IMDB regex fixes

Postby wmcius » Tue Feb 17, 2009 2:49 pm

Hi jmdsdf,

I added the two lines but still receiving the exact same error.

As desperately as I want this to work, I'm stuck on this error for the last 2 months... lol.

Any new ideas?

Thanks so much.
wmcius
 
Posts: 2
Joined: Sun Jan 04, 2009 2:40 am

Re: Slypheed's Batch Import Script + IMDB regex fixes

Postby ssa2204 » Tue Feb 02, 2010 9:57 pm

Something tells me I may have no hope of finding an answer, but here goes. When I run the importer.php, it only picks one movie at a time

Also, any ideas on how I could just import from Med's Movie Manager?
ssa2204
 
Posts: 1
Joined: Mon Feb 01, 2010 12:33 pm


Return to General discussion, Suggestions and Feedback

Who is online

Users browsing this forum: No registered users and 1 guest

cron