lib/movie.rb in pirate-autonzb-0.4 vs lib/movie.rb in pirate-autonzb-0.4.1
- old
+ new
@@ -52,14 +52,15 @@
end
def set_imdb_id
if imdb_link
@imdb_id = imdb_link.match(/tt[0-9]+/)[0]
- elsif matched = @raw_name.match(/\{(.*)\}/)
+ elsif matched = @raw_name.match(/\{(tt[0-9]+)\}/)
@imdb_id = matched[1]
- elsif path
- add_imdb_id_to_file
+ elsif imdb
+ @imdb_id = imdb.id
+ add_imdb_id_to_file if path
else
nil
end
end
@@ -135,10 +136,12 @@
def set_srt
if nfo
@srt = nfo.srt
elsif matched = @raw_name.match(/\[(.*)\]/)
matched[1].split(',').each { |srt| @srt << srt }
+ else
+ @srt << 'no nfo'
end
end
def set_lang
@lang = case @raw_name
@@ -170,10 +173,9 @@
@year = imdb_year
end
end
def add_imdb_id_to_file_if_not_present
- @imdb_id = imdb.id
dir_name = File.dirname(path)
ext_name = File.extname(path)
base_name = File.basename(path, ext_name)
if matched = base_name.match(/^(.*)\s(\[{1}.*\]{1})$/)
base_name_without_srts = matched[1]
\ No newline at end of file