fix: cleanup
This commit is contained in:
@@ -84,7 +84,7 @@ class ProcessDownloader implements DownloaderInterface
|
|||||||
});
|
});
|
||||||
if ($downloadEntity->getStatus() !== 'Paused') {
|
if ($downloadEntity->getStatus() !== 'Paused') {
|
||||||
$downloadEntity->setProgress(100);
|
$downloadEntity->setProgress(100);
|
||||||
$this->broadcaster->alert('Success', '"'.$title.'" has finished downloading."', sendPush: true);
|
$this->alertComplete($downloadEntity);
|
||||||
}
|
}
|
||||||
} catch (ProcessFailedException $exception) {
|
} catch (ProcessFailedException $exception) {
|
||||||
$downloadEntity->setStatus('Failed');
|
$downloadEntity->setStatus('Failed');
|
||||||
@@ -108,4 +108,15 @@ class ProcessDownloader implements DownloaderInterface
|
|||||||
|
|
||||||
throw new \Exception("There is no download path for media type: $mediaType");
|
throw new \Exception("There is no download path for media type: $mediaType");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function alertComplete(Download $download): void
|
||||||
|
{
|
||||||
|
if ("tvshows" === $download->getMediaType()) {
|
||||||
|
$message = '"' . $download->getTitle() . '" - ' . $download->getEpisodeId() . ' has finished downloading.';
|
||||||
|
} else {
|
||||||
|
$message = '"' . $download->getTitle() . '" has finished downloading.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->broadcaster->alert('Success', $message, sendPush: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,11 @@
|
|||||||
|
|
||||||
<turbo-stream action="prepend" target="alert_list">
|
<turbo-stream action="prepend" target="alert_list">
|
||||||
<template>
|
<template>
|
||||||
<twig:Alert title="Finished downloading" message="{{ entity.title }}" alert_id="{{ entity.id }}" data-controller="alert" />
|
{% if entity.mediaType == "tvshows" %}
|
||||||
|
<twig:Alert title="Success" message="{{ entity.title }} - ({{ entity.episodeId }}) has finished downloading." alert_id="{{ entity.id }}" data-controller="alert" />
|
||||||
|
{% else %}
|
||||||
|
<twig:Alert title="Success" message="{{ entity.title }} has finished downloading." alert_id="{{ entity.id }}" data-controller="alert" />
|
||||||
|
{% endif %}
|
||||||
</template>
|
</template>
|
||||||
</turbo-stream>
|
</turbo-stream>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user