lib/download_tv/myepisodes.rb in download_tv-2.6.5 vs lib/download_tv/myepisodes.rb in download_tv-2.6.6
- old
+ new
@@ -62,27 +62,23 @@
def save_cookie
@agent.cookie_jar.save(@cookie_path, session: true)
@agent
end
- def get_shows_since(last)
+ def get_shows_since(last, include_tomorrow: false)
page = @agent.get 'https://www.myepisodes.com/ajax/service.php?mode=view_privatelist'
shows = page.parser.css('tr.past')
shows = filter_newer_shows(shows, last)
+ shows.concat(page.parser.css('tr.today')) if include_tomorrow
build_show_strings(shows)
end
- def today_shows
- page = @agent.get 'https://www.myepisodes.com/ajax/service.php?mode=view_privatelist'
- shows = page.parser.css('tr.today')
- build_show_strings(shows)
- end
-
# Only keep the shows that have aired since the given date
def filter_newer_shows(shows, date)
shows.select do |i|
airdate = i.css('td.date')[0].text
- Date.parse(airdate) >= date
+ viewed_checkbox = i.css('td.status input').last
+ Date.parse(airdate) >= date && viewed_checkbox&.attribute('checked').nil?
end
end
def build_show_strings(shows)
shows.map do |i|