class TivoHMO::Adapters::Plex::Section

Attributes

delegate[R]

Public Class Methods

new(delegate) click to toggle source
Calls superclass method TivoHMO::API::Container::new
# File lib/tivohmo/adapters/plex/section.rb, line 12
def initialize(delegate)
  # delegate is a Plex::Section
  @delegate = delegate

  super(delegate.key)

  self.title = delegate.title
  self.modified_at = Time.at(delegate.updated_at.to_i)
  self.created_at = Time.now
end

Public Instance Methods

children() click to toggle source
Calls superclass method
# File lib/tivohmo/adapters/plex/section.rb, line 23
def children
  synchronize do
    if super.blank?
      # Tivo time sorting is reverse chronological (newest first), so
      # order it here in reverse order so the creation time cause the
      # right sorting ("all" is newest and comes first)
      add_child(QualifiedCategory.new(delegate, :by_collection, :collections))
      add_child(QualifiedCategory.new(delegate, :by_content_rating, :content_ratings))
      add_child(QualifiedCategory.new(delegate, :by_folder, :folders))
      add_child(QualifiedCategory.new(delegate, :by_genre, :genres))
      add_child(QualifiedCategory.new(delegate, :by_year, :years))
      add_child(QualifiedCategory.new(delegate, :by_first_character, :first_characters))

      #add_child(Category.new(delegate, :unwatched))
      add_child(Category.new(delegate, :on_deck, nil, true))
      add_child(Category.new(delegate, :newest, nil, true))
      add_child(Category.new(delegate, :recently_viewed, nil, true))
      add_child(Category.new(delegate, :recently_added, nil, true))
      add_child(Category.new(delegate, :all, nil, true))
    end
  end

  super
end