mirror of
https://github.com/glomatico/gamdl.git
synced 2026-06-13 04:05:14 +03:00
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:
@@ -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)
|
||||
|
||||
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user