clean up if pre-split returns None
This commit is contained in:
parent
df622206b6
commit
56b4fdb942
1 changed files with 25 additions and 20 deletions
|
|
@ -203,7 +203,7 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
||||||
|
|
||||||
if entry_:
|
if entry_:
|
||||||
self._post_process_entry(
|
self._post_process_entry(
|
||||||
plugins=plugins, dry_run=dry_run, entry=entry, entry_metadata=entry_metadata
|
plugins=plugins, dry_run=dry_run, entry=entry_, entry_metadata=entry_metadata
|
||||||
)
|
)
|
||||||
|
|
||||||
self._cleanup_entry_files(entry)
|
self._cleanup_entry_files(entry)
|
||||||
|
|
@ -211,6 +211,8 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
||||||
def _process_split_entry(
|
def _process_split_entry(
|
||||||
self, split_plugin: Plugin, plugins: List[Plugin], dry_run: bool, entry: Entry
|
self, split_plugin: Plugin, plugins: List[Plugin], dry_run: bool, entry: Entry
|
||||||
) -> None:
|
) -> None:
|
||||||
|
entry_: Optional[Entry] = entry
|
||||||
|
|
||||||
plugins_pre_split = sorted(
|
plugins_pre_split = sorted(
|
||||||
[plugin for plugin in plugins if not plugin.priority.modify_entry_after_split],
|
[plugin for plugin in plugins if not plugin.priority.modify_entry_after_split],
|
||||||
key=lambda _plugin: _plugin.priority.modify_entry,
|
key=lambda _plugin: _plugin.priority.modify_entry,
|
||||||
|
|
@ -223,12 +225,13 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
||||||
|
|
||||||
# First, modify the entry with pre_split plugins
|
# First, modify the entry with pre_split plugins
|
||||||
for plugin in plugins_pre_split:
|
for plugin in plugins_pre_split:
|
||||||
# Return if it is None, it is indicated to not process any further
|
# Break if it is None, it is indicated to not process any further
|
||||||
if (entry := plugin.modify_entry(entry)) is None:
|
if (entry_ := plugin.modify_entry(entry_)) is None:
|
||||||
return
|
break
|
||||||
|
|
||||||
# Then, perform the split
|
# Then, perform the split
|
||||||
for split_entry, split_entry_metadata in split_plugin.split(entry=entry):
|
if entry_:
|
||||||
|
for split_entry, split_entry_metadata in split_plugin.split(entry=entry_):
|
||||||
split_entry_: Optional[Entry] = split_entry
|
split_entry_: Optional[Entry] = split_entry
|
||||||
|
|
||||||
for plugin in plugins_post_split:
|
for plugin in plugins_post_split:
|
||||||
|
|
@ -248,6 +251,8 @@ class SubscriptionDownload(BaseSubscription, ABC):
|
||||||
|
|
||||||
self._cleanup_entry_files(split_entry)
|
self._cleanup_entry_files(split_entry)
|
||||||
|
|
||||||
|
self._cleanup_entry_files(entry)
|
||||||
|
|
||||||
def download(self, dry_run: bool = False) -> FileHandlerTransactionLog:
|
def download(self, dry_run: bool = False) -> FileHandlerTransactionLog:
|
||||||
"""
|
"""
|
||||||
Performs the subscription download
|
Performs the subscription download
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue