mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-04 21:59:58 -05:00
Link a Download to its domain by its destination column
`domain_download_links` read the destination only from a Download's settings, but the destination is now a column (the config import moves an old settings destination into it), so no Download was linked to a domain by its directory. Read the column, and the settings for an old Download, as channels already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
79526afebe
commit
76105baf9b
2 changed files with 29 additions and 3 deletions
|
|
@ -1018,10 +1018,12 @@ def domain_download_links(session: Session) -> Dict[int, int]:
|
|||
|
||||
links = dict()
|
||||
downloads = session.query(Download.id, Download.url, Download.downloader, Download.sub_downloader,
|
||||
Download.settings) \
|
||||
Download.destination, Download.settings) \
|
||||
.filter(Download.frequency.isnot(None), Download.collection_id.is_(None))
|
||||
for id_, url, downloader, sub_downloader, settings in downloads:
|
||||
if destination := (settings or dict()).get('destination'):
|
||||
for id_, url, downloader, sub_downloader, destination, settings in downloads:
|
||||
# An old Download kept its destination in its settings.
|
||||
destination = str(destination) if destination else (settings or dict()).get('destination')
|
||||
if destination:
|
||||
for collection_id, directory, prefix in directories:
|
||||
if destination == directory or destination.startswith(prefix):
|
||||
links[id_] = collection_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue