Beispiel #1
0
def verify_redvest(service, redvest_options):
    # Ensure redvest folder exists
    check_stop_script()
    parent_name = redvest_options['parent-name']
    res = util.get_folder_ids(service, name=parent_name)
    if res == None:
        print(
            f'ERROR: "{parent_name}" folder not found in Red Vest directory, please check Google Drive'
        )
        return None, None
    redvest_id = res[0]

    folder_name = redvest_options["folder-name"]

    # See if target folder already exists
    if util.get_folder_ids(service, name=folder_name,
                           parent=redvest_id) != None:
        print(f'ERROR: Folder \"{folder_name}\" already exists!')
        print(
            "(You may need to remove the folder from the Trash in the Librarianz Drive)"
        )
        return None, None

    # Create new class folder
    new_folder_id = util.make_folder(service, folder_name, redvest_id)

    # Create resources folder
    new_resources_id = util.make_folder(service, "Resources", new_folder_id)

    return new_folder_id, new_resources_id
Beispiel #2
0
def new_sep_structure(service, sep_sec_id, sep_sib_id, sep_aud_id,
                      parts_dict: Dict):
    # Create new "Current Chartz" and "Old Chartz" separated section part folders
    output = {}

    for parent, abbr in [(sep_sec_id, 'sec'), (sep_sib_id, 'sib'),
                         (sep_aud_id, 'aud')]:
        for prefix, age in [("Current", 'curr'), ("Old", 'old'),
                            ("Future", 'future')]:
            res = util.make_folder(service, f'{prefix} Chartz', parent)
            if not res: return None
            output[f'sep_{abbr}_{age}'] = res

    # Create individual part folders
    for dest in ('sec', 'aud'):
        output[dest] = {}
        for age in ('old', 'curr', 'future'):
            output[dest][age] = {}
            for part in parts_dict.keys():
                res = util.make_folder(service, part,
                                       output[f'sep_{dest}_{age}'])
                if not res: return None
                output[dest][age][part] = res

    return output
Beispiel #3
0
def make_section_folders(service, new_folder_id, parts):
    output = {}
    instrument_folder_id = util.make_folder(service, "Parts by Instrument",
                                            new_folder_id)
    audio_folder_id = util.make_folder(service, "Audio by Instrument",
                                       new_folder_id)

    for id, abbr in ((instrument_folder_id, 'sec'), (audio_folder_id, 'aud')):
        output[abbr] = {}
        for part in parts:
            output[abbr][part] = util.make_folder(service, part, id)
    return output
Beispiel #4
0
def create_chart_structure(service, chartz_id, chart_name):
    # Ensure this chart doesn't already exist!
    if util.get_folder_ids(service, name=chart_name, parent=chartz_id) != None:
        print(
            f'WARNING: Chart with name "{chart_name}" already exists, no new folder will be created'
        )
        return None, None

    # Create new chart folder
    chart_id = util.make_folder(service, chart_name, chartz_id)
    parts_id = util.make_folder(service, "Parts", chart_id, True)
    audio_id = util.make_folder(service, "Audio", chart_id, True)
    print(f'Successfully created chart folder for "{chart_name}"')
    return chart_id, parts_id, audio_id
Beispiel #5
0
def add_live_part_folders(service, live_id):
    return util.make_folder(service, "Current Chartz",
                            live_id), util.make_folder(service, "Old Chartz",
                                                       live_id)