Example #1
0
def main():
    """
    MIUI Updates Tracker
    """
    names, sr_devices, sf_devices = load_devices()
    fastboot_roms = {'stable_fastboot': {'branch': 'F', 'devices': sf_devices}}
    recovery_roms = {'stable_recovery': {'branch': '1', 'devices': sr_devices}}
    ao_run = False
    discord_bot = DiscordBot(DISCORD_BOT_TOKEN)
    for name, data in fastboot_roms.items():
        # fetch based on version
        rename(f'{name}/{name}.yml', f'{name}/old_{name}')
        fastboot.fetch(data['devices'], data['branch'], name, names)
        print(f"Fetched {name}")
        if "stable_fastboot" in name and ao_run is False:
            ao.main()
            ao_run = True
        # Merge files
        merge_yaml(name)
        # Compare
        print(f"Comparing {name} files")
        diff(name)
    for name, data in recovery_roms.items():
        rename(f'{name}/{name}.yml', f'{name}/old_{name}')
        recovery.get_roms(data['devices'], data['branch'], name, names)
        print(f"Fetched {name}")
        merge_yaml(name)
        print(f"Comparing {name} files")
        diff(name)
    if CHANGES:
        generate_rss(CHANGED)
        updates = [x for y in CHANGES for x in y]
        discord_bot.send(updates)
        for update in updates:
            if is_roll_back(update):
                continue
            message = generate_message(update)
            # print(message)
            post_message(message)
            archive(update)
    else:
        print('No new updates found!')
    versions = [i for i in fastboot_roms.keys()
                ] + [i for i in recovery_roms.keys()]
    for version in versions:
        merge_rss(version)
    merge_archive()
    print("Done")
    git_commit_push()
    for file in glob(f'*_*/old_*'):
        remove(file)
Example #2
0
def main():
    """
    MIUI Updates Tracker
    """
    initialize()
    names, sr_devices, sf_devices, wr_devices, wf_devices = load_devices()
    versions = {
        'stable_fastboot': {
            'branch': 'F',
            'devices': sf_devices
        },
        'stable_recovery': {
            'branch': '1',
            'devices': sr_devices
        },
        'weekly_fastboot': {
            'branch': 'X',
            'devices': wf_devices
        },
        'weekly_recovery': {
            'branch': '0',
            'devices': wr_devices
        }
    }
    for name, data in versions.items():
        # fetch based on version
        if "_fastboot" in name:
            fastboot.fetch(data['devices'], data['branch'], f'{name}/', names)
        elif "_recovery" in name:
            recovery.get_roms(name)
        print("Fetched " + name.replace('_', ' '))
        # Merge files
        print("Creating YAML")
        yaml_files = [
            x for x in sorted(glob(f'{name}/*.yml'))
            if not x.startswith('old_')
        ]
        yaml_data = []
        for file in yaml_files:
            with open(file, "r") as yaml_file:
                yaml_data.append(yaml.load(yaml_file, Loader=yaml.CLoader))
        with open(f'{name}/{name}', "w") as output:
            yaml.dump(yaml_data, output, Dumper=yaml.CDumper)
        # Cleanup
        for file in glob(f'{name}/*.yml'):
            remove(file)
        if path.exists(f'{name}/{name}'):
            rename(f'{name}/{name}', f'{name}/{name}.yml')
Example #3
0
def main():
    """
    MIUI Updates Tracker
    """
    names, sr_devices, sf_devices, wr_devices, wf_devices = load_devices()
    fastboot_roms = {
        'stable_fastboot': {
            'branch': 'F',
            'devices': sf_devices
        },
        'weekly_fastboot': {
            'branch': 'X',
            'devices': wf_devices
        }
    }
    recovery_roms = {
        'stable_recovery': {
            'branch': '1',
            'devices': sr_devices
        },
        'weekly_recovery': {
            'branch': '0',
            'devices': wr_devices
        }
    }
    ao_run = False
    for name, data in fastboot_roms.items():
        # fetch based on version
        rename(f'{name}/{name}.json', f'{name}/old_{name}')
        fastboot.fetch(data['devices'], data['branch'], f'{name}/', names)
        print(f"Fetched {name}")
        if "stable_fastboot" in name and ao_run is False:
            ao.main()
            ao_run = True
        # Merge files
        merge_json(name)
        # Compare
        print(f"Comparing {name} files")
        diff(name)
    if CHANGES:
        for name, data in recovery_roms.items():
            rename(f'{name}/{name}.json', f'{name}/old_{name}')
            recovery.get_roms(name, CHANGED, data['devices'])
            print(f"Fetched {name}")
            merge_json(name)
            print(f"Comparing {name} files")
            diff(name)
    if CHANGES:
        generate_rss(CHANGED)
        for branch in CHANGES:
            for update in branch:
                message = generate_message(update)
                post_message(message)
    else:
        print('No new updates found!')
    versions = [i for i in fastboot_roms.keys()
                ] + [i for i in recovery_roms.keys()]
    for version in versions:
        merge_rss(version)
    print("Done")
    git_commit_push()
    for file in glob(f'*_*/old_*'):
        remove(file)
Example #4
0
        branch = "1"
        devices = SR_DEVICES
    elif "stable_fastboot" in v:
        branch = "F"
        devices = SF_DEVICES
    elif "weekly_recovery" in v:
        branch = "0"
        devices = WR_DEVICES
    elif "weekly_fastboot" in v:
        branch = "X"
        devices = WF_DEVICES
    # fetch based on version
    if "_recovery" in v:
        recovery.fetch(devices, branch, folder, NAMES)
    elif "_fastboot" in v:
        fastboot.fetch(devices, branch, folder, NAMES)
    print("Fetched " + v.replace('_', ' '))

    # Merge files
    print("Creating JSON")
    json_files = [x for x in sorted(glob(v + '/' + '*.json'))]
    json_data = list()
    for file in json_files:
        with open(file, "r") as f:
            json_data.append(json.load(f))
    with open(v + '/' + v, "w") as f:
        json.dump(json_data, f, indent=1)

    # Cleanup
    for file in glob(v + '/' + '*.json'):
        remove(file)
Example #5
0
        branch = "1"
        devices = sr_devices
    elif "stable_fastboot" in v:
        branch = "F"
        devices = sf_devices
    elif "weekly_recovery" in v:
        branch = "0"
        devices = wr_devices
    elif "weekly_fastboot" in v:
        branch = "X"
        devices = wf_devices
    # fetch based on version
    if "_recovery" in v:
        recovery.fetch(devices, branch, folder, names)
    elif "_fastboot" in v:
        fastboot.fetch(devices, branch, folder, names)
    print("Fetched " + v.replace('_', ' '))

    # Merge files
    print("Creating JSON")
    json_files = [x for x in sorted(glob(v + '/' + '*.json'))]
    json_data = list()
    for file in json_files:
        with open(file, "r") as f:
            json_data.append(json.load(f))
    with open(v + '/' + v, "w") as f:
        json.dump(json_data, f, indent=1)

    # Cleanup
    for file in glob(v + '/' + '*.json'):
        remove(file)