Class: P3::TV::EpisodeFile

Inherits:
Object
  • Object
show all
Defined in:
lib/p3-tv.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#air_dateObject

Returns the value of attribute air_date.



238
239
240
# File 'lib/p3-tv.rb', line 238

def air_date
  @air_date
end

#episodeObject

Returns the value of attribute episode.



238
239
240
# File 'lib/p3-tv.rb', line 238

def episode
  @episode
end

#pathObject

Returns the value of attribute path.



238
239
240
# File 'lib/p3-tv.rb', line 238

def path
  @path
end

#percent_doneObject

Returns the value of attribute percent_done.



238
239
240
# File 'lib/p3-tv.rb', line 238

def percent_done
  @percent_done
end

#seasonObject

Returns the value of attribute season.



238
239
240
# File 'lib/p3-tv.rb', line 238

def season
  @season
end

#seriesObject

Returns the value of attribute series.



238
239
240
# File 'lib/p3-tv.rb', line 238

def series
  @series
end

#series_idObject

Returns the value of attribute series_id.



238
239
240
# File 'lib/p3-tv.rb', line 238

def series_id
  @series_id
end

#statusObject

Returns the value of attribute status.



238
239
240
# File 'lib/p3-tv.rb', line 238

def status
  @status
end

#thumbnailObject

Returns the value of attribute thumbnail.



238
239
240
# File 'lib/p3-tv.rb', line 238

def thumbnail
  @thumbnail
end

#titleObject

Returns the value of attribute title.



238
239
240
# File 'lib/p3-tv.rb', line 238

def title
  @title
end

#typeObject



241
242
243
244
245
246
247
248
249
# File 'lib/p3-tv.rb', line 241

def type
    unless @type
        if( @path )
            ext = File::extname( @path )
            @type = ext unless ext.empty?
        end
    end
    return @type
end

Instance Method Details

#<=>(other) ⇒ Object



269
270
271
272
273
274
275
276
277
278
279
# File 'lib/p3-tv.rb', line 269

def <=>( other )
    if( self.series == other.series )
        if( self.season == other.season )
            return self.episode <=> other.episode
        else
            return self.season <=> other.season
        end
    else
        return self.series <=> other.series
    end
end

#to_hObject



255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/p3-tv.rb', line 255

def to_h
    return { :series_id => series_id,
             :series => series,
             :season => season,
             :episode => episode,
             :title => title,
             :air_date => air_date.to_s,
             :path => path,
             :status => status,
             :percent_done => percent_done,
             :thumbnail => thumbnail
    }
end

#to_json(*a) ⇒ Object



251
252
253
# File 'lib/p3-tv.rb', line 251

def to_json(*a)
    return to_h.to_json(*a)
end

#to_sObject



281
282
283
# File 'lib/p3-tv.rb', line 281

def to_s
    return to_h.to_s
end