Esempio n. 1
0
def download(args):
    """
    Implement the 'greg download' command
    """
    session = c.Session(args)
    issues = aux.parse_for_download(args)
    if issues == ['']:
        sys.exit(
            "You need to give a list of issues, of the form ""a, b-c, d...""")
    dumpfilename = os.path.join(session.data_dir, 'feeddump')
    if not os.path.isfile(dumpfilename):
        sys.exit(
            ("You need to run ""greg check"
             "<feed>"" before using ""greg download""."))
    with open(dumpfilename, mode='rb') as dumpfile:
        dump = pickle.load(dumpfile)
    try:
        feed = c.Feed(session, dump[0], dump[1])
    except Exception:
        sys.exit((
            "... something went wrong."
            "Are you sure your last ""greg check"" went well?"))
    for number in issues:
        entry = dump[1].entries[eval(number)]
        feed.info = []
        feed.entrylinks = []
        feed.fix_linkdate(entry)
        feed.download_entry(entry)
Esempio n. 2
0
def download(args):
    """
    Implement the 'greg download' command
    """
    session = c.Session(args)
    issues = aux.parse_for_download(args)
    if issues == ['']:
        sys.exit("You need to give a list of issues, of the form "
                 "a, b-c, d..."
                 "")
    dumpfilename = os.path.join(session.data_dir, 'feeddump')
    if not os.path.isfile(dumpfilename):
        sys.exit(("You need to run "
                  "greg check"
                  "<feed>"
                  " before using "
                  "greg download"
                  "."))
    with open(dumpfilename, mode='rb') as dumpfile:
        dump = pickle.load(dumpfile)
    try:
        feed = c.Feed(session, dump[0], dump[1])
    except Exception:
        sys.exit(("... something went wrong."
                  "Are you sure your last "
                  "greg check"
                  " went well?"))
    for number in issues:
        entry = dump[1].entries[eval(number)]
        feed.info = []
        feed.entrylinks = []
        feed.fix_linkdate(entry)
        feed.download_entry(entry)
Esempio n. 3
0
 def retrieve_mime(self):
     """
     Check the mime-type to download
     """
     mime = self.retrieve_config('mime', 'audio')
     mimedict = {"number": mime}
     # the input that parse_for_download expects
     return aux.parse_for_download(mimedict)
Esempio n. 4
0
 def retrieve_mime(self):
     """
     Check the mime-type to download
     """
     mime = self.retrieve_config('mime', 'audio')
     mimedict = {"number": mime}
     # the input that parse_for_download expects
     return aux.parse_for_download(mimedict)