0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 13:52:00 +01:00

always swap

This commit is contained in:
2025-12-23 22:21:03 +01:00
parent 24e86b4aa0
commit 6c2558e684

View File

@@ -59,18 +59,8 @@ 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
# 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:
# If the first track has been played more than the second, swap them.
if count1 > count2:
playlist[i], playlist[i+1] = track2, track1
# Move to the next pair of tracks.