How to use the slider.game_mode.GameMode function in slider

To help you get started, we’ve selected a few slider examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github llllllllll / slider / slider / replay.py View on Github external
def accuracy(self):
        """The accuracy achieved in the replay in the range [0, 1].
        """
        if self.mode != GameMode.standard:
            raise NotImplementedError(
                'accuracy for non osu!standard replays is not yet supported',
            )

        return accuracy(
            self.count_300,
            self.count_100,
            self.count_50,
            self.count_miss,
        )
github llllllllll / slider / slider / replay.py View on Github external
raise ValueError(
                    'one of library or client must be passed if you wish the'
                    ' beatmap to be retrieved',
                )

            use_client = client is not None
            if use_client:
                if library is not None:
                    raise ValueError(
                        'only one of library or client can be passed'
                    )
                library = client.library

        buffer = bytearray(data)

        mode = GameMode(consume_byte(buffer))
        version = consume_int(buffer)
        beatmap_md5 = consume_string(buffer)
        player_name = consume_string(buffer)
        replay_md5 = consume_string(buffer)
        count_300 = consume_short(buffer)
        count_100 = consume_short(buffer)
        count_50 = consume_short(buffer)
        count_geki = consume_short(buffer)
        count_katu = consume_short(buffer)
        count_miss = consume_short(buffer)
        score = consume_int(buffer)
        max_combo = consume_short(buffer)
        full_combo = bool(consume_byte(buffer))
        mod_mask = consume_int(buffer)
        life_bar_graph = _consume_life_bar_graph(buffer)
        timestamp = consume_datetime(buffer)
github llllllllll / slider / slider / client.py View on Github external
def user(self,
             *,
             user_name=None,
             user_id=None,
             game_mode=GameMode.standard,
             event_days=1):
        """Retrieve information about a user.

        Parameters
        ----------
        user_name : str
            The name of the user to look up. This cannot be passed with
            ``user_id``.
        user_id : int
            The id of the user to look up. This cannot be passed with
            ``user_name``
        game_mode : GameMode, optional
            The game mode to look up stats for.
        event_days : int, optional
            Max number of days between now and last event date in the range
            [1, 31].
github llllllllll / slider / slider / beatmap.py View on Github external
audio_filename=_get_as_str(groups, 'General', 'AudioFilename'),
            audio_lead_in=timedelta(
                milliseconds=_get_as_int(groups, 'General', 'AudioLeadIn', 0),
            ),
            preview_time=timedelta(
                milliseconds=_get_as_int(groups, 'General', 'PreviewTime'),
            ),
            countdown=_get_as_bool(groups, 'General', 'Countdown', False),
            sample_set=_get_as_str(groups, 'General', 'SampleSet'),
            stack_leniency=_get_as_float(
                groups,
                'General',
                'StackLeniency',
                0,
            ),
            mode=GameMode(_get_as_int(groups, 'General', 'Mode', 0)),
            letterbox_in_breaks=_get_as_bool(
                groups,
                'General',
                'LetterboxInBreaks',
                False,
            ),
            widescreen_storyboard=_get_as_bool(
                groups,
                'General',
                'WidescreenStoryboard',
                False,
            ),
            bookmarks=[
                timedelta(milliseconds=ms) for ms in _get_as_int_list(
                    groups,
                    'Editor',
github llllllllll / slider / slider / client.py View on Github external
def user_best(self,
                  *,
                  user_name=None,
                  user_id=None,
                  game_mode=GameMode.standard,
                  limit=10,
                  _user_ob=None):
        """Retrieve information about a user's best scores.

        Parameters
        ----------
        user_name : str
            The name of the user to look up. This cannot be passed with
            ``user_id``.
        user_id : int
            The id of the user to look up. This cannot be passed with
            ``user_name``
        game_mode : GameMode, optional
            The game mode to look up stats for. Defaults to osu! standard.
        limit : int, optional
            The number of results to return in the range [1, 100].
github llllllllll / slider / slider / model / features.py View on Github external
"""
    beatmaps_and_mods = []
    accuracies = []

    beatmap_and_mod_append = beatmaps_and_mods.append
    accuracy_append = accuracies.append

    for entry in os.scandir(path):
        if not entry.name.endswith('.osr'):
            continue

        replay = Replay.from_path(entry, client=client, library=library)
        if age is not None and datetime.utcnow() - replay.timestamp > age:
            continue

        if (replay.mode != GameMode.standard or
                replay.autoplay or
                replay.auto_pilot or
                replay.cinema or
                replay.relax or
                len(replay.beatmap.hit_objects) < 2):
            # ignore plays with mods that are not representative of user skill
            continue

        beatmap_and_mod_append((
            replay.beatmap, {
                'easy': replay.easy,
                'hidden': replay.hidden,
                'hard_rock': replay.hard_rock,
                'double_time': replay.double_time,
                'half_time': replay.half_time,
                'flashlight': replay.flashlight,