Exemplo n.º 1
0
def settings_json():
    ''' Create settings_json file '''
    os.chdir(install.LYNDOR_PATH)

    settings_dict = {
        "credentials": {
            "regular_login": {
                "username": "",
                "password": ""
            },
            "library_login": {
                "card_number": "",
                "card_pin": "",
                "organization_url": ""
            },
            "course_download_pref": "regular-login",
            "exfile_download_pref": "regular-login",
        },
        "preferences": {
            "location": install.set_path() + '/Lynda',
            "download_subtitles": False,
            "download_exercise_file":
            False,  # feature unavailable for organizational login
            "web_browser_for_exfile":
            "chrome",  # select chrome or firefox as a web browser
            "aria2_installed": False,  # set True after installing aria2
            "download_time": "",
            "redownload_course":
            "prompt",  # choose between -> prompt, skip & force re-download
            "exfile_download_method":
            "selenium",  # choose between selenium and aria2
        }
    }

    settings = os.path.join(install.LYNDOR_PATH,
                            'settings/static/js/settings.json')
    out_file = open(settings, 'w')
    json.dump(settings_dict, out_file, indent=4)
    out_file.close()

    print(
        f"\n>>> Courses will be saved at -> {read.settings_json('preferences', 'location')} \n"
    )
    print(
        '-> settings.json file created at Lyndor/settings/static/js/settings.json\n'
    )
Exemplo n.º 2
0
def settings_json():
    ''' Create settings_json file '''
    os.chdir(read.LYNDOR_PATH)

    settings_dict = {
        "credentials": {
            "username": "",  # use cookie for organizational login-
            "password": "",  # instead of username & password
            "use_cookie_for_download":
            True,  # if false, username & password will be used
        },
        "preferences": {
            "location": install.set_path() + '/Lynda',
            "download_subtitles": True,
            "download_exercise_file":
            False,  # feature unavailable for organizational login
            "web_browser_for_exfile":
            'chrome',  # select chrome or firefox as a web browser
            "ext-downloader-aria2-installed":
            False,  # set True after installing aria2
            "download_time": "",
            "redownload_course":
            "prompt"  # choose between -> prompt, skip & force re-download
        },
        "requirements": {
            "dependencies": [
                'youtube-dl', 'requests', 'beautifulsoup4', 'colorama',
                'selenium'
            ]
        }
    }
    out_file = open(read.LYNDOR_PATH + '/settings.json', 'w')
    json.dump(settings_dict, out_file, indent=4)
    out_file.close()

    print('\n>>> Courses will be saved at -> ' +
          read.settings_json('preferences', 'location') + '\n')
    print('-> settings.json file created in Lyndor folder.\
 (Have a look at this file, you can edit settings here.)\n')