Module: P3::Eztv::EpisodeFactory

Defined in:
lib/p3-eztv.rb

Class Method Summary collapse

Class Method Details

.create(name, episodes_node_array) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/p3-eztv.rb', line 84

def self.create( name, episodes_node_array )
    episodes = []
    episodes_node_array.reverse.collect do |episode_node|
        begin
            e = Episode.new( episode_node )

            if( ( e.raw_title.match( /#{name} #{SE_FORMAT}/i ) ) or ( e.raw_title.match( /#{name} #{X_FORMAT}/i ) ) )
                # Episode will throw if it can't parse
                episodes << e
            end
        rescue
        end
    end
    return episodes.uniq
end