Пример #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)
Пример #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')
Пример #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)