IMDB Bulk Updater for MythTV (Version 1.17) aka: mythvideo-bulk-updater in mythbuntu

- Ryan Pisani mythdora thepisanis.com
==============================================================================
Version 1.0: 8/28/2007
======================
This is a simple script that wraps the mythvideo script called tmdb.pl for bulk
video updating. You must have a working copy of tmdb.pl.

The most current copy as of 8/28/2007 is provided in this package. It can be
copied to /usr/share/mythtv/mythvideo/scripts if needed. (MythDora Default)
==============================================================================
NOTE: The tool assumes a few things like /storage/posters for coverfiles, and
127.0.0.1 for the DB host. All of these things can be modified using the usage
below.
==============================================================================
Version 1.1: 9/04/2007
======================
Added -Title lookup so that specific updates could be performed
==============================================================================
Version 1.2/1.3: 9/13/2007
==========================
Couple of changes. Namely the addition of -Fileup & -Manual.
-Fileup will check the video files in the db and compare them to actual files
on the filesystem. It will make DB updates accordingly. The default is off

-Manual will force a manual IMDB number entry on all matches. Works well with
-Title (for those stubborn Titles)
==============================================================================
Version 1.4: 9/20/2007
======================
A few new behaviors / changes added in this release.

-If duplicates are found in IMDB results, and -Dupskip is not set, the first
entry in the list is assumed correct. So basically [0] is the default.

-Exclude flag has been added. This will give the user the option of ignoring
those entries that find no results.
** Notice: This is best with the -N flag, as the data set it is searching for
** are those that currently have no entry. If you -Exclude with -A, you could
** wipe all those entries you may have manually entered IMDB numbers for.

-help was added for extended examples

-The coverart directory will be pulled from the DB if not specified in the
arguments.
==============================================================================
Version 1.5: 9/23/2007
======================
-Fixed a major bug with adding new files to the DB. It may be ugly to correct
if it was exhibited with -exclude combination.

-Folder flag has been added. This allows you to override the VideoPath value
found in the database. This will be useful for those users that do not want
to go through the hassle of dealing with Dups or those that should be excluded
manually.
==============================================================================
Version 1.5.1: 9/24/2007
========================
-Added showlevel=1 value to -Fileup to correct schema default issue
==============================================================================
Version 1.6: 9/29/2007
======================
-Fixed bug in -Title search where title would come up null in the DB
==============================================================================
Version 1.7: 10/19/2007
=======================
-Modified DVD directory handling so that individual .vob files are not
added to the database.

-Changed detection for files that moved so that -Fileup does not remove and
readd/relook them up from imdb. It also handles posters that already exist.
=============================================================================
Version 1.7.1: 11/30/2007
=======================
-Included latest svn of imdb.pl tool to help correct some errors
==============================================================================
Version 1.8: 02/14/2008
=======================
-Corrected issue with the recent version of imdb.pl that introduced a gap in
the TEMPDATA array. I added a little bit more of robust data check to try to
prevent mishaps if imdb.pl changes in the future. (Thanks xirtam for the
heads up).

-Added more -Folder functionality. You now can do -Folder combined with -N or
-A to only target updates on sub-directory.
==============================================================================
Version 1.9: 04/02/2008
=======================
-Corrected an issue with multiple title handling. If a title search returns
more than one imdb.com entry it now handles that situation accordingly.

-Added optional -Getcovers argument. This will search for posters for all
movies that don't currently have a coverfile (that have not been excluded).
==============================================================================
Version 1.9.1: 04/13/2008
=========================
-Corrected an issue with -Exclude titles. Null titles were being entered into
the database if no match was found and -Exclude was being used.
==============================================================================
Version 1.9.2: 05/09/2008
=========================
-Modified the -Fileup option for better handling of files with [] & () in the
name.
-Corrected issue with -Fileup that where duplicates were added to the database
because of (my) faulty logic and assumption that users would not use the video
manager to import new files. Basically a race condition is created when users
have the "Allow Unknown Filetypes" option checked in mythvideo settings and the
extension is not a part of the default filetypes in script.
==============================================================================
Version 1.10: 05/12/2008
=========================
- Added -Update flag that can be used in conjunction with -A / -Title searches
to update metadata for known IMDB numbers. This is helpful in the recent case
where imdb.pl was returning NULL plot values.

- Added -Exrecheck flag that is used as a primary parameter to re-check for
IMDB data for those files you may have previously excluded. This can be used
in conjuntion with -Folder. Please use sparingly and don't hammer imdb.com
with previously exlcuded TV episodes etc.
==============================================================================
Version 1.11: 05/21/2008
=========================
- Modified -Fileup to honor users with : separated video dirs in their mythtv
videosetup.

-Added -Imdbnum flag that overrides imdbnum retrieval. This isuseful for full
directory overrides in the case of a series or multipart films. Use carefully
as this will retain the passed imdbnum for all entries. So don't use it on your
normal directory.
==============================================================================
Version 1.12: 05/28/2008
=========================
- Modified -Fileup to follow symbolic links and autofs directories. (thanks Tim)

- Fixed a bug in Title lookups that would sometimes cause an error in imdb
retrieval.

- Added -Default override so that the first entry in a duplicate match is auto
selected with no user interaction.(use this instead of -Dupskip in cron if you
want to trust the top return on imdb.com)
==============================================================================
Version 1.13: 07/07/2008
=========================
- Added a videocast & videogenre support. (thanks Jamie A. for patch).
- Supports removing videocast/videogenre per intid as well and is compatible with
the -A -Update flag to update existing DB data.
==============================================================================
Version 1.14: 08/15/2008
=========================
- Added null inetref check to $new mysql statements. This remedies videos being
skipped over that were imported with mythweb.
==============================================================================
Version 1.14.1: 11/3/2008
=========================
- Fixed -Folder syntax error in sql that prevented sql results from limiting to only the selected dir.
==============================================================================
Version 1.14.2: 12/27/2008
=========================
- Fixed multiple video directory file check to prevent multiple entries from
being added
==============================================================================
Version 1.14.3: 03/12/2009
=========================
- Added user submitted patch for videocountry for metadata. Thanks Niall..
==============================================================================
Version 1.15: 12/17/2009
=========================
- Added -Newlevel switch to allow user to overide the default showlevel of "1"
at runtime. Works with -Folder & -Title as well.
- Enhanced -Getcovers to better handle poster retrieval
- Changed imdb to default to tmdb.pl for 0.22
==============================================================================
Version 1.16: 02/09/2010
=========================
- Modified the script to work with new tmdb.pl grabber present in 0.23 mythtv
- Default path updated for $imdb to reflect 0.23 changes
- 1.16 will no longer work with 0.22 mythtv
===============================================================================
Version 1.17: 04/24/2010
=========================
- Fixed a problem with Getfanart
- Corrected script to work with tmdb.py (default 0.23 release tool)
===============================================================================

usage: imdb-bulk-update.pl -[Required] -[Optional] -[Host] parameters

Required parameters (Choose one):
-A Get IMDB data for ALL movies in database
-N Get IMDB data for movies with no IMDBID in database
-Exrecheck Recheck videos previously excluded with -Exclude
-Title Get IMDB data for movie(s) matching a quoted pattern

Standalone options:
-Getcovers Retrieve posters for any title that is missing one.
-Getfanart Retrieve fanart for any title that is missing one.

Optional parameters (Use in conjunction with options above):
-Exclude Mark entries with no result with imdb placeholder (DEFAULT: OFF)
-Fileup Search for new/removed videos and update database (DEFAULT: OFF)
-Manual Query for manual IMDB number for each title (DEFAULT: OFF)
-Dupskip Ignore the videos that find multiple imdb results (DEFAULT: OFF)
-Default Select the first entry in duplicate match automatically (DEFAULT: OFF)
-Update Use in conjuction with -A/Title to update videometadata (DEFAULT: OFF)
-Folder Use in conjuction with -A/N to search specific directory
-Imdbnum Pass in an imdbnum to use on all matches (see extended usage)
-Newlevel Set the showlevel for a video or folder [1-4 valid]

Host parameters:
-Host Specify a database host (DEFAULT:127.0.0.1)
-User Specify a database user (DEFAULT:mythtv)
-Password Specify a database password (DEFAULT:mythtv)
-Imdb Specify path to a working imdb.pl (DEFAULT:/usr/share/mythtv/mythvideo/scripts/imdb.pl)
-Posters Specify a cover art directory if different from entry in DB

Example:
imdb-bulk-update.pl -N -Host myhostname -User mythuser -Password mythpass

Use imdb-bulk-update.pl -help for extended examples

New file check with IMDB lookup and non-local DB:
imdb-bulk-update.pl -N -Fileup -Host 192.168.1.50

New file check with IMDB lookup and future exclusion for non-match:
imdb-bulk-update.pl -N -Fileup -Exclude

New file check, IMDB lookup for ALL movies, skipping multiple IMDB returns:
imdb-bulk-update.pl -A -Fileup -Dupskip

Title search with Manual IMDB entry:
imdb-bulk-update.pl -Title "Austin Powers" -Manual

Attempt to retrieve posters for any title missing one:
imdb-bulk-update.pl -Getcovers

Retrieve metadata for all videos using a known IMDB number:
imdb-bulk-update.pl -A -Update

Recheck for titles previously excluded:
imdb-bulk-update.pl -Exrecheck

Use a specific IMDB number for all contents in a particular directory:
imdb-bulk-update.pl -A -Folder /movies/band_of_brothers -Imdbnum 8888888

Override the default showlevel for all content in a directory:
imdb-bulk-update.pl -A -Folder /My/movie/directory/Adult -Newlevel 4

===============================================================================

Enjoy - Please send feedback to the address above.