Class: Sjunkieex::Interface
- Inherits:
-
Object
- Object
- Sjunkieex::Interface
- Includes:
- Junkie::Log
- Defined in:
- lib/junkie/patched/sjunkieex.rb
Overview
Monkex-patched version of the Interface from the ‘sjunkieex` gem
Instance Method Summary collapse
-
#get_links_for_downloads ⇒ Hash
Method that searches for new episodes and returns it in a nice structure.
Methods included from Junkie::Log
Instance Method Details
#get_links_for_downloads ⇒ Hash
Note:
should be called inside a Ruby fiber
Method that searches for new episodes and returns it in a nice structure
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/junkie/patched/sjunkieex.rb', line 17 def get_links_for_downloads episodes = [] look_for_new_episodes.each do |link,series| links = parse_series_page(series, link) links.each do |identifier, link_data| hd = @options[:hd_enabled] # select links, depending on wanted resolution links = [] if hd if link_data[:hd_1080p] links = link_data[:hd_1080p] elsif link_data[:hd_720p] links = link_data[:hd_720p] end else (links = link_data[:sd]) if link_data[:sd] end if links.empty? log.info("#{series}(#{identifier}) no links in this resolution") next end download_links = links.select do |link| link.match(/\/f-\w+\/#{ @options[:hoster_id] }_/) end if download_links.empty? puts "there are no links for this hoster" next end episode = Junkie::Episode.new( series, download_links.first, link_data[:episodedata]) episodes << episode end end episodes end |