def check(args): """ Implement the 'greg check' command """ session = c.Session(args) if str(args["url"]) != 'None': url = args["url"][0] name = "DEFAULT" else: try: name = args["feed"][0] url = session.feeds[name]["url"] except KeyError: sys.exit("You don't appear to have a feed with that name.") podcast = aux.parse_podcast(str(url)) for entry in enumerate(podcast.entries): listentry = list(entry) print(listentry[0], end=": ") try: print(listentry[1]["title"], end=" (") except: print(listentry[1]["link"], end=" (") try: print(listentry[1]["updated"], end=")") except: print("", end=")") print() dumpfilename = os.path.join(session.data_dir, 'feeddump') with open(dumpfilename, mode='wb') as dumpfile: dump = [name, podcast] pickle.dump(dump, dumpfile)
def check(args): """ Implement the 'greg check' command """ session = c.Session(args) if str(args["url"]) != 'None': url = args["url"] name = "DEFAULT" else: try: url = session.feeds[args["feed"]]["url"] name = args["feed"] except KeyError: sys.exit("You don't appear to have a feed with that name.") podcast = aux.parse_podcast(url) for entry in enumerate(podcast.entries): listentry = list(entry) print(listentry[0], end=": ") try: print(listentry[1]["title"], end=" (") except: print(listentry[1]["link"], end=" (") try: print(listentry[1]["updated"], end=")") except: print("", end=")") print() dumpfilename = os.path.join(session.data_dir, 'feeddump') with open(dumpfilename, mode='wb') as dumpfile: dump = [name, podcast] pickle.dump(dump, dumpfile)
def __init__(self, session, feed, podcast): self.session = session self.args = session.args self.config = self.session.config self.name = feed if not podcast: self.podcast = aux.parse_podcast(session.feeds[feed]["url"]) else: self.podcast = podcast self.sync_by_date = self.has_date() self.willtag = self.will_tag() if self.willtag: self.defaulttagdict = self.default_tag_dict() self.mime = self.retrieve_mime() self.wentwrong = False if self.podcast.bozo: # the bozo bit is on, see feedparser docs warning = str(self.podcast["bozo_exception"]) if "URLError" in warning: self.wentwrong = warning else: warn("""This feed is malformed (possibly in unimportant ways): {}""".format(warning), stacklevel=10) self.info = os.path.join(session.data_dir, feed) self.entrylinks, self.linkdates = aux.parse_feed_info(self.info)
def __init__(self, session, feed, podcast): self.session = session self.args = session.args self.config = self.session.config self.name = feed if not podcast: self.podcast = aux.parse_podcast(session.feeds[feed]["url"]) else: self.podcast = podcast self.sync_by_date = self.has_date() self.willtag = self.will_tag() if self.willtag: self.defaulttagdict = self.default_tag_dict() self.mime = self.retrieve_mime() try: self.wentwrong = "URLError" in str(self.podcast["bozo_exception"]) except KeyError: self.wentwrong = False self.info = os.path.join(session.data_dir, feed) self.entrylinks, self.linkdates = aux.parse_feed_info(self.info)