merge all rss

This commit is contained in:
Dima Gerasimov 2019-09-30 20:09:40 +01:00
parent 35b6d6ff97
commit 420d444633
4 changed files with 26 additions and 10 deletions

View file

@ -1,12 +1,29 @@
from itertools import chain
from typing import List
from ._rss import Subscription
from . import feedbin
from . import feedly
from ._rss import Subscription
# TODO google reader?
def get_history():
def get_all_subscriptions() -> List[Subscription]:
"""
It's useful to keep track of websites you unsubscribed from too,
Keeps track of everything I ever subscribed to. It's useful to keep track of unsubscribed too
so you don't try to subscribe again (or at least take into account why you unsubscribed before)
"""
pass
states = {}
states.update(feedly.get_states())
states.update(feedbin.get_states())
by_url = {}
for d, feeds in sorted(states.items()):
for f in feeds:
if f.url not in by_url:
by_url[f.url] = f
res = []
last = {x.url: x for x in max(states.items())[1]}
for u, x in sorted(by_url.items()):
present = u in last
res.append(x._replace(subscribed=present))
return res