Exemple #1
0
def start(error_counter, addon_path, config=None):
    colorPrint("Checking %s" % os.path.basename(os.path.normpath(addon_path)),
               "34")

    global REL_PATH
    # Extract common path from addon paths
    # All paths will be printed relative to this path
    REL_PATH = os.path.split(addon_path[:-1])[0]
    error_counter, addon_xml = _check_addon_xml(error_counter, addon_path)

    if addon_xml != None:
        if len(addon_xml.findall("*//broken")) == 0:
            file_index = _create_file_index(addon_path)

            error_counter = _check_for_invalid_xml_files(
                error_counter, file_index)

            error_counter = _check_for_invalid_json_files(
                error_counter, file_index)

            error_counter = _check_artwork(error_counter, addon_path,
                                           addon_xml, file_index)

            if check_config(config, "check_license_file_exists"):
                # check if license file is existing
                error_counter = _addon_file_exists(
                    error_counter, addon_path,
                    "LICENSE\.txt|LICENSE\.md|LICENSE")

            if check_config(config, "check_legacy_strings_xml"):
                error_counter = _check_for_legacy_strings_xml(
                    error_counter, addon_path)

            if check_config(config, "check_legacy_language_path"):
                error_counter = _check_for_legacy_language_path(
                    error_counter, addon_path)

            # Kodi 18 Leia + deprecations
            if check_config(config, "check_kodi_leia_deprecations"):
                error_counter = _find_blacklisted_strings(
                    error_counter, addon_path, [
                        "System.HasModalDialog", "StringCompare", "SubString",
                        "IntegerGreaterThan", "ListItem.ChannelNumber",
                        "ListItem.SubChannelNumber",
                        "MusicPlayer.ChannelNumber",
                        "MusicPlayer.SubChannelNumber",
                        "VideoPlayer.ChannelNumber",
                        "VideoPlayer.SubChannelNumber"
                    ], [], [".py", ".xml"])

            # General blacklist
            error_counter = _find_blacklisted_strings(error_counter,
                                                      addon_path, [], [], [])

            error_counter = _check_file_whitelist(error_counter, file_index,
                                                  addon_path)
        else:
            print("Addon marked as broken - skipping")

    return error_counter
Exemple #2
0
    if len(conf_files) == 0:
        egui.show_message('No config files found in {} !!'.format(config_path))
        sys.exit(-1)
    # endif

    # Select config
    config_t = egui.get_choice('Select config to run.', choices=conf_files)
    if config_t == None:
        egui.show_message('No choice selected !!')
        sys.exit(-1)
    # endif
    down_csvs = egui.get_yes_or_no('Download csv files ??')
    take_backup = egui.get_yes_or_no('Backup downloaded csv files ?')
    open_final = egui.get_yes_or_no('Open final report file ?')

    # Override
    config_json = json.load(open(config_path + '/' + config_t))
    config_json['download_csvs'] = down_csvs
    config_json['csv_backup'] = take_backup

    # Checks
    check_config(config_json)

    # Invoke scanner
    report_file = run_scanner_main(config_json)
    if open_final:
        subprocess.call(['xdg-open', report_file])
    # endif
# enddef
Exemple #3
0
def test_with_missing_config():
    config = __read_config_for_version('does_not_exist.json')
    assert check_config(config, "does_not_exist") is False
Exemple #4
0
def test_if_does_not_exists_default_to_false():
    config = __read_config_for_version('.tests-config.json')
    assert check_config(config, "does_not_exist") is False
Exemple #5
0
def test_if_true_gets_picked_up():
    config = __read_config_for_version('.tests-config.json')
    assert check_config(config, "check_legacy_strings_xml") is True
Exemple #6
0
def test_if_false_gets_picked_up():
    config = __read_config_for_version('.tests-config.json')
    assert check_config(config, "check_license_file_exists") is False
_log("--------------------")
_log('O2TVKodi Playlist')
_log('Version: %s %s' % (c.version, c.date))
_log('Python: %s' % platform.python_version())
_log("--------------------")
_log("Starting...")

c.set_default_config(config)
with codecs.open(os.path.join(os.path.dirname(os.path.abspath(__file__)),
                              'config.ini'),
                 'r',
                 encoding='utf-8') as f:
    config.read_file(f)

if not c.check_config(config):
    _log('Invalid username or password.')
    _log('Please check config.ini')
    exit()
_log('Config OK')
_cut_log(config.getint('Common', 'log_limit'),
         config.getint('Common', 'log_reduction'))

# device_id = _get_id(c.id_file)
device_id = config.get('Login', 'device_id')
if not (device_id or config.get('Login', 'device_id')):
    first_device_id = c.device_id()
    second_device_id = c.device_id()
    if first_device_id == second_device_id:
        config.set('Login', 'device_id', first_device_id)
    else: