mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
fix some AI bs
This commit is contained in:
@@ -202,16 +202,17 @@ def get_recently_played(limit=7):
|
|||||||
|
|
||||||
BATCH_SIZE = 200
|
BATCH_SIZE = 200
|
||||||
current_index = 0
|
current_index = 0
|
||||||
|
|
||||||
entries = ScrobbleTable.get_all(0, BATCH_SIZE)
|
entries = ScrobbleTable.get_all(0, BATCH_SIZE)
|
||||||
max_iterations = 20 # Safeguard against unexpected infinite loops
|
max_iterations = 20 # Safeguard against unexpected infinite loops
|
||||||
iterations = 0
|
iterations = 0
|
||||||
|
|
||||||
while len(items) < limit and iterations < max_iterations:
|
while len(items) < limit and iterations < max_iterations:
|
||||||
create_items(entries[current_index : current_index + BATCH_SIZE])
|
create_items(entries)
|
||||||
current_index += BATCH_SIZE
|
current_index += BATCH_SIZE
|
||||||
|
|
||||||
if len(items) < limit:
|
if len(items) < limit:
|
||||||
entries = ScrobbleTable.get_all(current_index, BATCH_SIZE)
|
entries = ScrobbleTable.get_all(current_index + 1, BATCH_SIZE)
|
||||||
if not entries:
|
if not entries:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user