Fail on flat-filter excluded media

Introduce GamdlDownloaderFlatFilterExcludedError and raise it during AppleMusicDownloader processing when item.media.flat_filter_result is truthy. This aborts further processing/download for media excluded by the flat filter and includes the media id in the error message. Also import the new exception in the downloader module.
This commit is contained in:
Rafael Moraes
2026-04-21 10:36:08 -03:00
parent c4536963f8
commit 64a20f030a
2 changed files with 11 additions and 0 deletions
+6
View File
@@ -8,6 +8,7 @@ from .constants import TEMP_PATH_TEMPLATE
from .enums import DownloadMode, RemuxMode
from .exceptions import (
GamdlDownloaderDependencyNotFoundError,
GamdlDownloaderFlatFilterExcludedError,
GamdlDownloaderMediaFileExistsError,
GamdlDownloaderSyncedLyricsOnlyError,
)
@@ -71,6 +72,11 @@ class AppleMusicDownloader:
if item.media.error:
raise item.media.error
if item.media.flat_filter_result:
raise GamdlDownloaderFlatFilterExcludedError(
item.media.media_metadata["id"]
)
await self._initial_processing(item)
await self._download(item)
await self._final_processing(item)
+5
View File
@@ -18,3 +18,8 @@ class GamdlDownloaderMediaFileExistsError(GamdlDownloaderError):
class GamdlDownloaderDependencyNotFoundError(GamdlDownloaderError):
def __init__(self, dependency_name: str) -> None:
super().__init__(f"Required dependency not found: {dependency_name}")
class GamdlDownloaderFlatFilterExcludedError(GamdlDownloaderError):
def __init__(self, media_id: str) -> None:
super().__init__(f"Media is excluded by flat filter: {media_id}")