Class: Movie
Instance Attribute Summary collapse
-
#age ⇒ Object
Returns the value of attribute age.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#format ⇒ Object
Returns the value of attribute format.
-
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
-
#imdb_link ⇒ Object
writeonly
Sets the attribute imdb_link.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nfo ⇒ Object
Returns the value of attribute nfo.
-
#nzb_link ⇒ Object
Returns the value of attribute nzb_link.
-
#path ⇒ Object
Returns the value of attribute path.
-
#score ⇒ Object
Returns the value of attribute score.
-
#sound ⇒ Object
Returns the value of attribute sound.
-
#source ⇒ Object
Returns the value of attribute source.
-
#srt ⇒ Object
Returns the value of attribute srt.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #<=>(other_movie) ⇒ Object
- #dirname ⇒ Object
-
#initialize(raw_name, attributes = {}) ⇒ Movie
constructor
A new instance of Movie.
Constructor Details
#initialize(raw_name, attributes = {}) ⇒ Movie
Returns a new instance of Movie.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/movie.rb', line 9 def initialize(raw_name, attributes = {}) @raw_name = raw_name.gsub(/\.|\_/,' ') attributes.each { |k,v| self.send("#{k}=", v) } @srt, @tags = [], [] # for info set with nzbs title if name && year && score @info_get_from_title = true end set_name set_year set_format set_source set_sound set_srt set_lang set_encoding set_imdb_id set_data_from_imdb unless path || @info_get_from_title end |
Instance Attribute Details
#age ⇒ Object
Returns the value of attribute age.
6 7 8 |
# File 'lib/movie.rb', line 6 def age @age end |
#encoding ⇒ Object
Returns the value of attribute encoding.
6 7 8 |
# File 'lib/movie.rb', line 6 def encoding @encoding end |
#format ⇒ Object
Returns the value of attribute format.
6 7 8 |
# File 'lib/movie.rb', line 6 def format @format end |
#imdb_id ⇒ Object
Returns the value of attribute imdb_id.
6 7 8 |
# File 'lib/movie.rb', line 6 def imdb_id @imdb_id end |
#imdb_link=(value) ⇒ Object
Sets the attribute imdb_link
6 7 8 |
# File 'lib/movie.rb', line 6 def imdb_link=(value) @imdb_link = value end |
#lang ⇒ Object
Returns the value of attribute lang.
6 7 8 |
# File 'lib/movie.rb', line 6 def lang @lang end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/movie.rb', line 6 def name @name end |
#nfo ⇒ Object
Returns the value of attribute nfo.
6 7 8 |
# File 'lib/movie.rb', line 6 def nfo @nfo end |
#nzb_link ⇒ Object
Returns the value of attribute nzb_link.
6 7 8 |
# File 'lib/movie.rb', line 6 def nzb_link @nzb_link end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/movie.rb', line 6 def path @path end |
#score ⇒ Object
Returns the value of attribute score.
6 7 8 |
# File 'lib/movie.rb', line 6 def score @score end |
#sound ⇒ Object
Returns the value of attribute sound.
6 7 8 |
# File 'lib/movie.rb', line 6 def sound @sound end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/movie.rb', line 6 def source @source end |
#srt ⇒ Object
Returns the value of attribute srt.
6 7 8 |
# File 'lib/movie.rb', line 6 def srt @srt end |
#tags ⇒ Object
Returns the value of attribute tags.
6 7 8 |
# File 'lib/movie.rb', line 6 def @tags end |
#year ⇒ Object
Returns the value of attribute year.
6 7 8 |
# File 'lib/movie.rb', line 6 def year @year end |
Instance Method Details
#<=>(other_movie) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/movie.rb', line 41 def <=>(other_movie) if imdb_id && other_movie.imdb_id imdb_id <=> other_movie.imdb_id else "#{name} #{year}".downcase <=> "#{other_movie.name} #{other_movie.year}".downcase end end |
#dirname ⇒ Object
37 38 39 |
# File 'lib/movie.rb', line 37 def dirname "#{name} (#{year}) #{.join(' ')} #{format} #{source} #{sound} #{encoding} #{lang} {#{imdb_id}} [#{srt.join(',')}]".gsub(/\s+|\//,' ') end |