royw-dvdprofiler2xbmc 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/History.txt +5 -0
- data/Manifest.txt +33 -6
- data/PostInstall.txt +54 -3
- data/README.rdoc +38 -11
- data/Rakefile +1 -1
- data/bin/dvdprofiler2xbmc +1 -1
- data/dvdprofiler2xbmc.gemspec +7 -7
- data/lib/dvdprofiler2xbmc.rb +15 -7
- data/lib/dvdprofiler2xbmc/app_config.rb +15 -5
- data/lib/dvdprofiler2xbmc/{app.rb → controllers/app.rb} +6 -6
- data/lib/dvdprofiler2xbmc/controllers/fanart_controller.rb +73 -0
- data/lib/dvdprofiler2xbmc/controllers/nfo_controller.rb +280 -0
- data/lib/dvdprofiler2xbmc/controllers/thumbnail_controller.rb +70 -0
- data/lib/dvdprofiler2xbmc/extensions.rb +5 -2
- data/lib/dvdprofiler2xbmc/{collection.rb → models/collection.rb} +29 -7
- data/lib/dvdprofiler2xbmc/models/dvdprofiler_profile.rb +127 -0
- data/lib/dvdprofiler2xbmc/models/imdb_profile.rb +230 -0
- data/lib/dvdprofiler2xbmc/{media.rb → models/media.rb} +8 -75
- data/lib/dvdprofiler2xbmc/{media_files.rb → models/media_files.rb} +2 -3
- data/lib/dvdprofiler2xbmc/models/tmdb_movie.rb +136 -0
- data/lib/dvdprofiler2xbmc/models/tmdb_profile.rb +112 -0
- data/lib/dvdprofiler2xbmc/models/xbmc_info.rb +124 -0
- data/lib/dvdprofiler2xbmc/open_cache_extension.rb +39 -0
- data/lib/dvdprofiler2xbmc/views/cli.rb +171 -0
- data/spec/cache_extensions.rb +120 -0
- data/spec/dvdprofiler2xbmc_spec.rb +101 -0
- data/spec/dvdprofiler_profile_spec.rb +51 -0
- data/spec/imdb_profile_spec.rb +60 -0
- data/spec/nfo_controller_spec.rb +76 -0
- data/spec/samples/Collection.xml +273964 -0
- data/spec/samples/Die Hard - 1988.nfo +264 -0
- data/spec/samples/The Egg and I.dummy b/data/spec/samples/The Egg and → I.dummy +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/tmdb_movie_spec.rb +84 -0
- data/spec/tmdb_profile_spec.rb +105 -0
- data/spec/xbmc_info_spec.rb +68 -0
- data/tasks/rspec.rake +21 -0
- metadata +35 -11
- data/lib/dvdprofiler2xbmc/cli.rb +0 -128
- data/lib/dvdprofiler2xbmc/nfo.rb +0 -240
data/.gitignore
ADDED
data/History.txt
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
+
== 0.0.6 2009-04-08
|
2
|
+
added support for tmdb
|
3
|
+
added caching lookup data with movie (performance boost)
|
4
|
+
added specs which cache online lookups (first time slow, afterwards very fast)
|
1
5
|
|
6
|
+
== 0.0.4
|
2
7
|
ignore file backups and generated content
|
3
8
|
tab cleanup and added Music => Musical default genre mapping
|
4
9
|
tab cleanup
|
data/Manifest.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
.gitignore
|
1
2
|
History.txt
|
2
3
|
Manifest.txt
|
3
4
|
PostInstall.txt
|
@@ -6,11 +7,37 @@ Rakefile
|
|
6
7
|
bin/dvdprofiler2xbmc
|
7
8
|
dvdprofiler2xbmc.gemspec
|
8
9
|
lib/dvdprofiler2xbmc.rb
|
9
|
-
lib/dvdprofiler2xbmc/app.rb
|
10
10
|
lib/dvdprofiler2xbmc/app_config.rb
|
11
|
-
lib/dvdprofiler2xbmc/
|
12
|
-
lib/dvdprofiler2xbmc/
|
11
|
+
lib/dvdprofiler2xbmc/controllers/app.rb
|
12
|
+
lib/dvdprofiler2xbmc/controllers/fanart_controller.rb
|
13
|
+
lib/dvdprofiler2xbmc/controllers/nfo_controller.rb
|
14
|
+
lib/dvdprofiler2xbmc/controllers/thumbnail_controller.rb
|
13
15
|
lib/dvdprofiler2xbmc/extensions.rb
|
14
|
-
lib/dvdprofiler2xbmc/
|
15
|
-
lib/dvdprofiler2xbmc/
|
16
|
-
lib/dvdprofiler2xbmc/
|
16
|
+
lib/dvdprofiler2xbmc/models/collection.rb
|
17
|
+
lib/dvdprofiler2xbmc/models/dvdprofiler_profile.rb
|
18
|
+
lib/dvdprofiler2xbmc/models/imdb_profile.rb
|
19
|
+
lib/dvdprofiler2xbmc/models/media.rb
|
20
|
+
lib/dvdprofiler2xbmc/models/media_files.rb
|
21
|
+
lib/dvdprofiler2xbmc/models/tmdb_movie.rb
|
22
|
+
lib/dvdprofiler2xbmc/models/tmdb_profile.rb
|
23
|
+
lib/dvdprofiler2xbmc/models/xbmc_info.rb
|
24
|
+
lib/dvdprofiler2xbmc/open_cache_extension.rb
|
25
|
+
lib/dvdprofiler2xbmc/views/cli.rb
|
26
|
+
spec/cache_extensions.rb
|
27
|
+
spec/dvdprofiler2xbmc_spec.rb
|
28
|
+
spec/dvdprofiler_profile_spec.rb
|
29
|
+
spec/imdb_profile_spec.rb
|
30
|
+
spec/nfo_controller_spec.rb
|
31
|
+
spec/samples/Collection.xml
|
32
|
+
spec/samples/Collection.yaml
|
33
|
+
spec/samples/Die Hard - 1988.nfo
|
34
|
+
spec/samples/The Egg and I.dummy
|
35
|
+
spec/spec.opts
|
36
|
+
spec/spec_helper.rb
|
37
|
+
spec/tmdb_movie_spec.rb
|
38
|
+
spec/tmdb_profile_spec.rb
|
39
|
+
spec/xbmc_info_spec.rb
|
40
|
+
tasks/rspec.rake
|
41
|
+
test/test_dvdprofiler2xbmc.rb
|
42
|
+
test/test_dvdprofiler2xbmc_cli.rb
|
43
|
+
test/test_helper.rb
|
data/PostInstall.txt
CHANGED
@@ -1,7 +1,58 @@
|
|
1
|
+
First check the version by running:
|
1
2
|
|
2
|
-
|
3
|
+
$ bin/dvdprofiler2xbmc -v
|
4
|
+
INFO dvdprofiler2xbmc: Dvdprofiler2xbmc 0.0.4
|
5
|
+
INFO dvdprofiler2xbmc: saving: /home/royw/.dvdprofiler2xbmcrc
|
3
6
|
|
4
|
-
|
5
|
-
|
7
|
+
Notice that this generated a config file for you
|
8
|
+
(/home/royw/.dvdprofiler2xbmcrc) in your home directory.
|
6
9
|
|
10
|
+
Now edit the config file. Be sure to change the following fields to match
|
11
|
+
your system:
|
12
|
+
|
13
|
+
collection_filespec: /home/royw/DVD Profiler/Shared/Collection.xml
|
14
|
+
images_dir: /home/royw/DVD Profiler/Shared/Images
|
15
|
+
directories:
|
16
|
+
- /media/dad-kubuntu/public/data/videos_iso
|
17
|
+
- /media/dcerouter/public/data/videos_iso
|
18
|
+
- /media/royw-gentoo/public/data/videos_iso
|
19
|
+
- /media/royw-gentoo/public/data/movies
|
20
|
+
genre_maps: !map:Mash
|
21
|
+
Anime: Animation
|
22
|
+
Science-Fiction: Science Fiction
|
23
|
+
SciFi: Science Fiction
|
24
|
+
Musical: Musicals
|
25
|
+
|
26
|
+
The "collection_filespec" points to the collection.xml file exported by
|
27
|
+
DVD Profiler.
|
28
|
+
|
29
|
+
The "images_dir" points to the directory containing the images (cover scans)
|
30
|
+
from DVD Profiler.
|
31
|
+
|
32
|
+
The "directories" are the top level directories of where your media is
|
33
|
+
stored. Note, may be mount points or symbolic links.
|
34
|
+
|
35
|
+
The "genre_maps" is a list of genres to rename. In the above example,
|
36
|
+
"Anime" will be renamed "Animation", "Science-Fiction" will be renamed
|
37
|
+
"Science Fiction", etc.
|
38
|
+
|
39
|
+
You may want to adjust these also:
|
40
|
+
|
41
|
+
file_permissions: 436
|
42
|
+
dir_permissions: 511
|
43
|
+
|
44
|
+
Note the permissions are the base 10 integer of the octal permission mask.
|
45
|
+
For example, 436 (base 10) is 664 (base 8) and 511 (base 10) is 777 (base 8).
|
46
|
+
|
47
|
+
Save the .dvdprofiler2xbmcrc file.
|
48
|
+
|
49
|
+
You may want to get the command line help by running:
|
50
|
+
|
51
|
+
dvdprofiler2xbmc --help
|
52
|
+
|
53
|
+
To process your media, simply run:
|
54
|
+
|
55
|
+
dvdprofiler2xbmc
|
56
|
+
|
57
|
+
For more information on dvdprofiler2xbmc, see http://www/github.com/royw/dvdprofiler2xbmc
|
7
58
|
|
data/README.rdoc
CHANGED
@@ -5,14 +5,11 @@
|
|
5
5
|
== STATUS
|
6
6
|
|
7
7
|
The initial goal of using DVD Profiler data when available along
|
8
|
-
with IMDB data otherwise is
|
9
|
-
performance issues mainly related to using the production or
|
10
|
-
released years to refine searches that have multiple title matches.
|
8
|
+
with IMDB data otherwise is met.
|
11
9
|
|
12
10
|
Near term plans include:
|
13
11
|
* supporting multiple file matching patterns
|
14
12
|
* supporting directory containers
|
15
|
-
* interfacing to TMDb, primarily for fanart.
|
16
13
|
|
17
14
|
== DESCRIPTION:
|
18
15
|
|
@@ -20,12 +17,35 @@ This script will attempt to match up media files from a set of directories
|
|
20
17
|
to the collection.xml file exported from DVD Profiler. For matches, the
|
21
18
|
script will then create a {moviename}.nfo from the data in collections.xml
|
22
19
|
and also copy the front cover image to {moviename}.tbn. Both files will
|
23
|
-
be placed in the same directory as the source media file.
|
20
|
+
be placed in the same directory as the source media file. Also the specific
|
21
|
+
profile information for each movie will be saved into
|
22
|
+
{moviename}.dvdprofiler.xml.
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
The script will then search IMDB for a title or also known as (AKA) match.
|
25
|
+
If necessary, the script will refine the search by using the media year
|
26
|
+
(year in media filename), then dvdprofiler production year, then dvdprofiler
|
27
|
+
release year, then try again with each year plus or minus a year. The IMDB
|
28
|
+
profile found will be saved as {moviename}.imdb.xml.
|
29
|
+
|
30
|
+
Next the script will use the IMDB ID to query themovieDb.com. This is
|
31
|
+
primarily to retrieve any fanart but will also add any missing parameters
|
32
|
+
to the .nfo file (very unlikely). The TMDB profile found will be saved as
|
33
|
+
{moviename}.tmdb.xml.
|
34
|
+
|
35
|
+
So in summary the files generated are:
|
36
|
+
|
37
|
+
{moviename}.tmdb.xml - profile from themovieDb.com
|
38
|
+
{moviename}.imdb.xml - profile from imdb.com
|
39
|
+
{moviename}.dvdprofiler.xml - profile from collection.xml
|
40
|
+
{moviename}-fanart.jpg - first fanart image from themovieDb.com
|
41
|
+
{moviename}.tbn - image from DVD Profiler
|
42
|
+
{moviename}.nfo - generated info profile for xbmc
|
43
|
+
|
44
|
+
To force regeneration, simply delete these files then run the script again.
|
45
|
+
|
46
|
+
Then on XBMC, set the source content to none to remove the meta data from the
|
47
|
+
library, then set the source content back to Movies to import the media.
|
48
|
+
This time, the data in the .nfo files will be used instead of scraping.
|
29
49
|
|
30
50
|
== NOTES:
|
31
51
|
|
@@ -45,12 +65,19 @@ include these in the title.
|
|
45
65
|
|
46
66
|
Features:
|
47
67
|
|
48
|
-
* Creates .nfo files from exported collection.xml from DVD Profiler
|
68
|
+
* Creates .nfo files from exported collection.xml from DVD Profiler and
|
69
|
+
imdb.com.
|
49
70
|
* If .nfo does not have an <id> tag, then tries to find the IMDB ID by
|
50
71
|
using the title and production/release years to search IMDB.
|
51
72
|
* Sets file permissions for files and directories
|
52
73
|
* Media can be contained in a set of directories (they can be mount points)
|
53
74
|
* Adds sub-directory names as genres to .nfo files
|
75
|
+
* To prevent reporting missing ISBN, "touch {moviename}.no_isbn" (this is
|
76
|
+
useful to ignore boxed sets)
|
77
|
+
* To prevent lookup on imdb, "touch {moviename}.no_imdb_lookup" (this is
|
78
|
+
useful for titles you know are not on imdb.com)
|
79
|
+
* To prevent lookup on tmdb, "touch {moviename}.no_tmdb_lookup" (this is
|
80
|
+
useful for titles you know are not on themovieDb.com)
|
54
81
|
|
55
82
|
Problems:
|
56
83
|
|
@@ -127,7 +154,7 @@ To process your media, simply run:
|
|
127
154
|
|
128
155
|
* ruby 1.8.x
|
129
156
|
* rubygem
|
130
|
-
* my imdb fork on github (gem install )
|
157
|
+
* my imdb fork on github (sudo gem install royw-imdb)
|
131
158
|
|
132
159
|
== INSTALL:
|
133
160
|
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ $hoe = Hoe.new('dvdprofiler2xbmc', Dvdprofiler2xbmc::VERSION) do |p|
|
|
11
11
|
p.extra_deps = [
|
12
12
|
['activesupport','>= 2.0.2'],
|
13
13
|
['xml-simple','>= 1.0.12'],
|
14
|
-
['royw-imdb','>= 0.0.
|
14
|
+
['royw-imdb','>= 0.0.16'],
|
15
15
|
['log4r','>= 1.0.5'],
|
16
16
|
['commandline','>= 0.7.10'],
|
17
17
|
['mash','>= 0.0.3']
|
data/bin/dvdprofiler2xbmc
CHANGED
data/dvdprofiler2xbmc.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{dvdprofiler2xbmc}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Roy Wright"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-04-08}
|
10
10
|
s.default_executable = %q{dvdprofiler2xbmc}
|
11
|
-
s.description = %q{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. 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.
|
11
|
+
s.description = %q{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.}
|
12
12
|
s.email = ["roy@wright.org"]
|
13
13
|
s.executables = ["dvdprofiler2xbmc"]
|
14
14
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
|
15
|
-
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/dvdprofiler2xbmc", "dvdprofiler2xbmc.gemspec", "lib/dvdprofiler2xbmc.rb", "lib/dvdprofiler2xbmc/app.rb", "lib/dvdprofiler2xbmc/
|
15
|
+
s.files = [".gitignore", "History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/dvdprofiler2xbmc", "dvdprofiler2xbmc.gemspec", "lib/dvdprofiler2xbmc.rb", "lib/dvdprofiler2xbmc/app_config.rb", "lib/dvdprofiler2xbmc/controllers/app.rb", "lib/dvdprofiler2xbmc/controllers/fanart_controller.rb", "lib/dvdprofiler2xbmc/controllers/nfo_controller.rb", "lib/dvdprofiler2xbmc/controllers/thumbnail_controller.rb", "lib/dvdprofiler2xbmc/extensions.rb", "lib/dvdprofiler2xbmc/models/collection.rb", "lib/dvdprofiler2xbmc/models/dvdprofiler_profile.rb", "lib/dvdprofiler2xbmc/models/imdb_profile.rb", "lib/dvdprofiler2xbmc/models/media.rb", "lib/dvdprofiler2xbmc/models/media_files.rb", "lib/dvdprofiler2xbmc/models/tmdb_movie.rb", "lib/dvdprofiler2xbmc/models/tmdb_profile.rb", "lib/dvdprofiler2xbmc/models/xbmc_info.rb", "lib/dvdprofiler2xbmc/open_cache_extension.rb", "lib/dvdprofiler2xbmc/views/cli.rb", "spec/cache_extensions.rb", "spec/dvdprofiler2xbmc_spec.rb", "spec/dvdprofiler_profile_spec.rb", "spec/imdb_profile_spec.rb", "spec/nfo_controller_spec.rb", "spec/samples/Collection.xml", "spec/samples/Collection.yaml", "spec/samples/Die Hard - 1988.nfo", "spec/samples/The Egg and I.dummy", "spec/spec.opts", "spec/spec_helper.rb", "spec/tmdb_movie_spec.rb", "spec/tmdb_profile_spec.rb", "spec/xbmc_info_spec.rb", "tasks/rspec.rake", "test/test_dvdprofiler2xbmc.rb", "test/test_dvdprofiler2xbmc_cli.rb", "test/test_helper.rb"]
|
16
16
|
s.has_rdoc = true
|
17
17
|
s.homepage = %q{http://www.github.com/royw/dvdprofiler2xbmc}
|
18
18
|
s.post_install_message = %q{PostInstall.txt}
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
31
31
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
|
32
32
|
s.add_runtime_dependency(%q<xml-simple>, [">= 1.0.12"])
|
33
|
-
s.add_runtime_dependency(%q<royw-imdb>, [">= 0.0.
|
33
|
+
s.add_runtime_dependency(%q<royw-imdb>, [">= 0.0.16"])
|
34
34
|
s.add_runtime_dependency(%q<log4r>, [">= 1.0.5"])
|
35
35
|
s.add_runtime_dependency(%q<commandline>, [">= 0.7.10"])
|
36
36
|
s.add_runtime_dependency(%q<mash>, [">= 0.0.3"])
|
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
else
|
40
40
|
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
41
41
|
s.add_dependency(%q<xml-simple>, [">= 1.0.12"])
|
42
|
-
s.add_dependency(%q<royw-imdb>, [">= 0.0.
|
42
|
+
s.add_dependency(%q<royw-imdb>, [">= 0.0.16"])
|
43
43
|
s.add_dependency(%q<log4r>, [">= 1.0.5"])
|
44
44
|
s.add_dependency(%q<commandline>, [">= 0.7.10"])
|
45
45
|
s.add_dependency(%q<mash>, [">= 0.0.3"])
|
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
else
|
50
50
|
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
51
51
|
s.add_dependency(%q<xml-simple>, [">= 1.0.12"])
|
52
|
-
s.add_dependency(%q<royw-imdb>, [">= 0.0.
|
52
|
+
s.add_dependency(%q<royw-imdb>, [">= 0.0.16"])
|
53
53
|
s.add_dependency(%q<log4r>, [">= 1.0.5"])
|
54
54
|
s.add_dependency(%q<commandline>, [">= 0.7.10"])
|
55
55
|
s.add_dependency(%q<mash>, [">= 0.0.3"])
|
data/lib/dvdprofiler2xbmc.rb
CHANGED
@@ -8,16 +8,24 @@ require 'ftools'
|
|
8
8
|
require 'imdb'
|
9
9
|
require 'mash'
|
10
10
|
require 'log4r'
|
11
|
+
require 'ruby-debug'
|
11
12
|
|
12
|
-
require 'dvdprofiler2xbmc/app'
|
13
13
|
require 'dvdprofiler2xbmc/app_config'
|
14
|
-
require 'dvdprofiler2xbmc/collection'
|
15
14
|
require 'dvdprofiler2xbmc/extensions'
|
16
|
-
require 'dvdprofiler2xbmc/
|
17
|
-
require 'dvdprofiler2xbmc/
|
18
|
-
require 'dvdprofiler2xbmc/
|
19
|
-
require 'dvdprofiler2xbmc/
|
15
|
+
require 'dvdprofiler2xbmc/controllers/app'
|
16
|
+
require 'dvdprofiler2xbmc/controllers/fanart_controller'
|
17
|
+
require 'dvdprofiler2xbmc/controllers/nfo_controller'
|
18
|
+
require 'dvdprofiler2xbmc/controllers/thumbnail_controller'
|
19
|
+
require 'dvdprofiler2xbmc/models/collection'
|
20
|
+
require 'dvdprofiler2xbmc/models/dvdprofiler_profile'
|
21
|
+
require 'dvdprofiler2xbmc/models/imdb_profile'
|
22
|
+
require 'dvdprofiler2xbmc/models/media'
|
23
|
+
require 'dvdprofiler2xbmc/models/media_files'
|
24
|
+
require 'dvdprofiler2xbmc/models/tmdb_movie'
|
25
|
+
require 'dvdprofiler2xbmc/models/tmdb_profile'
|
26
|
+
require 'dvdprofiler2xbmc/models/xbmc_info'
|
27
|
+
|
20
28
|
|
21
29
|
module Dvdprofiler2xbmc
|
22
|
-
VERSION = '0.0.
|
30
|
+
VERSION = '0.0.6'
|
23
31
|
end
|
@@ -82,11 +82,20 @@ module AppConfig
|
|
82
82
|
@config.image_extensions = [ 'jpg', 'jpeg', 'png', 'gif' ]
|
83
83
|
@config.nfo_extensions = [ 'nfo' ]
|
84
84
|
# Destination file extensions
|
85
|
-
@config.thumbnail_extension
|
86
|
-
@config.nfo_extension
|
87
|
-
@config.
|
88
|
-
@config.
|
89
|
-
@config.no_isbn_extension
|
85
|
+
@config.thumbnail_extension = 'tbn'
|
86
|
+
@config.nfo_extension = 'nfo'
|
87
|
+
@config.no_imdb_extension = 'no_imdb_lookup'
|
88
|
+
@config.no_tmdb_extension = 'no_tmdb_lookup'
|
89
|
+
@config.no_isbn_extension = 'no_isbn'
|
90
|
+
@config.dvdprofiler_xml_extension = 'dvdprofiler.xml'
|
91
|
+
@config.dvdprofiler_yaml_extension = 'dvdprofiler.yaml'
|
92
|
+
@config.imdb_xml_extension = 'imdb.xml'
|
93
|
+
@config.imdb_yaml_extension = 'imdb.yaml'
|
94
|
+
@config.tmdb_xml_extension = 'tmdb.xml'
|
95
|
+
@config.tmdb_yaml_extension = 'tmdb.yaml'
|
96
|
+
@config.fanart_extension = '-fanart'
|
97
|
+
@config.new_extension = '.new'
|
98
|
+
@config.backup_extension = '~'
|
90
99
|
|
91
100
|
# map some genre names
|
92
101
|
@config.genre_maps = {
|
@@ -100,6 +109,7 @@ module AppConfig
|
|
100
109
|
@config.file_permissions = 0664
|
101
110
|
@config.dir_permissions = 0777
|
102
111
|
@config.imdb_query = true
|
112
|
+
@config.tmdb_query = true
|
103
113
|
@config.do_update = true
|
104
114
|
end
|
105
115
|
end
|
@@ -29,16 +29,16 @@ class DvdProfiler2Xbmc
|
|
29
29
|
|
30
30
|
# the application's main execution loop
|
31
31
|
def execute
|
32
|
-
AppConfig[:logger].info { "
|
33
|
-
collection_filepath = File.expand_path(AppConfig[:collection_filespec])
|
34
|
-
collection = Collection.new(collection_filepath)
|
32
|
+
AppConfig[:logger].info { "Media Directories:\n #{AppConfig[:directories].join("\n ")}" }
|
35
33
|
|
36
|
-
@media_files = MediaFiles.new(AppConfig[:directories]
|
34
|
+
@media_files = MediaFiles.new(AppConfig[:directories])
|
37
35
|
@media_files.titles.each do |title, medias|
|
38
36
|
break if DvdProfiler2Xbmc.interrupted?
|
39
37
|
medias.each do |media|
|
40
|
-
media
|
41
|
-
|
38
|
+
# note, NfoController update must be first as it sets isbn and imdb_id for media
|
39
|
+
NfoController.update(media)
|
40
|
+
ThumbnailController.update(media)
|
41
|
+
FanartController.update(media)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# == Synopsis
|
2
|
+
# Media encapsulates information about a single media file
|
3
|
+
#
|
4
|
+
# Usage:
|
5
|
+
# controller = FanartController.new(media)
|
6
|
+
# controller.update
|
7
|
+
# or
|
8
|
+
# FanartController.update(media)
|
9
|
+
class FanartController
|
10
|
+
attr_reader :media_path, :image_files, :year, :media_subdirs, :title, :title_with_year
|
11
|
+
|
12
|
+
def self.update(media)
|
13
|
+
FanartController.new(media).update
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(media)
|
17
|
+
@media = media
|
18
|
+
end
|
19
|
+
|
20
|
+
# update the meta-data and thumbnails
|
21
|
+
def update
|
22
|
+
result = true
|
23
|
+
unless @media.imdb_id.blank?
|
24
|
+
if @media.fanart_files.empty?
|
25
|
+
fetch_fanart(@media.imdb_id)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
result
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
|
33
|
+
DISC_NUMBER_REGEX = /\.(cd|part|disk|disc)\d+/i
|
34
|
+
|
35
|
+
# TODO this only fetches the first fanart. Probably should fetch
|
36
|
+
# all fanart but will need a naming scheme. Need to research what
|
37
|
+
# the other xbmc utilities are doing.
|
38
|
+
def fetch_fanart(imdb_id)
|
39
|
+
profile = TmdbProfile.new(imdb_id, @media.path_to(:tmdb_xml_extension))
|
40
|
+
unless profile.nil? || profile.movie.blank?
|
41
|
+
movie = profile.movie
|
42
|
+
unless movie['fanarts'].blank?
|
43
|
+
fanart = movie['fanarts'].first
|
44
|
+
AppConfig[:logger].debug { "#{fanart.inspect}" }
|
45
|
+
src_url = fanart['content']
|
46
|
+
unless src_url.blank?
|
47
|
+
fanart_filename = File.basename(@media.media_path, ".*").gsub(DISC_NUMBER_REGEX, '')
|
48
|
+
fanart_filename += AppConfig[:fanart_extension]
|
49
|
+
fanart_filename += File.extname(src_url)
|
50
|
+
dest_filespec = File.join(File.dirname(@media.media_path), fanart_filename)
|
51
|
+
unless File.exist?(dest_filespec)
|
52
|
+
AppConfig[:logger].info { "src_url => #{src_url}" }
|
53
|
+
AppConfig[:logger].info { "dest_fanart_filespec => #{dest_filespec}" }
|
54
|
+
copy_fanart(src_url, dest_filespec)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# download the fanart
|
62
|
+
def copy_fanart(src_url, dest_filespec)
|
63
|
+
begin
|
64
|
+
data = open(src_url).read
|
65
|
+
File.open(dest_filespec, 'w') do |file|
|
66
|
+
file.print(data)
|
67
|
+
end
|
68
|
+
rescue Exception => e
|
69
|
+
AppConfig[:logger].error { "Error fetching fanart.\n src_url => #{src_url},\n dest_filespec => #{dest_filespec}\n #{e.to_s}" }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|