Thread: Combined Feeds
View Single Post
Old 12-10-2010, 09:52 AM   #2
mean_gene
Enthusiast
mean_gene began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G/Wifi
So I'm thinking I could use parse_feeds to loop through all articles looking for the feed title and move them (append and delete) to the other title.

Something like this (modified form the reusable code section)

Spoiler:
movedArticles = []
for curfeed in feeds:
delList = []
searchfeed = Feed()
for a,curarticle in enumerate(curfeed.articles):
if searchfeed.title = 'national':
movedArticles.append(curarticle)
delList.append(curarticle)
if len(delList)>0:
for d in delList:
index = curfeed.articles.index(d)
curfeed.articles[index:index+1] = []

if len(movedArticles) > 0:
pfeed = Feed()
pfeed.title = 'Recipes'
pfeed.id_counter = len(movedArticles)
pfeed.articles = movedArticles[:]
feeds.append(pfeed)


I'll try this when I get home today and tweak it a bit more.

Any thoughts?
mean_gene is offline   Reply With Quote