You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 13:52:00 +01:00
top 100 lol
This commit is contained in:
@@ -41,21 +41,23 @@ class PopularitySorterModule(PlaylistModifierModule):
|
||||
|
||||
sorted_by_play_count = sorted(play_counts.items(), key=lambda item: item[1], reverse=True)
|
||||
|
||||
top_paths = {path for path, count in sorted_by_play_count[:10]}
|
||||
least_top_paths = {path for path, count in sorted_by_play_count[-10:]}
|
||||
for a,b in zip(top_paths, least_top_paths):
|
||||
a_track = b_track = None
|
||||
a_i = b_i = 0
|
||||
for a_i, a_track in enumerate(playlist):
|
||||
if not a_track.official: continue
|
||||
if a_track.path == a: break
|
||||
if not a_track: continue
|
||||
for b_i, b_track in enumerate(playlist):
|
||||
if not b_track.official: continue
|
||||
if b_track.path == b: break
|
||||
if not b_track: continue
|
||||
if a_i < b_i:
|
||||
playlist[a_i], playlist[b_i] = playlist[b_i], playlist[a_i]
|
||||
SORT_LEN = 100
|
||||
if len(playlist) >= SORT_LEN:
|
||||
top_paths = {path for path, count in sorted_by_play_count[:SORT_LEN]}
|
||||
least_top_paths = {path for path, count in sorted_by_play_count[-SORT_LEN:]}
|
||||
for a,b in zip(top_paths, least_top_paths):
|
||||
a_track = b_track = None
|
||||
a_i = b_i = 0
|
||||
for a_i, a_track in enumerate(playlist):
|
||||
if not a_track.official: continue
|
||||
if a_track.path == a: break
|
||||
if not a_track: continue
|
||||
for b_i, b_track in enumerate(playlist):
|
||||
if not b_track.official: continue
|
||||
if b_track.path == b: break
|
||||
if not b_track: continue
|
||||
if a_i < b_i:
|
||||
playlist[a_i], playlist[b_i] = playlist[b_i], playlist[a_i]
|
||||
|
||||
i = 0
|
||||
while i < len(playlist) - 1:
|
||||
|
||||
Reference in New Issue
Block a user