Clean up review findings
This commit is contained in:
+29
-3
@@ -11,6 +11,7 @@ import subprocess
|
||||
import threading
|
||||
import time
|
||||
import re
|
||||
from contextlib import contextmanager
|
||||
|
||||
from app_support import (
|
||||
DOWNLOAD_METHOD_CHOICES,
|
||||
@@ -85,10 +86,18 @@ class WatchlistRefreshJobs:
|
||||
if start_worker:
|
||||
self.ensure_worker()
|
||||
|
||||
@contextmanager
|
||||
def _connect(self):
|
||||
conn = sqlite3.connect(STATE_DB_PATH, timeout=30)
|
||||
conn.row_factory = sqlite3.Row
|
||||
return conn
|
||||
try:
|
||||
yield conn
|
||||
conn.commit()
|
||||
except Exception:
|
||||
conn.rollback()
|
||||
raise
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
def ensure_worker(self):
|
||||
with self.lock:
|
||||
@@ -553,10 +562,18 @@ class JellyfinSyncJobs:
|
||||
if start_worker:
|
||||
self.ensure_worker()
|
||||
|
||||
@contextmanager
|
||||
def _connect(self):
|
||||
conn = sqlite3.connect(STATE_DB_PATH, timeout=30)
|
||||
conn.row_factory = sqlite3.Row
|
||||
return conn
|
||||
try:
|
||||
yield conn
|
||||
conn.commit()
|
||||
except Exception:
|
||||
conn.rollback()
|
||||
raise
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
def ensure_worker(self):
|
||||
with self.lock:
|
||||
@@ -932,10 +949,18 @@ class DownloadQueue:
|
||||
if start_worker:
|
||||
self.ensure_worker()
|
||||
|
||||
@contextmanager
|
||||
def _connect(self):
|
||||
conn = sqlite3.connect(STATE_DB_PATH, timeout=30)
|
||||
conn.row_factory = sqlite3.Row
|
||||
return conn
|
||||
try:
|
||||
yield conn
|
||||
conn.commit()
|
||||
except Exception:
|
||||
conn.rollback()
|
||||
raise
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
def ensure_worker(self):
|
||||
with self.lock:
|
||||
@@ -1222,6 +1247,7 @@ class DownloadQueue:
|
||||
str(job.get("season") or "").strip(),
|
||||
str(job.get("episode_offset") or "").strip(),
|
||||
str(job.get("query") or "").strip(),
|
||||
str(job.get("provider") or "").strip().lower(),
|
||||
job.get("result_index"),
|
||||
str(job.get("mode") or "").strip().lower(),
|
||||
str(job.get("quality") or "").strip().lower(),
|
||||
|
||||
Reference in New Issue
Block a user