Beispiel #1
0
def _details(game):
    return {
        'ok': True,
        'data': {
            'status': {
                'directory': game.status(['slug', 'path']),
                'path': game.status('path'),
                'definition': game.status(['title', 'slug'])
            },
            'isCorrect': {
                'path': game.path.is_correct(),
                'slug': game.slug.is_correct(),

            },
            'isTemporary': game.is_temporary,
            'path': game.path,
            'gameRoot': norm_path(game.get_games_root()),
            'title': game.title,
            'title_logo': game.title_logo.image_path,
            'slug': game.slug,
            'pluginMain': game.plugin_main,
            'canvasMain': game.canvas_main,
            'mappingTable': game.mapping_table,
            'deployFiles': game.deploy_files.getlist(),
            'deployable': game.can_deploy,
            'engine_version': game.engine_version,
            'is_multiplayer': game.is_multiplayer,
            'aspect_ratio': game.aspect_ratio

        }
    }
Beispiel #2
0
    def __init__(self, game):
        self.lock = Lock()

        self.game = game
        self.userbadges_path = None

        self.abs_game_path = get_absolute_path(game.path)

        try:
            self.lock.acquire()
            yaml_path = norm_path(
                get_absolute_path(join_path(game.path, 'badges.yaml')))
            if not access(yaml_path, R_OK):
                raise BadgesUnsupportedException()
            f = open(unicode(yaml_path), 'r')
            try:
                self.badges = yaml.load(f)

            finally:
                f.close()
        except IOError as e:
            LOG.error('Failed loading badges: %s', str(e))
            raise ApiException('Failed loading badges.yaml file %s' % str(e))
        finally:
            self.lock.release()
Beispiel #3
0
    def _set_userbadges_path(self):
        if not self.userbadges_path:
            try:
                path = config['userbadges_db']
            except KeyError:
                LOG.error('badges_db path config variable not set')
                return

            if not create_dir(path):
                LOG.error('Game badges path \"%s\" could not be created.' % path)
            self.userbadges_path = norm_path(join_path(get_absolute_path(path), self.game.slug) + '.yaml')
Beispiel #4
0
    def _set_userbadges_path(self):
        if not self.userbadges_path:
            try:
                path = config['userbadges_db']
            except KeyError:
                LOG.error('badges_db path config variable not set')
                return

            if not create_dir(path):
                LOG.error('Game badges path \"%s\" could not be created.', path)
            self.userbadges_path = norm_path(join_path(get_absolute_path(path), self.game.slug) + '.yaml')
    def __init__(self, game):

        self.game = game

        self.abs_game_path = get_absolute_path(game.path)

        try:
            yaml_path = norm_path(get_absolute_path(join_path(game.path, 'gamenotifications.yaml')))
            if not access(yaml_path, R_OK):
                raise GameNotificationsUnsupportedException()

            with open(unicode(yaml_path), 'r') as f:
                notifications = {}
                for n_key in yaml.load(f):
                    notifications[n_key['key']] = n_key

                self._notifications = notifications

        except (IOError, KeyError) as e:
            LOG.error('Failed loading gamenotifications: %s', str(e))
            raise ApiException('Failed loading gamenotifications.yaml file %s' % str(e))
Beispiel #6
0
    def directory_options(cls):
        directory = request.params.get('dir', None)
        if not directory:
            response.status_int = 400
            return {'ok': False, 'msg': 'Directory not specified'}

        directory = directory.strip()

        # Test for characters not legal in Windows paths
        if not set(directory).isdisjoint(set('*?"<>|\0')):
            response.status_int = 400
            return {'ok': False, 'msg': 'Bad directory'}

        try:
            absDir = get_absolute_path(directory)
        except TypeError:
            response.status_int = 400
            return {'ok': False, 'msg': 'Bad directory'}

        options = {
            'absDir': norm_path(absDir),
            'dir': directory
        }

        if not os.access(absDir, os.F_OK):
            options['create'] = True
        else:
            if not os.access(absDir, os.W_OK):
                options['inaccessible'] = True
            elif os.access(path_join(absDir, 'manifest.yaml'), os.F_OK):
                if GameList.get_instance().path_in_use(absDir):
                    options['inUse'] = True
                else:
                    options['overwrite'] = True
            else:
                options['usable'] = True

        return {'ok': True, 'data': options}
Beispiel #7
0
    def __init__(self, game):

        self.game = game

        self.abs_game_path = get_absolute_path(game.path)

        try:
            yaml_path = norm_path(
                get_absolute_path(
                    join_path(game.path, 'gamenotifications.yaml')))
            if not access(yaml_path, R_OK):
                raise GameNotificationsUnsupportedException()

            with open(unicode(yaml_path), 'r') as f:
                notifications = {}
                for n_key in yaml.load(f):
                    notifications[n_key['key']] = n_key

                self._notifications = notifications

        except (IOError, KeyError) as e:
            LOG.error('Failed loading gamenotifications: %s', str(e))
            raise ApiException(
                'Failed loading gamenotifications.yaml file %s' % str(e))
Beispiel #8
0
    def __init__(self, game):
        self.lock = Lock()

        self.game = game
        self.userbadges_path = None

        self.abs_game_path = get_absolute_path(game.path)

        try:
            self.lock.acquire()
            yaml_path = norm_path(get_absolute_path(join_path(game.path, 'badges.yaml')))
            if not access(yaml_path, R_OK):
                raise BadgesUnsupportedException()
            f = open(unicode(yaml_path), 'r')
            try:
                self.badges = yaml.load(f)

            finally:
                f.close()
        except IOError as e:
            LOG.error('Failed loading badges: %s', str(e))
            raise ApiException('Failed loading badges.yaml file %s' % str(e))
        finally:
            self.lock.release()
Beispiel #9
0
def _get_settings_path():
    return norm_path(_get_task_path('', '', '', 'notificationsettings.yaml'))
Beispiel #10
0
mu = [7.0]  #np.arange(6,7,0.1)
sigma = [0.5]  #[0.6,1,1.4,1.8,2.2,2.6,3]
b_min = 1
b_max = 1.1
b_step = 0.5
"""
END OF PARAMETERS SECTION
"""
"""
INPUT FILES SECTION
"""
csv_extension = ".csv"
txt_extension = ".txt"

origin_path = norm_path(
    r'C:\Users\Roozbeh\Sumo\WDC_FewerEdgesMap\All cameras in data 106'
)  #path were sampled data are

camera_input_file_path = norm_path(
    path_join(origin_path, "cameras_3_08_09" + csv_extension))
camera_dist_file_path = norm_path(
    path_join(origin_path, "camdist_3_08_09" + csv_extension))
flows_data_file_path = norm_path(
    path_join(origin_path,
              "data_1h_sum_avg_20101121_08_09_rand" + csv_extension))
od_generation_log_file_path = norm_path(
    path_join(origin_path, "od_generation_log.txt"))

kshortest_paths_dump_path = norm_path(
    path_join(
        origin_path,
def _get_settings_path():
    return norm_path(_get_task_path('', '', '', 'notificationsettings.yaml'))