class TivoHMO::Adapters::Filesystem::FileItem

An Item based on a filesystem file

Public Class Methods

new(identifier, subtitle=nil) click to toggle source
Calls superclass method TivoHMO::API::Item::new
# File lib/tivohmo/adapters/filesystem/file_item.rb, line 12
def initialize(identifier, subtitle=nil)
  full_path = File.expand_path(identifier)
  raise ArgumentError, "Must provide an existing file" unless File.file?(full_path)

  super(full_path)

  self.file = full_path
  self.subtitle = subtitle
  self.title = File.basename(self.identifier)
  self.title = "[#{subtitle.language_code} #{subtitle.type} sub] #{self.title}" if subtitle
  self.modified_at = File.mtime(self.identifier)
  self.created_at = File.ctime(self.identifier)
end