Exemplo n.º 1
0
def main():
    con = PyloadConnection()

    packages = con.getQueueData()

    for package in packages:
        offline = [link for link in package["links"] if link["status"] == 1]

        if len(offline) == 0:
            continue

        print("The following links in '%s' are offline:" % package["name"])

        for plugin in set(link["plugin"] for link in offline):
            plugin_links = len([link for link in offline if link["plugin"] == plugin])
            print("- %i links from %s" % (plugin_links, plugin))

            for i in set(l["statusmsg"] for l in offline):
                print(i)

        answer = input("Do you want to delete those links? ")

        print()

        if answer.lower() in ["y", "yes", "j", "ja"]:
            con.deleteFiles(fids=[link["fid"] for link in offline])
Exemplo n.º 2
0
def main():
    con = PyloadConnection()

    packages = con.getQueueData()

    for package in packages:
        offline = [link for link in package['links'] if link['status'] == 1]

        if len(offline) == 0:
            continue

        print("The following links in '%s' are offline:" % package['name'])

        for plugin in set(link['plugin'] for link in offline):
            plugin_links = len([link for link in offline if link['plugin'] == plugin])
            print("- %i links from %s" % (plugin_links, plugin))

            for i in set(l['statusmsg'] for l in offline):
                print(i)


        answer = input("Do you want to delete those links? ")

        print()

        if answer.lower() in ['y', 'yes', 'j', 'ja']:
            con.deleteFiles(fids=[link['fid'] for link in offline])
Exemplo n.º 3
0
def main():
    con = PyloadConnection()

    packages = con.getQueueData()

    for package in packages:
        incomplete = [link for link in package['links'] if regex.match(link['name'])]

        if len(incomplete):
            print("Checking %s" % package['name'])
            con.recheckPackage(pid=package['pid'])
Exemplo n.º 4
0
def main():
    con = PyloadConnection()

    packages = con.getQueueData()

    for package in packages:
        offline = [link for link in package['links'] if regex.match(link['url'])]

        if len(offline):
            print("Deleting %d files in %s" % (len(offline), package['name']))
            con.deleteFiles(fids=[link['fid'] for link in offline])
def main():
    con = PyloadConnection()

    packages = con.getQueueData()

    for package in packages:
        incomplete = [
            link for link in package['links'] if regex.match(link['name'])
        ]

        if len(incomplete):
            print("Checking %s" % package['name'])
            con.recheckPackage(pid=package['pid'])
Exemplo n.º 6
0
def main():
    con = PyloadConnection()
    con.restartFailed()
Exemplo n.º 7
0
def main():
    con = PyloadConnection()

    collected = con.getCollectorData()

    bags = {}

    regex = re.compile(sys.argv[1] if len(sys.argv) > 1 else '.*')

    for package in collected:
        match = regex.match(package['name'])

        if match:
            if match.groups():
                part = match.group(1)
            else:
                part = match.group(0)

            if part in bags:
                bags[part].append(package)
            else:
                bags[part] = [package]

    for key, packages in list(bags.items()):
        if len(packages) > 1:
            def count_finished(package):
                count = 0

                for link in package['links']:
                    if link['status'] == 0:
                        count += 1

                return count

            packages.sort(key=count_finished, reverse=True)
        else:
            del bags[key]

    for key, packages in sorted(bags.items()):
        print(key)

        for package in packages:
            files = len(package['links'])
            hosters = set(link['plugin'] for link in package['links'])
            print("- %s (%i files; %s)" % (package['name'], files, ', '.join(hosters)))

        print()

    if not bags:
        print("Nothing to merge")
        return

    accept = input("Do you want to merge these packages? ")

    if accept not in ['y', 'j']:
        print("OK, aborting!")
        return

    print()

    for key, packages in bags.items():
        print("Merging", key, "...")

        root = packages[0]
        rest = packages[1:]

        pid = root['pid']

        if root['name'] != key:
            con.setPackageName(pid=pid, name=key)

        links = []

        for package in rest:
            links += (link['url'] for link in package['links'])

        con.addFiles(pid=pid, links=links)

        pids = [package['pid'] for package in rest]

        con.deletePackages(pids=pids)
Exemplo n.º 8
0
def main():
    con = PyloadConnection()
    con.restartFailed()