Exemplo n.º 1
0
django.setup()

from rest.functions.helper import logger_setup
from rest.functions.matchstatistics import matchstatistics_get
from rest.functions.teamcomparison import teamcomparison_get
import gettext

en = gettext.translation('django', localedir='locale', languages=['en'])
en.install()


class Request:
    pass


if __name__ == '__main__':

    LOGGER = logger_setup(True)

    request = Request()
    request.META = {'foo': 'bar'}

    FKEY = 'match_id'
    FVALUE = 1998

    result = matchstatistics_get(LOGGER, request, FKEY, FVALUE)
    # result = teamcomparison_get(LOGGER, request, FKEY, FVALUE)

    # from pprint import pprint
    # pprint(result)
Exemplo n.º 2
0
    if not matchlist and not allmatches and not openmatches and not pastmatches and not interval:
        print('either -a -i -o -p or --matchlist parameter must be specified')
        sys.exit(0)

    return (debug, season, match_list, addshifts, openmatches, pastmatches,
            interval, allmatches, xg_data, xg_weights)


if __name__ == '__main__':

    # get variables
    (DEBUG, SEASON_ID, MATCH_LIST, ADDSHIFTS, OPENMATCHES, PASTMATCHES,
     INTERVAL, ALLMATCHES, XG_DATA, XG_WEIGHTS) = arg_parse()

    # initialize logger
    LOGGER = logger_setup(DEBUG)

    # unix timestamp
    UTS = uts_now()

    if not SEASON_ID:
        # get season_id
        SEASON_ID = season_latest_get(LOGGER)

    if not MATCH_LIST:
        if ALLMATCHES:
            MATCH_LIST = []
        elif OPENMATCHES:
            # Get list of matches to be updated (selection current season, status finish_false, date lt_uts)
            MATCH_LIST = openmatch_list_get(LOGGER, SEASON_ID, UTS,
                                            ['match_id'])
Exemplo n.º 3
0
 def __init__(self, debug=False, deviceid='bada55bada55666'):
     self.debug = debug
     self.deviceid = deviceid
     self.logger = logger_setup(debug)