require 'media/runner/app/file_check' require 'media/runner/app/media_paths' require 'media/runner/app/vlc_check' module Media class Episode include FileCheck, VlcCheck, MediaPaths def initialize(series, title, format = nil) @series = series @title = title @format = format end attr_accessor :series, :title, :format def run vlc_installed? unless series_exists?(self) Media::Printer.output ["#{series_path(self)} doesn't exist. Did you type the series name correctly?"] exit 1 end unless episode_exists?(self) Media::Printer.output ["Episode #{title} was not found in #{series}."] exit 1 end Media::Printer.output ["Playing episode #{title} from #{series}. ENJOY!"] `zsh -c "#{Dir.home}/Applications/VLC.app/Contents/MacOS/VLC --fullscreen #{episode_path(self)} > /dev/null \ 2>&1 &!"` exit 0 end end end