Cleanup and improve the RSS stuff.
[kiosk.git] / renderer_catalog.py
1 import bellevue_reporter_rss_renderer
2 import constants
3 import cnn_rss_renderer
4 import gdata_oauth
5 import gcal_renderer
6 import gkeep_renderer
7 import health_renderer
8 import local_photos_mirror_renderer
9 import mynorthwest_rss_renderer
10 import myq_renderer
11 import pollen_renderer
12 import reddit_renderer
13 import renderer
14 import seattletimes_rss_renderer
15 import secrets
16 import stevens_renderer
17 import stranger_renderer
18 import stock_renderer
19 import twitter_renderer
20 import weather_renderer
21 import wsj_rss_renderer
22
23 oauth = gdata_oauth.OAuth(secrets.google_client_id,
24                           secrets.google_client_secret)
25 if not oauth.has_token():
26     user_code = oauth.get_user_code()
27     print('------------------------------------------------------------')
28     print(('Go to %s and enter the code "%s" (no quotes, case-sensitive)' % (
29         oauth.verification_url, user_code)))
30     oauth.get_new_token()
31
32 seconds = 1
33 minutes = 60
34 hours = constants.seconds_per_hour
35 always = seconds * 1
36
37 # Note, the 1s updates don't really update every second; there's a max
38 # frequency in the renderer thread of ~once a minute.  It just means that
39 # everytime it check these will be stale and happen.
40 __registry = [
41                  stranger_renderer.stranger_events_renderer(
42                      {"Fetch Events" : (hours * 12),
43                       "Shuffle Events" : (always)}),
44 #                 pollen_renderer.pollen_count_renderer(
45 #                     {"Poll" : (hours * 1)}),
46                  myq_renderer.garage_door_renderer(
47                      {"Poll MyQ" : (minutes * 5),
48                       "Update Page" : (always)}),
49                  bellevue_reporter_rss_renderer.bellevue_reporter_rss_renderer(
50                      {"Fetch News" : (hours * 1),
51                       "Shuffle News" : (always)},
52                      "www.bellevuereporter.com",
53                      [ "/feed/" ],
54                      "Bellevue Reporter" ),
55                  mynorthwest_rss_renderer.mynorthwest_rss_renderer(
56                      {"Fetch News" : (hours * 1),
57                       "Shuffle News" : (always)},
58                      "mynorthwest.com",
59                      [ "/feed/" ],
60                      "MyNorthwest News" ),
61                  cnn_rss_renderer.cnn_rss_renderer(
62                      {"Fetch News" : (hours * 1),
63                       "Shuffle News" : (always)},
64                      "rss.cnn.com",
65                      [ "/rss/money_latest.rss",
66                        "/rss/money_mostpopular.rss",
67                        "/rss/money_news_economy.rss",
68                        "/rss/money_news_companies.rss" ],
69                      "CNNMoney" ),
70                  cnn_rss_renderer.cnn_rss_renderer(
71                      {"Fetch News" : (hours * 1),
72                       "Shuffle News" : (always)},
73                      "rss.cnn.com",
74                      [ "/rss/cnn_tech.rss",
75                        "/rss/money_technology.rss" ],
76                      "CNNTechnology" ),
77                  cnn_rss_renderer.cnn_rss_renderer(
78                      {"Fetch News" : (hours * 1),
79                       "Shuffle News" : (always)},
80                      "rss.cnn.com",
81                      [ "/rss/cnn_topstories.rss",
82                        "/rss/cnn_world.rss",
83                        "/rss/cnn_us.rss" ],
84                      "CNNNews" ),
85                  wsj_rss_renderer.wsj_rss_renderer(
86                      {"Fetch News" : (hours * 1),
87                       "Shuffle News" : (always)},
88                      "feeds.a.dj.com",
89                      [ "/rss/RSSWorldNews.xml" ],
90                      "WSJNews" ),
91                  wsj_rss_renderer.wsj_rss_renderer(
92                      {"Fetch News" : (hours * 1),
93                       "Shuffle News" : (always)},
94                      "feeds.a.dj.com",
95                      [ "/rss/RSSMarketsMain.xml",
96                        "/rss/WSJcomUSBusiness.xml"],
97                      "WSJBusiness" ),
98                  health_renderer.periodic_health_renderer(
99                      {"Update Perioidic Job Health" : (seconds * 45)}),
100                  stock_renderer.stock_quote_renderer(
101                      {"Update Prices" : (hours * 1)},
102                      [ "MSFT",
103                        "SPY",
104                        "GBTC",
105                        "IEMG",
106                        "OPTAX",
107                        "SPAB",
108                        "SPHD",
109                        "SGOL",
110                        "VDC",
111                        "VYMI",
112                        "VNQ",
113                        "VNQI" ]),
114                  stevens_renderer.stevens_pass_conditions_renderer(
115                      {"Fetch Pass Conditions" : (hours * 1)},
116                      "www.wsdot.com",
117                      [ "/traffic/rssfeeds/stevens/Default.aspx" ]),
118                  seattletimes_rss_renderer.seattletimes_rss_renderer(
119                      {"Fetch News" : (hours * 1),
120                       "Shuffle News" : (always)},
121                      "www.seattletimes.com",
122                      [ "/pacific-nw-magazine/feed/",
123                        "/life/feed/",
124                        "/outdoors/feed/" ],
125                      "Seattle Times Segments"),
126                  weather_renderer.weather_renderer(
127                      {"Fetch Weather (Bellevue)": (hours * 4)},
128                      "home"),
129                  weather_renderer.weather_renderer(
130                      {"Fetch Weather (Stevens)": (hours * 4)},
131                      "stevens"),
132                  weather_renderer.weather_renderer(
133                      {"Fetch Weather (Telma)" : (hours * 4)},
134                      "telma"),
135                  local_photos_mirror_renderer.local_photos_mirror_renderer(
136                      {"Index Photos": (hours * 24),
137                       "Choose Photo": (always)}),
138                  gkeep_renderer.gkeep_renderer(
139                      {"Update": (minutes * 10)}),
140                  gcal_renderer.gcal_renderer(
141                      {"Render Upcoming Events": (hours * 2),
142                       "Look For Triggered Events": (always)},
143                      oauth),
144                  reddit_renderer.showerthoughts_reddit_renderer(
145                      {"Scrape": (hours * 6),
146                       "Shuffle": (always)} ),
147                  reddit_renderer.til_reddit_renderer(
148                      {"Scrape": (hours * 6),
149                       "Shuffle": (always)} ),
150                  reddit_renderer.seattle_reddit_renderer(
151                      {"Scrape": (hours * 6),
152                       "Shuffle": (always)}),
153                  reddit_renderer.quotes_reddit_renderer(
154                      {"Scrape": (hours * 6),
155                       "Shuffle": (always)}),
156                  reddit_renderer.lifeprotips_reddit_renderer(
157                      {"Scrape": (hours * 6),
158                       "Shuffle": (always)}),
159                  twitter_renderer.twitter_renderer(
160                      {"Fetch Tweets": (minutes * 15),
161                       "Shuffle Tweets": (always)})
162 ]
163
164 def get_renderers():
165     return __registry