Ejemplo n.º 1
0
def get_display_items(whole_files, names):
    """get the items whose names will be displayed"""
    items = DownloadList()
    for i in whole_files.list:
        for j in names:
            if i.name == j:
                items.list.append(i)
    return items
Ejemplo n.º 2
0
def get_files(course_url, username, password, session):
    """get filename link and description"""
    files = DownloadList()
    course_page_soup = get_course_soup(course_url, username, password, session)
    files_body = course_page_soup.find_all(class_="card-body")
    for item in files_body:
        url = HOST + item.find("a").get("href")
        week = item.parent.parent.parent.parent.find("h2").text
        discreption = re.sub(r"[0-9]* - (.*)", "\\1", item.find("div").text)
        name = re.sub(r"[0-9]* - (.*)", "\\1", item.find("strong").text)
        files.list.append(DownloadFile(name, url, discreption, week))
    return files
Ejemplo n.º 3
0
def choose_files(downloadfiles):
    """prompt the user to choose files"""
    if not downloadfiles:
        print("NO FILES YET")
        sys.exit(0)
    items_to_download_names = iterfzf(
        downloadfiles.get_descriptions(), multi=True)
    files_to_download = DownloadList()
    for item in downloadfiles.list:
        for name in items_to_download_names:
            if item.discreption == name:
                files_to_download.list.append(item)
    return files_to_download
Ejemplo n.º 4
0
def choose_files(downloadfiles):
    """prompt the user to choose files"""
    if not downloadfiles:
        sys.exit(0)
    back = downloadfiles.get_descriptions()
    back.insert(0, BACK)
    items_to_download_names = iterfzf(back, multi=True)
    if items_to_download_names[0] == BACK:
        return BACK
    files_to_download = DownloadList()
    for item in downloadfiles.list:
        for name in items_to_download_names:
            if item.discreption == name:
                files_to_download.list.append(item)
    return files_to_download