class Addic7ed::VideoFile

Constants

TVSHOW_REGEX

Attributes

distribution[R]
episode[R]
filename[R]
group[R]
season[R]
showname[R]
tags[R]

Public Class Methods

new(filename) click to toggle source
# File lib/addic7ed/video_file.rb, line 8
def initialize(filename)
  @filename = filename
  if match = TVSHOW_REGEX.match(basename)
    @showname     = match[:showname]
    @season       = match[:season].to_i
    @episode      = match[:episode].to_i
    @tags         = match[:tags].upcase.split(/[\. ]/)
    @group        = match[:group].upcase
    @distribution = match[:distribution].upcase
  else
    raise InvalidFilename
  end
end

Public Instance Methods

basename() click to toggle source
# File lib/addic7ed/video_file.rb, line 22
def basename
  @basename ||= ::File.basename(@filename)
end
inspect() click to toggle source
# File lib/addic7ed/video_file.rb, line 30
    def inspect
"Guesses for #{@filename}:
  show:         #{@showname}
  season:       #{@season}
  episode:      #{@episode}
  tags:         #{@tags}
  group:        #{@group}
  distribution: #{@distribution}"
    end
to_s() click to toggle source
# File lib/addic7ed/video_file.rb, line 26
def to_s
  @filename
end