An unreadable entry keeps no row and does not make a section present

The key of an entry too malformed to name a row is now `Unreadable(position)`.  It is still counted in
import_skipped, but `present` ignores it, so a section whose entries are all unreadable removes nothing (as an empty
section), instead of deleting every row.  A playlist whose `items` is not a list keeps its items, and a Channel
Download whose url is not text is counted (its Channel keeps its Downloads) instead of failing the import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-10-25 16:02:08 -06:00
parent a787c02908
commit 96d5aa3a99
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
10 changed files with 134 additions and 24 deletions

View file

@ -25,7 +25,7 @@ from wrolpi.cmd import GIT_BIN, run_command
from wrolpi.collections.models import Collection
from wrolpi.common import ConfigFile, get_media_directory, get_relative_to_media_directory, logger, \
escape_file_name, background_task, get_wrolpi_config
from wrolpi.config_import import ConfigSection, media_relative
from wrolpi.config_import import ConfigSection, Unreadable, media_relative
from wrolpi.config_version import register_ownership
from wrolpi.db import get_db_session
from wrolpi.downloader import Download, DownloadFrequency, download_manager, save_downloads_config
@ -1400,8 +1400,8 @@ class ReposSection(ConfigSection):
url = data.get('url') if isinstance(data, dict) else None
if not url or not isinstance(url, str):
logger.error(f'Repo config entry has no url, skipping: {data!r}')
# Counted as skipped; never a Repo's key.
invalid.add(f'\0{position}')
# Counted as skipped (see `Unreadable`).
invalid.add(Unreadable(position))
continue
try:
parsed = parse_repo_url(url)