You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 21:53:54 +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)
|
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]}
|
SORT_LEN = 100
|
||||||
least_top_paths = {path for path, count in sorted_by_play_count[-10:]}
|
if len(playlist) >= SORT_LEN:
|
||||||
for a,b in zip(top_paths, least_top_paths):
|
top_paths = {path for path, count in sorted_by_play_count[:SORT_LEN]}
|
||||||
a_track = b_track = None
|
least_top_paths = {path for path, count in sorted_by_play_count[-SORT_LEN:]}
|
||||||
a_i = b_i = 0
|
for a,b in zip(top_paths, least_top_paths):
|
||||||
for a_i, a_track in enumerate(playlist):
|
a_track = b_track = None
|
||||||
if not a_track.official: continue
|
a_i = b_i = 0
|
||||||
if a_track.path == a: break
|
for a_i, a_track in enumerate(playlist):
|
||||||
if not a_track: continue
|
if not a_track.official: continue
|
||||||
for b_i, b_track in enumerate(playlist):
|
if a_track.path == a: break
|
||||||
if not b_track.official: continue
|
if not a_track: continue
|
||||||
if b_track.path == b: break
|
for b_i, b_track in enumerate(playlist):
|
||||||
if not b_track: continue
|
if not b_track.official: continue
|
||||||
if a_i < b_i:
|
if b_track.path == b: break
|
||||||
playlist[a_i], playlist[b_i] = playlist[b_i], playlist[a_i]
|
if not b_track: continue
|
||||||
|
if a_i < b_i:
|
||||||
|
playlist[a_i], playlist[b_i] = playlist[b_i], playlist[a_i]
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(playlist) - 1:
|
while i < len(playlist) - 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user