-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (33 loc) · 1.2 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from feeds import FeedInfos, get_show_episode_durations
from relay import get_data as get_relay_data
from incomperable import get_data as get_incomperable_data
from chart import chart_show
from update_readme import update_readme
class PodcastNetwork:
def __init__(self, name, feeds):
self.name = name
self.feeds = feeds
self._show_durations = None
def add_feeds(self, feeds):
self.feeds.extend(feeds)
def add_feed(self, feed):
self.add_feeds([feed])
@property
def show_durations(self):
if self._show_durations is None:
all_episodes = FeedInfos()
for feed_url in self.feeds:
show_info = get_show_episode_durations(feed_url)
if show_info is not None:
all_episodes.append(show_info)
self._show_durations = all_episodes
return self._show_durations
all_networks = [
PodcastNetwork('Relay FM', get_relay_data()),
PodcastNetwork('ATP', ['https://cdn.atp.fm/rss/public']),
PodcastNetwork('Incomparable', get_incomperable_data()),
]
for network in all_networks:
for show in network.show_durations:
chart_show(show)
update_readme(all_networks)