lib/dvdprofiler2xbmc/models/dvdprofiler_info.rb in royw-dvdprofiler2xbmc-0.1.0 vs lib/dvdprofiler2xbmc/models/dvdprofiler_info.rb in royw-dvdprofiler2xbmc-0.1.2
- old
+ new
@@ -7,15 +7,17 @@
# == Synopsis
# see DvdprofilerProfile.all for options
# really should include at least: :title, :year, :isbn, :filespec
def self.find(options)
dvdprofiler_info = nil
+ # replace options[:year] => 0 with nil
+ options[:year] = (options[:year].to_i > 0 ? options[:year] : nil) unless options[:year].blank?
# find ISBN for each title and assign to the media
profiles = DvdprofilerProfile.all(options)
if profiles.length > 1
media_title = "#{options[:title]}#{options[:year].blank? ? '' : ' (' + options[:year] + ')'}"
- Dvdprofiler2Xbmc.multiple_profiles << "#{media_title} #{profiles.collect{|prof| prof.isbn}.join(", ")}"
+ DvdProfiler2Xbmc.multiple_profiles << "#{media_title} #{profiles.collect{|prof| prof.isbn}.join(", ")}"
AppConfig[:logger].warn { "Multiple profiles found for #{media_title}" }
else
profile = profiles.first
unless profile.nil?
AppConfig[:logger].info { "ISBN => #{options[:isbn]}" } unless options[:isbn].nil?
@@ -102,7 +104,19 @@
@profile.dvd_hash[:productionyear] rescue []
end
def released_years
@profile.dvd_hash[:released] rescue []
+ end
+
+ def original_titles
+ titles = []
+ originaltitle = @profile.dvd_hash[:originaltitle]
+ titles = [originaltitle].flatten.uniq.compact unless originaltitle.blank?
+ titles = titles.collect{|t| t.blank? ? nil : t}.compact
+ titles
+ end
+
+ def title
+ @profile.dvd_hash[:title] rescue nil
end
end