Esempio n. 1
0
def show_report(args):
    print report()
Esempio n. 2
0
from mediacrush.mcmanage.report import report
from mediacrush.mcmanage.files import files_delete

from mediacrush.email import send_report

def show_report(args):
    print report()

database_commands = {
    'clear': database_clear,
    'upgrade': database_upgrade,
}

report_commands = {
    'show': show_report,
    'email': lambda args: send_report(report())
}

files_commands = {
    'delete': files_delete,
}

mapping = {
    'database': database_commands,
    'report': report_commands,
    'files': files_commands,
    'admin': None,
}

def find_true(arguments, mapping_dict):
    return filter(lambda x: x is not None, [item if arguments[item] else None for item in mapping_dict])[0]
Esempio n. 3
0
def show_report(args):
    print((report()))
Esempio n. 4
0
from mediacrush.mcmanage.database import database_clear, database_sync
from mediacrush.mcmanage.files import files_delete
from mediacrush.mcmanage.report import report
from mediacrush.mcmanage.shard import init, migrate


def show_report(args):
    print((report()))


database_commands = {
    "clear": database_clear,
    "sync": database_sync,
}

report_commands = {"show": show_report, "email": lambda args: send_report(report())}

files_commands = {"delete": files_delete}

shard_commands = {"init": init, "migrate": migrate}

mapping = {
    "database": database_commands,
    "report": report_commands,
    "files": files_commands,
    "shard": shard_commands,
    "admin": None,
}


def find_true(arguments, mapping_dict):
Esempio n. 5
0
from mediacrush.mcmanage.files import files_delete, files_nsfw
from mediacrush.mcmanage.shard import init, migrate

from mediacrush.email import send_report

def show_report(args):
    print(report())

database_commands = {
    'clear': database_clear,
    'sync': database_sync,
}

report_commands = {
    'show': show_report,
    'email': lambda args: send_report(report())
}

files_commands = {
    'delete': files_delete,
    'nsfw': files_nsfw
}

shard_commands = {
    'init': init,
    'migrate': migrate
}

mapping = {
    'database': database_commands,
    'report': report_commands,
Esempio n. 6
0
from docopt import docopt

from mediacrush.mcmanage.database import database_clear, database_sync
from mediacrush.mcmanage.report import report
from mediacrush.mcmanage.files import files_delete

from mediacrush.email import send_report


def show_report(args):
    print(report())


database_commands = {"clear": database_clear, "sync": database_sync}

report_commands = {"show": show_report, "email": lambda args: send_report(report())}

files_commands = {"delete": files_delete}

mapping = {"database": database_commands, "report": report_commands, "files": files_commands, "admin": None}


def find_true(arguments, mapping_dict):
    return filter(lambda x: x is not None, [item if arguments[item] else None for item in mapping_dict])[0]


if __name__ == "__main__":
    arguments = docopt(__doc__, version="1.0")
    module = find_true(arguments, mapping)
    commands = mapping[module]
    command = find_true(arguments, commands)