comparison feed-push @ 23:5bb7c2939da0 draft

add some debug logging Signed-off-by: Changaco <changaco ατ changaco δοτ net>
author Changaco <changaco ατ changaco δοτ net>
date Sat, 04 Aug 2012 16:57:38 +0200
parents b763ca084088
children 96e2d5ffcd23
comparison
equal deleted inserted replaced
22:b763ca084088 23:5bb7c2939da0
166 ignore_event(path, event) 166 ignore_event(path, event)
167 elif event == gamin.GAMChanged: 167 elif event == gamin.GAMChanged:
168 feed_fd = path_to_feed_fd[path] 168 feed_fd = path_to_feed_fd[path]
169 feed_fd.seek(0) 169 feed_fd.seek(0)
170 feed = feedparser.parse(feed_fd.read()) 170 feed = feedparser.parse(feed_fd.read())
171 i = 0
171 for entry in reversed(feed.entries): 172 for entry in reversed(feed.entries):
172 if entry.id in state['id_cache'].get(feed_fd.name, []) or \ 173 if entry.id in state['id_cache'].get(feed_fd.name, []) or \
173 not global_args.flood and calendar.timegm(entry.published_parsed) < time.time() - 86400: 174 not global_args.flood and calendar.timegm(entry.published_parsed) < time.time() - 86400:
174 continue 175 continue
176 i += 1
175 for feed_path_to_commands in config_to_feed_paths_to_commands.values(): 177 for feed_path_to_commands in config_to_feed_paths_to_commands.values():
176 for cmd in feed_path_to_commands.get(path, []): 178 for cmd in feed_path_to_commands.get(path, []):
177 run_command(format_cmd(cmd, feed=feed.feed, entry=entry), entry.content[0].value) 179 run_command(format_cmd(cmd, feed=feed.feed, entry=entry), entry.content[0].value)
178 state['id_cache'][feed_fd.name] = [entry.id for entry in feed.entries] 180 state['id_cache'][feed_fd.name] = [entry.id for entry in feed.entries]
179 save_state() 181 save_state()
182 if i == 0:
183 log(LOG_DEBUG, 'received GAMChanged event on "%s" but no new entry was found' % path)
180 elif event == gamin.GAMDeleted: 184 elif event == gamin.GAMDeleted:
181 path_to_feed_fd.pop(path).close() 185 path_to_feed_fd.pop(path).close()
182 else: 186 else:
183 ignore_event(path, event) 187 ignore_event(path, event)
184 188