generate_preference_list: Use set instead of recalling object_gen

- removes advanced feature of listing blocked videos ahead
  - was not practical for UI as videos were displayed which "require" others
- using a set to manage still to consider videos makes method way faster
master
Felix Stupp 2 years ago
parent bd77ed7fb0
commit 0e266c55b6
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -395,7 +395,7 @@ def generate_preference_list(
score_adapt: float,
limit: Optional[int] = None,
) -> List[MediaElement]:
element_list = object_gen()
element_list = set(object_gen())
# add tags corresponding to collections
collections: Iterable[MediaCollection] = MediaCollection.select()
@ -419,9 +419,8 @@ def generate_preference_list(
res_ids.append(first_element.id)
if limit is not None and limit <= len(res_ids):
break
first_element.watched = True # simulative
element_list.remove(first_element)
base = base.adapt_score(first_element, score_adapt)
element_list = object_gen()
orm.rollback()
db.execute(f"ALTER TABLE {Tag._table_} AUTO_INCREMENT = 1;")
return [MediaElement[i] for i in res_ids]

Loading…
Cancel
Save