royw-dvdprofiler2xbmc 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/VERSION.yml +1 -1
- data/lib/dvdprofiler2xbmc/app_config.rb +8 -8
- data/lib/dvdprofiler2xbmc/controllers/app.rb +8 -8
- data/lib/dvdprofiler2xbmc/controllers/nfo_controller.rb +12 -6
- data/lib/dvdprofiler2xbmc/models/dvdprofiler_info.rb +15 -1
- data/lib/dvdprofiler2xbmc/models/media.rb +2 -1
- data/spec/dvdprofiler2xbmc_spec.rb +10 -8
- data/spec/nfo_controller_spec.rb +48 -6
- data/spec/samples/Collection.xml +374 -177
- data/spec/samples/api.themoviedb.org/2.0/{Movie.imdbLookup?imdb_id=tt0060934&api_key=7a2f6eb9b6aa01651000f0a9324db835 → Movie.imdbLookup?imdb_id=tt0028390&api_key=7a2f6eb9b6aa01651000f0a9324db835} +2 -2
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0035958&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0047437&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0048445&api_key=7a2f6eb9b6aa01651000f0a9324db835 +22 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0048937&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0050562&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0053580&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0073636&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0084296&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0092494&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0102059&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0108171&api_key=7a2f6eb9b6aa01651000f0a9324db835 +1 -1
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0114319&api_key=7a2f6eb9b6aa01651000f0a9324db835 +22 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0114437&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0114924&api_key=7a2f6eb9b6aa01651000f0a9324db835 +1 -1
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0118617&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0213149&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0238112&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0276751&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0318974&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0368891&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0388976&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0407511&api_key=7a2f6eb9b6aa01651000f0a9324db835 +8 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0454824&api_key=7a2f6eb9b6aa01651000f0a9324db835 +26 -0
- data/spec/samples/api.themoviedb.org/2.0/Movie.imdbLookup?imdb_id=tt0465234&api_key=7a2f6eb9b6aa01651000f0a9324db835 +1 -1
- data/spec/samples/www.imdb.com/find?q=%2Abatteries+not+included;s=tt +16 -11
- data/spec/samples/www.imdb.com/find?q=About+a+Boy;s=tt +16 -11
- data/spec/samples/www.imdb.com/find?q=Alexander+the+Great;s=tt +15 -10
- data/spec/samples/www.imdb.com/find?q=Anastasia;s=tt +16 -11
- data/spec/samples/www.imdb.com/find?q=Call+Me%3A+The+Rise+and+Fall+of+Heidi+Fleiss;s=tt +21 -16
- data/spec/samples/www.imdb.com/find?q=Call+Me+The+Rise+and+Fall+of+Heidi+Fleiss;s=tt +835 -0
- data/spec/samples/www.imdb.com/find?q=Captain+Corelli%27s+Mandolin;s=tt +21 -16
- data/spec/samples/www.imdb.com/find?q=Captain+Corelli+s+Mandolin;s=tt +522 -0
- data/spec/samples/www.imdb.com/find?q=Flyboys;s=tt +21 -16
- data/spec/samples/www.imdb.com/find?q=Gung+Ho%21;s=tt +15 -10
- data/spec/samples/www.imdb.com/find?q=Gung+Ho;s=tt +509 -0
- data/spec/samples/www.imdb.com/find?q=Hot+Shots%21;s=tt +15 -10
- data/spec/samples/www.imdb.com/find?q=Hot+Shots;s=tt +522 -0
- data/spec/samples/www.imdb.com/find?q=Jet+Pilot;s=tt +505 -0
- data/spec/samples/www.imdb.com/find?q=Meltdown;s=tt +15 -10
- data/spec/samples/www.imdb.com/find?q=Mexico+Whitetails;s=tt +461 -0
- data/spec/samples/www.imdb.com/{find?q=National+Treasure+2;s=tt → find?q=National+Treasure+2%3A+Book+of+Secrets;s=tt} +36 -40
- data/spec/samples/www.imdb.com/{find?q=National+Treasure%3A+Book+of+Secrets;s=tt → find?q=National+Treasure+2+Book+of+Secrets;s=tt} +65 -74
- data/spec/samples/www.imdb.com/find?q=National+Treasure;s=tt +527 -0
- data/spec/samples/www.imdb.com/find?q=Oklahoma%21;s=tt +16 -11
- data/spec/samples/www.imdb.com/find?q=Oklahoma;s=tt +522 -0
- data/spec/samples/www.imdb.com/find?q=Pearl+Harbor+Payback+%2F+Appointment+in+Tokyo;s=tt +461 -0
- data/spec/samples/www.imdb.com/find?q=Pearl+Harbor+Payback+Appointment+in+Tokyo;s=tt +461 -0
- data/spec/samples/www.imdb.com/find?q=Pearl+Harbor;s=tt +527 -0
- data/spec/samples/www.imdb.com/find?q=Rodeo+Racketeers%3A+John+Wayne+Young+Duke+Series;s=tt +461 -0
- data/spec/samples/www.imdb.com/find?q=Rodeo+Racketeers+John+Wayne+Young+Duke+Series;s=tt +461 -0
- data/spec/samples/www.imdb.com/find?q=Rooster+Cogburn+%28+and+the+Lady%29;s=tt +503 -0
- data/spec/samples/www.imdb.com/find?q=Rooster+Cogburn+%28...and+the+Lady%29;s=tt +15 -10
- data/spec/samples/www.imdb.com/{find?q=rooster+cogburn;s=tt → find?q=Rooster+Cogburn;s=tt} +41 -52
- data/spec/samples/www.imdb.com/find?q=Sabrina;s=tt +510 -0
- data/spec/samples/www.imdb.com/find?q=The+Adventures+of+Indiana+Jones%3A+The+Complete+DVD+Movie+Collection;s=tt +452 -0
- data/spec/samples/www.imdb.com/find?q=The+Adventures+of+Indiana+Jones+The+Complete+DVD+Movie+Collection;s=tt +452 -0
- data/spec/samples/www.imdb.com/find?q=The+Alamo+Documentary;s=tt +501 -0
- data/spec/samples/www.imdb.com/find?q=The+Alamo;s=tt +22 -26
- data/spec/samples/www.imdb.com/find?q=The+Egg+and+I;s=tt +23 -18
- data/spec/samples/www.imdb.com/find?q=The+Great+American+Western%3A+Volume+6;s=tt +452 -0
- data/spec/samples/www.imdb.com/find?q=The+Great+American+Western+Volume+6;s=tt +452 -0
- data/spec/samples/www.imdb.com/find?q=The+Man+from+Snowy+River;s=tt +15 -10
- data/spec/samples/www.imdb.com/find?q=The+Mummy+Collector%27s+Set;s=tt +452 -0
- data/spec/samples/www.imdb.com/find?q=The+Mummy+Collector+s+Set;s=tt +452 -0
- data/spec/samples/www.imdb.com/find?q=Topper+Topper+%26+Topper+Returns;s=tt +508 -0
- data/spec/samples/www.imdb.com/find?q=batteries+not+included;s=tt +522 -0
- metadata +54 -9
data/Rakefile
CHANGED
@@ -18,10 +18,10 @@ begin
|
|
18
18
|
gem.add_dependency('activesupport','>= 2.0.2')
|
19
19
|
gem.add_dependency('xml-simple','>= 1.0.12')
|
20
20
|
gem.add_dependency('royw-read_page_cache','>= 0.0.2')
|
21
|
-
gem.add_dependency('royw-roys_extensions','>= 0.0.
|
22
|
-
gem.add_dependency('royw-imdb','>= 0.1.
|
21
|
+
gem.add_dependency('royw-roys_extensions','>= 0.0.3')
|
22
|
+
gem.add_dependency('royw-imdb','>= 0.1.5')
|
23
23
|
gem.add_dependency('royw-tmdb','>= 0.1.6')
|
24
|
-
gem.add_dependency('royw-dvdprofiler_collection','>= 0.1.
|
24
|
+
gem.add_dependency('royw-dvdprofiler_collection','>= 0.1.4')
|
25
25
|
gem.add_dependency('log4r','>= 1.0.5')
|
26
26
|
gem.add_dependency('commandline','>= 0.7.10')
|
27
27
|
gem.add_dependency('mash','>= 0.0.3')
|
data/VERSION.yml
CHANGED
@@ -401,11 +401,11 @@ module AppConfig
|
|
401
401
|
].join("\n")
|
402
402
|
@initial.media_parsers = [
|
403
403
|
# "movie title - yyyy[res].partN.ext"
|
404
|
-
{:regex => /^\s*(.*\S)\s*\-\s*(
|
404
|
+
{:regex => /^\s*(.*\S)\s*\-\s*(0|\d{4})\s*\[(\S*)\]\s*\.(cd\d+|pt\d+|disk\d+|disc\d+)\.([^.]+)\s*$/,
|
405
405
|
:tokens => [:title, :year, :resolution, :part, :extension]
|
406
406
|
},
|
407
407
|
# "movie title (yyyy)[res].partN.ext"
|
408
|
-
{:regex => /^\s*(.*\S)\s*\(\s*(
|
408
|
+
{:regex => /^\s*(.*\S)\s*\(\s*(0|\d{4})\s*\)\s*\[(\S*)\]\s*\.(cd\d+|pt\d+|disk\d+|disc\d+)\.([^.]+)\s*$/,
|
409
409
|
:tokens => [:title, :year, :resolution, :part, :extension]
|
410
410
|
},
|
411
411
|
# "movie title[res].partN.ext"
|
@@ -413,11 +413,11 @@ module AppConfig
|
|
413
413
|
:tokens => [:title, :resolution, :part, :extension]
|
414
414
|
},
|
415
415
|
# "movie title - yyyy[res].ext"
|
416
|
-
{:regex => /^\s*(.*\S)\s*\-\s*(
|
416
|
+
{:regex => /^\s*(.*\S)\s*\-\s*(0|\d{4})\s*\[(\S*)\]\s*\.([^.]+)\s*$/,
|
417
417
|
:tokens => [:title, :year, :resolution, :extension]
|
418
418
|
},
|
419
419
|
# "movie title (yyyy)[res].ext"
|
420
|
-
{:regex => /^\s*(.*\S)\s*\(\s*(
|
420
|
+
{:regex => /^\s*(.*\S)\s*\(\s*(0|\d{4})\s*\)\s*\[(\S*)\]\s*\.([^.]+)\s*$/,
|
421
421
|
:tokens => [:title, :year, :resolution, :extension]
|
422
422
|
},
|
423
423
|
# "movie title[res].ext"
|
@@ -425,11 +425,11 @@ module AppConfig
|
|
425
425
|
:tokens => [:title, :resolution, :extension]
|
426
426
|
},
|
427
427
|
# "movie title - yyyy.partN.ext"
|
428
|
-
{:regex => /^\s*(.*\S)\s*\-\s*(
|
428
|
+
{:regex => /^\s*(.*\S)\s*\-\s*(0|\d{4})\s*\.(cd\d+|pt\d+|disk\d+|disc\d+)\.([^.]+)\s*$/,
|
429
429
|
:tokens => [:title, :year, :part, :extension]
|
430
430
|
},
|
431
431
|
# "movie title (yyyy).partN.ext"
|
432
|
-
{:regex => /^\s*(.*\S)\s*\(\s*(
|
432
|
+
{:regex => /^\s*(.*\S)\s*\(\s*(0|\d{4})\s*\)\s*\.(cd\d+|pt\d+|disk\d+|disc\d+)\.([^.]+)\s*$/,
|
433
433
|
:tokens => [:title, :year, :part, :extension]
|
434
434
|
},
|
435
435
|
# "movie title.partN.ext"
|
@@ -437,11 +437,11 @@ module AppConfig
|
|
437
437
|
:tokens => [:title, :part, :extension]
|
438
438
|
},
|
439
439
|
# "movie title - yyyy.ext"
|
440
|
-
{:regex => /^\s*(.*\S)\s*\-\s*(
|
440
|
+
{:regex => /^\s*(.*\S)\s*\-\s*(0|\d{4})\s*\.([^.]+)\s*$/,
|
441
441
|
:tokens => [:title, :year, :extension]
|
442
442
|
},
|
443
443
|
# "movie title (yyyy).ext"
|
444
|
-
{:regex => /^\s*(.*\S)\s*\(\s*(
|
444
|
+
{:regex => /^\s*(.*\S)\s*\(\s*(0|\d{4})\s*\)\s*\.([^.]+)\s*$/,
|
445
445
|
:tokens => [:title, :year, :extension]
|
446
446
|
},
|
447
447
|
# "movie title.ext"
|
@@ -14,25 +14,25 @@ class DvdProfiler2Xbmc
|
|
14
14
|
# protected initializer because it is a Singleton class
|
15
15
|
def initialize
|
16
16
|
@media_files = nil
|
17
|
-
@multiple_profiles = []
|
18
17
|
end
|
19
18
|
|
20
19
|
public
|
21
20
|
|
22
|
-
# == Synopsis
|
23
|
-
# An Array of Strings that the external processing my write to to
|
24
|
-
# indicate that a given title has multiple ISBNs.
|
25
|
-
# HACK, this is a hack because I didn't see a way to cleanly pass
|
26
|
-
# the data up from the processing.
|
27
|
-
attr_accessor :multiple_profiles
|
28
|
-
|
29
21
|
@interrupted = false
|
30
22
|
@interrupt_message = "control-C detected, finishing current task"
|
23
|
+
@multiple_profiles = []
|
31
24
|
|
32
25
|
class << self
|
33
26
|
# == Synopsis
|
34
27
|
# When ^C is pressed, this message is sent to stdout
|
35
28
|
attr_accessor :interrupt_message
|
29
|
+
|
30
|
+
# == Synopsis
|
31
|
+
# An Array of Strings that the external processing my write to to
|
32
|
+
# indicate that a given title has multiple ISBNs.
|
33
|
+
# HACK, this is a hack because I didn't see a way to cleanly pass
|
34
|
+
# the data up from the processing.
|
35
|
+
attr_accessor :multiple_profiles
|
36
36
|
end
|
37
37
|
|
38
38
|
# == Synopsis
|
@@ -17,6 +17,8 @@
|
|
17
17
|
# NfoController.update(media)
|
18
18
|
class NfoController
|
19
19
|
|
20
|
+
attr_reader :info
|
21
|
+
|
20
22
|
# == Synopsis
|
21
23
|
def self.update(media)
|
22
24
|
NfoController.new(media).update
|
@@ -44,18 +46,22 @@ class NfoController
|
|
44
46
|
self.isbn ||= load_isbn_id
|
45
47
|
self.imdb_id ||= load_imdb_id
|
46
48
|
|
47
|
-
|
49
|
+
extra_titles = []
|
48
50
|
production_years = []
|
49
51
|
released_years = []
|
50
52
|
|
51
53
|
dvdprofiler_info = load_dvdprofiler_info
|
52
54
|
unless dvdprofiler_info.nil?
|
55
|
+
original_titles = dvdprofiler_info.original_titles
|
53
56
|
box_set_parent_titles = dvdprofiler_info.box_set_parent_titles
|
57
|
+
extra_titles << dvdprofiler_info.title unless dvdprofiler_info.title.blank?
|
58
|
+
extra_titles += original_titles unless original_titles.blank?
|
59
|
+
extra_titles += box_set_parent_titles unless box_set_parent_titles.blank?
|
54
60
|
production_years = dvdprofiler_info.production_years
|
55
61
|
released_years = dvdprofiler_info.released_years
|
56
62
|
end
|
57
63
|
|
58
|
-
imdb_info = load_imdb_info(
|
64
|
+
imdb_info = load_imdb_info(extra_titles, production_years, released_years)
|
59
65
|
unless imdb_info.nil?
|
60
66
|
self.imdb_id ||= imdb_info.imdb_id
|
61
67
|
end
|
@@ -134,10 +140,10 @@ class NfoController
|
|
134
140
|
dvdprofiler_info
|
135
141
|
end
|
136
142
|
|
137
|
-
def load_imdb_info(
|
143
|
+
def load_imdb_info(extra_titles, production_years, released_years)
|
138
144
|
imdb_info = nil
|
139
145
|
unless File.exist?(@media.path_to(:no_imdb_lookup))
|
140
|
-
possible_imdb_titles = get_imdb_titles(
|
146
|
+
possible_imdb_titles = get_imdb_titles(extra_titles)
|
141
147
|
imdb_info = ImdbInfo.find(:imdb_id => self.imdb_id,
|
142
148
|
:titles => possible_imdb_titles,
|
143
149
|
:media_years => [@media.year.to_i],
|
@@ -206,11 +212,11 @@ class NfoController
|
|
206
212
|
|
207
213
|
# == Synopsis
|
208
214
|
# get an Array of String titles
|
209
|
-
def get_imdb_titles(
|
215
|
+
def get_imdb_titles(extra_titles)
|
210
216
|
titles = []
|
211
217
|
titles << @info['title'] unless @info['title'].blank?
|
212
218
|
titles << @media.title unless @media.title.blank?
|
213
|
-
titles +=
|
219
|
+
titles += extra_titles
|
214
220
|
titles.uniq.compact
|
215
221
|
end
|
216
222
|
|
@@ -9,11 +9,13 @@ class DvdprofilerInfo
|
|
9
9
|
# really should include at least: :title, :year, :isbn, :filespec
|
10
10
|
def self.find(options)
|
11
11
|
dvdprofiler_info = nil
|
12
|
+
# replace options[:year] => 0 with nil
|
13
|
+
options[:year] = (options[:year].to_i > 0 ? options[:year] : nil) unless options[:year].blank?
|
12
14
|
# find ISBN for each title and assign to the media
|
13
15
|
profiles = DvdprofilerProfile.all(options)
|
14
16
|
if profiles.length > 1
|
15
17
|
media_title = "#{options[:title]}#{options[:year].blank? ? '' : ' (' + options[:year] + ')'}"
|
16
|
-
|
18
|
+
DvdProfiler2Xbmc.multiple_profiles << "#{media_title} #{profiles.collect{|prof| prof.isbn}.join(", ")}"
|
17
19
|
AppConfig[:logger].warn { "Multiple profiles found for #{media_title}" }
|
18
20
|
else
|
19
21
|
profile = profiles.first
|
@@ -105,4 +107,16 @@ class DvdprofilerInfo
|
|
105
107
|
def released_years
|
106
108
|
@profile.dvd_hash[:released] rescue []
|
107
109
|
end
|
110
|
+
|
111
|
+
def original_titles
|
112
|
+
titles = []
|
113
|
+
originaltitle = @profile.dvd_hash[:originaltitle]
|
114
|
+
titles = [originaltitle].flatten.uniq.compact unless originaltitle.blank?
|
115
|
+
titles = titles.collect{|t| t.blank? ? nil : t}.compact
|
116
|
+
titles
|
117
|
+
end
|
118
|
+
|
119
|
+
def title
|
120
|
+
@profile.dvd_hash[:title] rescue nil
|
121
|
+
end
|
108
122
|
end
|
@@ -69,6 +69,7 @@ class Media
|
|
69
69
|
components = Media.parse(@media_path)
|
70
70
|
unless components.nil?
|
71
71
|
@year = components[:year]
|
72
|
+
@year = (@year.to_i > 0 ? @year : nil) unless @year.blank?
|
72
73
|
@title = components[:title]
|
73
74
|
@part = components[:part]
|
74
75
|
@extension = components[:extension]
|
@@ -140,7 +141,7 @@ class Media
|
|
140
141
|
# return the media's title but with the (year) appended
|
141
142
|
def find_title_with_year(title, year)
|
142
143
|
name = title
|
143
|
-
name = "#{name} (#{year})" unless year.
|
144
|
+
name = "#{name} (#{year})" unless year.blank?
|
144
145
|
name
|
145
146
|
end
|
146
147
|
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
3
3
|
require 'tempfile'
|
4
4
|
|
5
|
-
FULL_REGRESSION =
|
5
|
+
FULL_REGRESSION = true
|
6
6
|
|
7
7
|
# Time to add your specs!
|
8
8
|
# http://rspec.info/
|
@@ -46,7 +46,7 @@ describe "Dvdprofiler2xbmc" do
|
|
46
46
|
'Meltdown',
|
47
47
|
'Oklahoma!',
|
48
48
|
'The Man From Snowy River',
|
49
|
-
'Rooster Cogburn',
|
49
|
+
'Rooster Cogburn (...and the Lady)',
|
50
50
|
'Call Me The Rise And Fall of Heidi Fleiss',
|
51
51
|
'batteries not included',
|
52
52
|
'Flyboys',
|
@@ -58,11 +58,13 @@ describe "Dvdprofiler2xbmc" do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
if FULL_REGRESSION
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
DvdprofilerProfile.collection_filespec = File.join(SAMPLES_DIR, 'Collection.xml')
|
62
|
+
profiles = DvdprofilerProfile.all
|
63
|
+
titles = profiles.collect{|profile| profile.title}
|
64
|
+
titles.sort.each do |title|
|
65
|
+
it "should find all Collection titles (full regression) title=>#{title}" do
|
66
|
+
regression([title]).should == []
|
67
|
+
end
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
@@ -82,7 +84,7 @@ describe "Dvdprofiler2xbmc" do
|
|
82
84
|
dvd_hash = dvdprofiler_profile.dvd_hash
|
83
85
|
unless dvd_hash[:genres].include?('Television')
|
84
86
|
count += 1
|
85
|
-
imdb_profile = ImdbProfile.first(:titles => [dvd_hash[:title], title],
|
87
|
+
imdb_profile = ImdbProfile.first(:titles => [dvd_hash[:title], title, dvd_hash[:originaltitle]].uniq.compact,
|
86
88
|
:production_years => dvd_hash[:productionyear],
|
87
89
|
:released_years => dvd_hash[:released],
|
88
90
|
:logger => AppConfig[:logger])
|
data/spec/nfo_controller_spec.rb
CHANGED
@@ -32,8 +32,12 @@ describe "NfoController" do
|
|
32
32
|
# AppConfig[:logger].info { "media path => " + @media.media_path }
|
33
33
|
end
|
34
34
|
|
35
|
-
after(:
|
35
|
+
after(:each) do
|
36
36
|
Dir.glob(File.join(TMPDIR, "nfo_controller_spec*")).each { |filename| File.delete(filename) }
|
37
|
+
Dir.glob(File.join(TMPDIR, "*.m4v")).each { |filename| File.delete(filename) }
|
38
|
+
Dir.glob(File.join(TMPDIR, "*.nfo")).each { |filename| File.delete(filename) }
|
39
|
+
Dir.glob(File.join(TMPDIR, "*.xml")).each { |filename| File.delete(filename) }
|
40
|
+
Dir.glob(File.join(TMPDIR, "*.dummy")).each { |filename| File.delete(filename) }
|
37
41
|
[:imdb_xml, :tmdb_xml, :nfo].each do |extension|
|
38
42
|
filespec = File.join(File.dirname(__FILE__), "samples/The Egg and I.#{AppConfig[:extensions][extension]}")
|
39
43
|
File.delete(filespec) if File.exist?(filespec)
|
@@ -77,9 +81,47 @@ describe "NfoController" do
|
|
77
81
|
hash.should be_empty
|
78
82
|
end
|
79
83
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
+
it "should handle different movies with the same title" do
|
85
|
+
FileUtils.touch(File.join(TMPDIR, 'Sabrina - 1954.dummy'))
|
86
|
+
media1 = Media.new(TMPDIR, 'Sabrina - 1954.dummy')
|
87
|
+
controller1 = NfoController.new(media1)
|
88
|
+
controller1.update
|
89
|
+
FileUtils.touch(File.join(TMPDIR, 'Sabrina - 1995.dummy'))
|
90
|
+
media2 = Media.new(TMPDIR, 'Sabrina - 1995.dummy')
|
91
|
+
controller2 = NfoController.new(media2)
|
92
|
+
controller2.update
|
93
|
+
controller1.imdb_id.should_not == controller2.imdb_id
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should handle all movies in Collection.xml" do
|
97
|
+
imdb_exceptions = [
|
98
|
+
'Pearl Harbor Payback Appointment in Tokyo',
|
99
|
+
'Rodeo Racketeers John Wayne Young Duke Series',
|
100
|
+
'The Adventures of Indiana Jones The Complete DVD Movie Collection',
|
101
|
+
'The Great American Western Volume 6',
|
102
|
+
'The Mummy Collector s Set',
|
103
|
+
'Mexico Whitetails'
|
104
|
+
]
|
105
|
+
profiles = DvdprofilerProfile.all
|
106
|
+
titles = profiles.collect do |profile|
|
107
|
+
info = DvdprofilerInfo.new(profile)
|
108
|
+
"#{profile.title.remove_punctuation} - #{info.year}"
|
109
|
+
end
|
110
|
+
buf = []
|
111
|
+
titles.sort.each do |title|
|
112
|
+
filename = "#{title}.m4v"
|
113
|
+
FileUtils.touch(File.join(TMPDIR, filename))
|
114
|
+
media = Media.new(TMPDIR, filename)
|
115
|
+
controller = NfoController.new(media)
|
116
|
+
# debugger if title =~ /Mexico/
|
117
|
+
controller.update
|
118
|
+
buf << "Missing ISBN for #{title}" if controller.isbn.blank?
|
119
|
+
buf << "Missing IMDB ID for #{controller.info['title']}" if controller.imdb_id.blank? && !imdb_exceptions.include?(media.title)
|
120
|
+
buf << "Unexpected IMDB ID for #{controller.info['title']}" if !controller.imdb_id.blank? && imdb_exceptions.include?(media.title)
|
121
|
+
end
|
122
|
+
puts buf.join("\n") unless buf.empty?
|
123
|
+
buf.empty?.should be_true
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
84
127
|
|
85
|
-
end
|