lib/download_tv/downloader.rb in download_tv-2.1.1 vs lib/download_tv/downloader.rb in download_tv-2.2.0

- old
+ new

@@ -41,11 +41,11 @@ 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. - def run(dont_write_to_date_file) + def run(dont_update_last_run) date = check_date myepisodes = MyEpisodes.new(@config[:myepisodes_user], @config[:cookie]) # Log in using cookie by default myepisodes.load_cookie @@ -84,11 +84,11 @@ # subs_t.join puts "Completed. Exiting..." end - File.write("date", Date.today) unless dont_write_to_date_file + @config[:date] = Date.today unless dont_update_last_run rescue InvalidLoginError warn "Wrong username/password combination" end @@ -126,22 +126,16 @@ end def check_date - content = File.read("date") - - last = Date.parse(content) + last = @config[:date] if last - @offset != Date.today last - @offset else puts "Everything up to date" exit end - - rescue Errno::ENOENT - File.write("date", Date.today-1) - retry end ## # Given a list of shows and episodes: