Sha256: e65fa652c4513c7e5209d5a775dcc65f584ffe862cd9cebe8fe1e10b85eaedd8

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'aranha/default_processor'
require 'ehbrs_ruby_utils/videos/opensubtitles/parsers/title'
require 'ehbrs_ruby_utils/videos/opensubtitles/processors/episode'
require 'eac_ruby_utils/core_ext'

module EhbrsRubyUtils
  module Videos
    module Opensubtitles
      module Processors
        class Title < ::Aranha::DefaultProcessor
          enable_simple_cache
          enable_speaker

          def perform
            infov 'Episodes', episodes.count
            episodes.each(&:perform)
          end

          # @return [Array<EhbrsRubyUtils::Videos::Opensubtitles::Processors::Subtitle>]
          def subtitles
            episodes.flat_map(&:subtitles)
          end

          private

          def episode_uri(episode_data)
            source_uri + episode_data.fetch(:href)
          end

          def episodes_uncached
            data.fetch(:episodes).map do |episode_data|
              ::EhbrsRubyUtils::Videos::Opensubtitles::Processors::Episode
                .new(episode_uri(episode_data), extra_data)
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.3 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.41.1 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.41.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.40.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.39.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.38.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.37.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.36.1 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.36.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb
ehbrs_ruby_utils-0.35.0 lib/ehbrs_ruby_utils/videos/opensubtitles/processors/title.rb