update db
This commit is contained in:
@@ -175,7 +175,7 @@ class RadarrDbClient:
|
||||
Returns:
|
||||
(date_iso, source_description)
|
||||
"""
|
||||
# Query for earliest import event - handle both numeric (3) and string ('downloadFolderImported') formats
|
||||
# Query for earliest import event - PostgreSQL uses INTEGER EventType (3 = import)
|
||||
import_query = """
|
||||
SELECT
|
||||
h."Date" as event_date,
|
||||
@@ -183,12 +183,12 @@ class RadarrDbClient:
|
||||
h."EventType" as event_type
|
||||
FROM "History" h
|
||||
WHERE h."MovieId" = %s
|
||||
AND (h."EventType" = 3 OR h."EventType" = 'downloadFolderImported' OR h."EventType" = 'movieFileImported')
|
||||
AND h."EventType" = 3
|
||||
ORDER BY h."Date" ASC
|
||||
LIMIT 1
|
||||
"""
|
||||
|
||||
# Fallback: earliest grab event - handle both numeric (1) and string ('grabbed') formats
|
||||
# Fallback: earliest grab event - PostgreSQL uses INTEGER EventType (1 = grab)
|
||||
grab_query = """
|
||||
SELECT
|
||||
h."Date" as event_date,
|
||||
@@ -196,7 +196,7 @@ class RadarrDbClient:
|
||||
h."EventType" as event_type
|
||||
FROM "History" h
|
||||
WHERE h."MovieId" = %s
|
||||
AND (h."EventType" = 1 OR h."EventType" = 'grabbed')
|
||||
AND h."EventType" = 1
|
||||
AND h."Data" IS NOT NULL
|
||||
ORDER BY h."Date" ASC
|
||||
LIMIT 1
|
||||
@@ -346,8 +346,7 @@ class RadarrDbClient:
|
||||
MIN(h."Date") as earliest_import
|
||||
FROM "Movies" m
|
||||
JOIN "MovieMetadata" mm ON m."MovieMetadataId" = mm."Id"
|
||||
LEFT JOIN "History" h ON m."Id" = h."MovieId"
|
||||
AND (h."EventType" = 3 OR h."EventType" = 'downloadFolderImported' OR h."EventType" = 'movieFileImported')
|
||||
LEFT JOIN "History" h ON m."Id" = h."MovieId" AND h."EventType" = 3
|
||||
WHERE mm."ImdbId" IN ({placeholders})
|
||||
GROUP BY mm."ImdbId", m."Id"
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user