From 693b15faeef00b658793f36f80bdcdbc89c820dd Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 9 Jul 2024 16:04:17 -0700 Subject: [PATCH] Minor comment cleanup and type hint. --- src/saberlist/scoresaber.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/saberlist/scoresaber.py b/src/saberlist/scoresaber.py index 87435ab..9cc1e5e 100644 --- a/src/saberlist/scoresaber.py +++ b/src/saberlist/scoresaber.py @@ -48,7 +48,7 @@ def leaderboards_to_playlist(leaderboards: list, playlist_title: str, playlist_a logging.info(f"Playlist written to {playlist_title}.bplist") return playlist_json -def scores_to_playlist(scores, playlist_title, playlist_author = "SaberList Tool"): +def scores_to_playlist(scores: list, playlist_title, playlist_author = "SaberList Tool"): playlist = { "playlistTitle": playlist_title, "playlistAuthor": playlist_author, @@ -69,7 +69,6 @@ def scores_to_playlist(scores, playlist_title, playlist_author = "SaberList Tool } playlist["songs"].append(song_entry) - playlist_json = json.dumps(playlist, indent=4) with open(f"{playlist_title}.bplist", 'w') as file: file.write(playlist_json) @@ -80,7 +79,7 @@ def scores_to_playlist(scores, playlist_title, playlist_author = "SaberList Tool async def async_replay_ranked(): scoresaber = ExtendedScoreSaberAPI() try: - await scoresaber.start() # Initialize the API client + await scoresaber.start() score_sort = ScoreSort.TOP scores = [] @@ -99,7 +98,7 @@ async def async_replay_ranked(): filtered_sorted_scores = filter_and_sort_scores_by_stars(scores, min_stars, max_stars) scores_to_playlist(filtered_sorted_scores, playlist_title) finally: - await scoresaber._http_client.close() # Ensure the session is closed + await scoresaber._http_client.close() def replay_ranked(): try: @@ -173,8 +172,7 @@ class ExtendedScoreSaberAPI(ScoreSaberAPI): if max_page == -1: max_page = ceil(recent_scores.metadata.total / 100) + 1 - logging.info(f"Got {len(recent_scores.player_scores)} scores") + logging.info(f"Got {len(recent_scores.player_scores)} scores from page {page}") yield recent_scores.player_scores - page += 1