Add song_count variable to custom playlist builder.
This commit is contained in:
parent
770bd7ce56
commit
a45d23ca84
@ -32,7 +32,7 @@ def prompt_for_player_id(default_id='76561199407393962'):
|
||||
user_input = input(prompt).strip()
|
||||
return user_input if user_input else default_id
|
||||
|
||||
def build_difficulty_based_playlist(api, player_id, history, playlist_name):
|
||||
def build_difficulty_based_playlist(api, player_id, history, playlist_name, song_count=5):
|
||||
scores_data = api.get_player_scores(player_id, use_cache=True)
|
||||
all_scores = scores_data['data']
|
||||
all_scores.sort(key=lambda x: x['timepost'])
|
||||
@ -58,7 +58,7 @@ def build_difficulty_based_playlist(api, player_id, history, playlist_name):
|
||||
difficulty_groups[3].append(score)
|
||||
|
||||
playlist_scores = []
|
||||
for difficulty, count in [(0, 5), (1, 5), (2, 5), (3, 5)]:
|
||||
for difficulty, count in [(0, song_count), (1, song_count), (2, song_count), (3, song_count)]:
|
||||
unique_songs = {}
|
||||
for score in difficulty_groups[difficulty]:
|
||||
song_id = score['leaderboard']['song']['id']
|
||||
@ -120,7 +120,7 @@ def saberlist_replay_bl():
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
playlist_name = f"star_ladder-{timestamp}"
|
||||
|
||||
playlist_file, playlist_scores, used_cover = build_difficulty_based_playlist(api, player_id, history, playlist_name)
|
||||
playlist_file, playlist_scores, used_cover = build_difficulty_based_playlist(api, player_id, history, playlist_name, song_count=10)
|
||||
save_history(history)
|
||||
|
||||
# Create the full path for the cover image
|
||||
|
Loading…
x
Reference in New Issue
Block a user