From 6c2558e684c9ef994ef8454eba738f0d6147de7b Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Tue, 23 Dec 2025 22:21:03 +0100 Subject: [PATCH] always swap --- modules/play_sort.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/modules/play_sort.py b/modules/play_sort.py index 6a82d6b..c7ae9ec 100644 --- a/modules/play_sort.py +++ b/modules/play_sort.py @@ -59,20 +59,10 @@ class PopularitySorterModule(PlaylistModifierModule): count1 = play_counts.get(track1.path.as_posix(), 0) count2 = play_counts.get(track2.path.as_posix(), 0) - # Determine if the first track in the pair has been played less or an equal number of times. - is_track1_less_played = count1 <= count2 + # If the first track has been played more than the second, swap them. + if count1 > count2: + playlist[i], playlist[i+1] = track2, track1 - # With a 60% chance, we want the less popular song to come first. - if random.random() < 0.6: - # If the more popular song is currently first, swap them. - if not is_track1_less_played: - playlist[i], playlist[i+1] = track2, track1 - # With a 40% chance, we want the more popular song to come first. - else: - # If the less popular song is currently first, swap them. - if is_track1_less_played: - playlist[i], playlist[i+1] = track2, track1 - # Move to the next pair of tracks. i += 2