mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-19 00:03:36 +00:00
Keep incremental caption sync polling lightweight
This commit is contained in:
+14
-10
@@ -149,18 +149,16 @@ class CaptionMeiliSync:
|
|||||||
self.updated_total = 0
|
self.updated_total = 0
|
||||||
self.last_error: str | None = None
|
self.last_error: str | None = None
|
||||||
|
|
||||||
def _report(self) -> None:
|
def _report(self, *, pending: int | None = None) -> None:
|
||||||
if self.progress is None:
|
if self.progress is None:
|
||||||
return
|
return
|
||||||
self.progress(
|
update: dict[str, Any] = {
|
||||||
{
|
"meili_documents_updated": self.updated_total,
|
||||||
"meili_documents_updated": self.updated_total,
|
"meili_sync_error": self.last_error,
|
||||||
"meili_sync_pending": count_unsynced_caption_frames(
|
}
|
||||||
self.library_ids
|
if pending is not None:
|
||||||
),
|
update["meili_sync_pending"] = pending
|
||||||
"meili_sync_error": self.last_error,
|
self.progress(update)
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
def add(self, frame_id: str) -> None:
|
def add(self, frame_id: str) -> None:
|
||||||
self.pending.append(str(frame_id))
|
self.pending.append(str(frame_id))
|
||||||
@@ -215,6 +213,12 @@ class CaptionMeiliSync:
|
|||||||
if count == 0:
|
if count == 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
pending = (
|
||||||
|
count_unsynced_caption_frames(self.library_ids)
|
||||||
|
if self.last_error
|
||||||
|
else 0
|
||||||
|
)
|
||||||
|
self._report(pending=pending)
|
||||||
return caught_up
|
return caught_up
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user