lib/download_tv/downloader.rb in download_tv-2.3.0 vs lib/download_tv/downloader.rb in download_tv-2.4.0

- old
+ new

@@ -24,17 +24,18 @@ end ## # Given a file containing a list of episodes (one per line), it tries to find download links for each def download_from_file(filename) - if !File.exist? filename + if File.exist? filename + filename = File.realpath(filename) + t = Torrent.new(@config.content[:grabber]) + File.readlines(filename).each { |show| download(get_link(t, show.chomp)) } + else puts "Error: #{filename} not found" exit 1 end - filename = File.realpath(filename) - t = Torrent.new(@config.content[:grabber]) - File.readlines(filename).each { |show| download(get_link(t, show)) } end ## # Finds download links for all new episodes aired since the last run of the program # It connects to MyEpisodes in order to find which shows to track and which new episodes aired. @@ -43,16 +44,16 @@ myepisodes = MyEpisodes.new(@config.content[:myepisodes_user], @config.content[:cookie]) # Log in using cookie by default myepisodes.load_cookie shows = myepisodes.get_shows(date) + to_download = fix_names(shows) - if shows.empty? + if to_download.empty? puts 'Nothing to download' else t = Torrent.new(@config.content[:grabber]) - to_download = fix_names(shows) queue = Queue.new # Adds a link (or empty string to the queue) link_t = Thread.new do