* @version $Id: mass_add.php,v 1.2 2007/07/27 10:09:07 andig2 Exp $ */ chdir('..'); require_once './core/functions.php'; require_once './core/genres.php'; require_once './core/custom.php'; require_once './core/security.php'; ?> Mass IMDB movie add
"; $id = runSQL($INSERT); // save genres setItemGenres($id, $genres); //------------------------------------------- // insert userseen data $INSERTSEEN = 'INSERT INTO `userseen` (`video_id`, `user_id`) VALUES ('.$id.','.$owner_id.')'; runSQL($INSERTSEEN); $ret_title=$title; return 1; } if ((isset($_POST['Submit'])) && (is_uploaded_file($_FILES['id_list']['tmp_name']))){ //lets set time limit of we can set_time_limit(30000); $filename = $_FILES['id_list']['tmp_name']; echo "File uploaded. Starting fetching and inserting into database...
"; ob_flush(); flush(); //get seen field from form $seen=isset($_POST['seen'])?1:0; //get mediatype id from form $mediatype=$_POST['mediatype']; $lines=file($filename); //iterate for all lines in uploaded file foreach( $lines as $line){ //trim \n from end of line $line=rtrim($line); //if line is empty, go to the next line if ($line=="") continue; //if we import by title, first get id from best matcing title if ($_POST['import_type']=='title'){ $all=engineSearch($line); $id=$all[0][id]; } else{ $id=$line; } if (strpos($id,"imdb:")===false){ $id="imdb:".$id; } //try to insert movie if (InsertMovie($id,&$title,$seen,$mediatype)==1){ echo "$title inserted "; if ($_POST['import_type']=='title'){ echo "(additional info - title form file was $line)"; } echo "
"; } else{ //ops, error echo "Error while inserting ID - ".$id." (additional info - "; if ($_POST['import_type']=='title') echo "title from file was $line)
"; else{ echo "id from file was $line)
"; } } ob_flush(); flush(); } } ?>

Mass IMDB movie add v0.2


Ok, here is the thing:
1. Browse for file with movie data (imdb ids or titles), hit Submit and pray:)
2. Script will try to set time limit, but this also depends from PHP configuration, so if script stops before all movies has been entered, check for PHP config.
3. File you need to browse is in form - one line per movie. So, if you want to import imdb ids, it should be something like:
0088247
0088248
or
imdb:0088247
imdb:0088248
and for titles:
terminator
terrible joe moran
In second case (import by titles), first matching title will be imported.
4. You must be logged to VideoDB as user who has write access (i.e. you can add movies on your own). All imported movies will be assigned to you. If you don't have write access or you are not logged, owner id will be 0.
5. Backup your data, make sure nothing can be lost, no responsibility, blah, blah...you already know it all.

Import by ids
Import by titles
Set all movies as seen
Media type:
Import list: