Skip to content

royw/dvdprofiler2xbmc

Repository files navigation

dvdprofiler2xbmc

STATUS

The initial goal of using DVD Profiler data when available along with IMDB data otherwise is met. Just added the CLI config editor.

Near term plans include:

  • supporting multiple file matching patterns

  • supporting directory containers

  • maybe scrape posters from MoviePosterDB.com

DESCRIPTION:

This script will attempt to match up media files from a set of directories to the collection.xml file exported from DVD Profiler. For matches, the script will then create a {moviename}.nfo from the data in collections.xml and also copy the front cover image to {moviename}.tbn. Both files will be placed in the same directory as the source media file. Also the specific profile information for each movie will be saved into {moviename}.dvdprofiler.xml.

The script will then search IMDB for a title or also known as (AKA) match. If necessary, the script will refine the search by using the media year (year in media filename), then dvdprofiler production year, then dvdprofiler release year, then try again with each year plus or minus a year. The IMDB profile found will be saved as {moviename}.imdb.xml.

Next the script will use the IMDB ID to query themovieDb.com. This is primarily to retrieve any fanart but will also add any missing parameters to the .nfo file (very unlikely). The TMDB profile found will be saved as {moviename}.tmdb.xml.

So in summary the files generated are:

{moviename}.tmdb.xml - profile from themovieDb.com {moviename}.imdb.xml - profile from imdb.com {moviename}.dvdprofiler.xml - profile from collection.xml {moviename}-fanart.jpg - first fanart image from themovieDb.com {moviename}.tbn - image from DVD Profiler {moviename}.nfo - generated info profile for xbmc

To force regeneration, simply delete these files then run the script again.

Then on XBMC, set the source content to none to remove the meta data from the library, then set the source content back to Movies to import the media. This time, the data in the .nfo files will be used instead of scraping. Note, XBMC pre-9.04 r19177 does not successfully scan all media. The work-around is after the scan is complete to restart XBMC so it will scan again (if you have autoscan enabled).

NOTES:

1) Currently only supports file based media containers, not directory based.

2) Media filename convention is to take the media’s title from DVD Profiler, replace any punctuation with a space character, then replace any multiple spaces with a single space. Next remove any leading or trailing spaces. Optionally can append “ - YYYY” where YYYY is the movie’s release year. Naturally the extension is the media’s container type. Note, you should not include in the title edition info like “Widescreen” or “Special Edition” eventhough there are some mistakes in the DVD Profiler profiles that do include these in the title.

FEATURES/PROBLEMS:

Features:

  • On first run will launch the config editor. At a minimum you will need to set at least one media directory and the paths to DVD Profiler’s exported Collection.xml and images directory must me valid. The script enforces validity by running the config editor when there is invalid data and will not let you scan your media.

  • Creates .nfo files from exported collection.xml from DVD Profiler and imdb.com.

  • If .nfo does not have an <id> tag, then tries to find the IMDB ID by using the title and production/release years to search IMDB.

  • Sets file permissions for files and directories

  • Media can be contained in a set of directories (they can be mount points)

  • Adds sub-directory names as genres to .nfo files

  • To prevent reporting missing ISBN, “touch {moviename}.no_isbn” (this is useful to ignore boxed sets)

  • To prevent lookup on imdb, “touch {moviename}.no_imdb_lookup” (this is useful for titles you know are not on imdb.com)

  • To prevent lookup on tmdb, “touch {moviename}.no_tmdb_lookup” (this is useful for titles you know are not on themovieDb.com)

  • DVD Profiler recently added box set support which this script does handle.

Problems:

  • Needs to support selectable/multiple regex based naming conventions

  • Needs to support directory containers

SYNOPSIS:

Run the program and the CLI config editor will start:

# dvdprofiler2xbmc
saving: /root/.dvdprofiler2xbmcrc
The following config items are not valid and need to be changed:
  collection_filespec
  directories
  images_dir
Configuration Editor

Field Selection
1) quit
2)          directories  []
3)    subdirs_as_genres  true
4)  collection_filespec  "~/DVD Profiler/Databases/Exports/Collection.xml"
5)           images_dir  "~/DVD Profiler/Databases/Exports/Images"
6)     file_permissions  "664"
7)      dir_permissions  "777"
8)           genre_maps  {"Anime"=>"Animation", "Science-Fiction"=>"Science Fictio...
9)     media_extensions  ["iso", "m4v", "mp4", "mpeg", "wmv", "asf", "flv", "mkv",...
10)     image_extensions  ["jpg", "jpeg", "png", "gif", "bmp", "tbn"]
Please select field: 2

-------------------------------
directories

Array of paths to scan for media.  Replace with your paths.

Default:
[]

Current:
[]

1) quit
2) default
3) add
4) delete
Please select: 3
New pathspecs or a blank line to quit: /media/royw-gentoo/public/data/movies

-------------------------------
directories

Array of paths to scan for media.  Replace with your paths.

Default:
[]

Current:
["/media/royw-gentoo/public/data/movies"]

1) quit
2) default
3) add
4) delete
Please select: 1

Field Selection
1) quit
2)          directories  ["/media/royw-gentoo/public/data/movies"]
3)    subdirs_as_genres  true
4)  collection_filespec  "~/DVD Profiler/Databases/Exports/Collection.xml"
5)           images_dir  "~/DVD Profiler/Databases/Exports/Images"
6)     file_permissions  "664"
7)      dir_permissions  "777"
8)           genre_maps  {"Anime"=>"Animation", "Science-Fiction"=>"Science Fictio...
9)     media_extensions  ["iso", "m4v", "mp4", "mpeg", "wmv", "asf", "flv", "mkv",...
10)     image_extensions  ["jpg", "jpeg", "png", "gif", "bmp", "tbn"]
Please select field: 4

-------------------------------
collection_filespec

The location of DVD Profiler's exported Collection.xml

Default:
"~/DVD Profiler/Databases/Exports/Collection.xml"

Current:
"~/DVD Profiler/Databases/Exports/Collection.xml"

1) quit
2) default
3) edit
Please select: 3
New filespec: |~/DVD Profiler/Databases/Exports/Collection.xml| /home/royw/DVD Profiler/Shared/Collection.xml

-------------------------------
collection_filespec

The location of DVD Profiler's exported Collection.xml

Default:
"~/DVD Profiler/Databases/Exports/Collection.xml"

Current:
"/home/royw/DVD Profiler/Shared/Collection.xml"

1) quit
2) default
3) edit
Please select: 1

Field Selection
1) quit
2)          directories  ["/media/royw-gentoo/public/data/movies"]
3)    subdirs_as_genres  true
4)  collection_filespec  "/home/royw/DVD Profiler/Shared/Collection.xml"
5)           images_dir  "~/DVD Profiler/Databases/Exports/Images"
6)     file_permissions  "664"
7)      dir_permissions  "777"
8)           genre_maps  {"Anime"=>"Animation", "Science-Fiction"=>"Science Fictio...
9)     media_extensions  ["iso", "m4v", "mp4", "mpeg", "wmv", "asf", "flv", "mkv",...
10)     image_extensions  ["jpg", "jpeg", "png", "gif", "bmp", "tbn"]
Please select field: 5

-------------------------------
images_dir

The location of DVD Profiler's cover scan images.

Default:
"~/DVD Profiler/Databases/Exports/Images"

Current:
"~/DVD Profiler/Databases/Exports/Images"

1) quit
2) default
3) edit
Please select: 3
New pathspec: |~/DVD Profiler/Databases/Exports/Images| /home/royw/DVD Profiler/Shared/Images

-------------------------------
images_dir

The location of DVD Profiler's cover scan images.

Default:
"~/DVD Profiler/Databases/Exports/Images"

Current:
"/home/royw/DVD Profiler/Shared/Images"

1) quit
2) default
3) edit
Please select: 1

Field Selection
1) quit
2)          directories  ["/media/royw-gentoo/public/data/movies"]
3)    subdirs_as_genres  true
4)  collection_filespec  "/home/royw/DVD Profiler/Shared/Collection.xml"
5)           images_dir  "/home/royw/DVD Profiler/Shared/Images"
6)     file_permissions  "664"
7)      dir_permissions  "777"
8)           genre_maps  {"Anime"=>"Animation", "Science-Fiction"=>"Science Fictio...
9)     media_extensions  ["iso", "m4v", "mp4", "mpeg", "wmv", "asf", "flv", "mkv",...
10)     image_extensions  ["jpg", "jpeg", "png", "gif", "bmp", "tbn"]
Please select field: 1
Save? yes/no  |yes|

saving: /root/.dvdprofiler2xbmcrc

For those really observant, you will have noticed that I run the script as root, which I highly recommend against. In my case, my media is still shared with LinuxMCE which absolutely insanely requires the media to be owned by root. One of the reasons I’m switching to XBMC.

Now you can run the program again and it will start scanning your media:

# dvdprofiler2xbmc
saving: /root/.dvdprofiler2xbmcrc
Media Directories:
  /media/royw-gentoo/public/data/movies

The Sand Pebbles
Loading /home/royw/DVD Profiler/Shared/Collection.yaml
not saving, yaml file is newer than xml file
ISBN => 024543013099
Need to find box set parent's title
ImdbProfile.all({:titles=>[["The Sand Pebbles"], "The Sand Pebbles"], :imdb_id=>"tt0060934", :media_years=>[1966], :production_years=>["1966"], :filespec=>"/media/royw-gentoo/public/data/movies/War/The Sand Pebbles.imdb.xml", :released_years=>["2001-05-15"]})
IMDB ID => tt0060934

My Super Ex-Girlfriend
ISBN => 024543380634
Need to find box set parent's title
ImdbProfile.all({:titles=>[["My Super Ex-Girlfriend"], "My Super Ex-Girlfriend"], :imdb_id=>"tt0465624", :media_years=>[2006], :production_years=>["2006"], :filespec=>"/media/royw-gentoo/public/data/movies/Comedy/My Super Ex-Girlfriend.imdb.xml", :released_years=>["2006-12-19"]})
IMDB ID => tt0465624
updated /media/royw-gentoo/public/data/movies/Comedy/My Super Ex-Girlfriend.nfo
^Ccontrol-C detected, finishing current task

As you can see above you can press ^C to interrupt at any time, but the script will finish processing the current media before terminating.

If you let the script run to completion you may see some reports at the end that detail some of your problem media. Example:

Missing ISBNs
  /media/dcerouter/public/data/videos_iso/Drama/Across The Universe Special Features.iso
  /media/royw-gentoo/public/data/videos_iso/Musicals/Going My Way and Holiday Inn.iso
  /media/royw-gentoo/public/data/movies/Animation/No Time For Nuts.m4v
  /media/dcerouter/public/data/videos_iso/Science Fiction/Riddick Trilogy 3.iso
  /media/dcerouter/public/data/videos_iso/Science Fiction/Riddick Trilogy 1 & 2.iso
  /media/royw-gentoo/public/data/videos_iso/Science Fiction/Aeon Flux [WS] [Special Collector s Edition].iso
  /media/royw-gentoo/public/data/videos_iso/Thriller/Leon The Professional.iso
  /media/dad-kubuntu/public/data/videos_iso/Action/Deja vu.iso

Missing IMDB IDs
  Rodeo Racketeers: John Wayne Young Duke Series (1934)
  Across The Universe Special Features
  Going My Way and Holiday Inn
  Pearl Harbor Payback Appointment in Tokyo (2001)
  Riddick Trilogy 1 & 2
  Deja vu
  Seabiscuit: America s Legendary Racehorse (2003)

Missing Thumbnails
  /media/dcerouter/public/data/videos_iso/Drama/Across The Universe Special Features.tbn
  /media/royw-gentoo/public/data/videos_iso/Musicals/Going My Way and Holiday Inn.tbn
  /media/royw-gentoo/public/data/movies/Animation/No Time For Nuts.tbn tt0902999
  /media/dcerouter/public/data/videos_iso/Science Fiction/Riddick Trilogy 3.tbn tt0407749
  /media/dcerouter/public/data/videos_iso/Science Fiction/Riddick Trilogy 1 & 2.tbn
  /media/royw-gentoo/public/data/videos_iso/Comedy/The First To Go - 0.tbn tt0119126

Usually the Missing ISBNs are letting you know that the media title (from the filename) could not be found in the DVD Profiler’s Collection.xml. The best approach is to check the title in the profile in DVD Profiler.

Above, “Aeon Flux”, “Deja vu” and “Leon The Professional” are not found because the actual titles have accented characters. “Across The Universe Special Features” is the special feature disk so is not found. “Going My Way and Holiday Inn” is a double feature disk, probably should transcode each movie into separate files. “No Time For Nuts” is a cartoon on an Ice Age movie. The Riddick Trilogy isos should be transcoded into separate files.

The Missing IMDB IDs usually indicate either odd ball movies that are not on IMDB, or multiple feature titles, or multiple matches. If it’s the later then it’s best to add the production year to the file name.

You should have the idea now.

You may want to get the command line help by running:

dvdprofiler2xbmc --help

REQUIREMENTS:

  • ruby 1.8.x

  • rubygem

  • my imdb fork on github (sudo gem install royw-imdb)

INSTALL:

sudo gem install royw-dvdprofiler2xbmc

UNINSTALL:

sudo gem uninstall royw-dvdprofiler2xbmc

optionally (shouldn’t be necessary)

rm ~/.dvdprofiler2xbmcrc

LICENSE:

(The MIT License)

Copyright © 2009 Roy Wright

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

script to create moviename.nfo and .tbn files from DVDProfiler exported data and IMDB data for use on XBMC

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages