class ComboFeed < Feed
def initialize( link, token=nil, regex=nil )
super( link, token, regex )
end
def buildFeed( date )
@rss = RSS::Maker.make( version ) do |m|
m.channel.title = title
m.channel.link = link
m.channel.description = description
m.items.do_sort = true
end
# build all necessary feeds
@feeds.each do |f|
if( f == "+" || f == "-" || f == "_" )
next
end
f.buildFeed( date )
end
action = "+"
# join the resulting feeds
@feeds.each do |f|
if(f == "+" || f == "-" || f == "_" )
action = f
next
end
# crude way to join the arrays
if( @rss.items.length == 0 )
f.rss.items.each do |i|
@rss.items << i
end
elsif( action == "_" )
@rss.items.delete_if { |i|
seen = false
f.rss.items.each do |e|
if( e.title == i.title )
seen = true
break
end
end
!seen
}
elsif( action == "+" )
f.rss.items.each { |i|
seen = false
@rss.items.each do |e|
if( e.title == i.title )
seen = true
break
end
end
if( !seen )
@rss.items << i
end
}
elsif( action == "-" )
@rss.items.delete_if { |i|
seen = false
f.rss.items.each do |e|
if( e.title == i.title )
seen = true
break
end
end
seen
}
end
end
end
def title
tmp = ""
@feeds.each do |f|
if( f == "+" || f == "-" || f == "_" )
tmp += " " + f + " "
next
end
tmp += f.title
end
tmp
end
def description
tmp = ""
@feeds.each do |f|
if( f == "+" || f == "-" || f == "_" )
next
end
tmp += f.description + " "
end
tmp
end
end
begin
end