class Media::Run

Public Instance Methods

start() click to toggle source
# File lib/media/runner.rb, line 17
def start
  require 'commander/import'
  program :version, Media::Runner::VERSION
  program :description, 'Media Runner'

  command :series do |c|
    c.syntax = 'media-runner series [options]'
    c.summary = 'run an episode of a certain series'
    c.description = 'You can pass the an episode number and a series and run it with VLC.'
    c.example 'Run episode 1 of season 1 of Game of Thrones', 'media-runner series gameofthrones 101'
    c.action do |args|
      attributes = sanitize_series_args(args)
      episode = Episode.new(attributes[:series], attributes[:title])
      episode.run
    end
  end

  command :movie do |c|
    c.syntax = 'media-runner movie MOVIENAME'
    c.summary = 'run a movie'
    c.description = 'You can pass the name of a movie and run it with VLC.'
    c.example 'Run The Great Gatsby', 'media-runner movie thegreatgatsby'
    c.action do |args|
      attributes = sanitize_movie_args(args)
      movie = Movie.new(attributes[:title])
      movie.run
    end
  end
end