new functions
This commit is contained in:
@@ -26,9 +26,11 @@ class TorrentCache:
|
||||
profile_id = int(profile["id"])
|
||||
try:
|
||||
rows = rtorrent.list_torrents(profile)
|
||||
with self._lock:
|
||||
old = dict(self._data.get(profile_id, {}))
|
||||
post_check_changes = rtorrent.apply_post_check_policy(profile, rows, old)
|
||||
fresh = {t["hash"]: t for t in rows}
|
||||
with self._lock:
|
||||
old = self._data.get(profile_id, {})
|
||||
added = [v for h, v in fresh.items() if h not in old]
|
||||
removed = [h for h in old.keys() if h not in fresh]
|
||||
updated = []
|
||||
@@ -45,7 +47,7 @@ class TorrentCache:
|
||||
self._data[profile_id] = fresh
|
||||
self._errors[profile_id] = ""
|
||||
self._updated_at[profile_id] = time()
|
||||
return {"ok": True, "profile_id": profile_id, "added": added, "updated": updated, "removed": removed}
|
||||
return {"ok": True, "profile_id": profile_id, "added": added, "updated": updated, "removed": removed, "post_check_changes": post_check_changes}
|
||||
except Exception as exc:
|
||||
with self._lock:
|
||||
self._errors[profile_id] = str(exc)
|
||||
|
||||
Reference in New Issue
Block a user