Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b3d57b94a | |||
| be7b610111 |
@@ -3,6 +3,7 @@ FROM dunglas/frankenphp:php8.4
|
|||||||
ENV SERVER_NAME=":80"
|
ENV SERVER_NAME=":80"
|
||||||
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
||||||
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
||||||
|
ENV APP_VERSION="0.0.1"
|
||||||
|
|
||||||
RUN install-php-extensions \
|
RUN install-php-extensions \
|
||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export default class extends Controller {
|
|||||||
filename: String,
|
filename: String,
|
||||||
mediaType: String,
|
mediaType: String,
|
||||||
imdbId: String,
|
imdbId: String,
|
||||||
|
episodeId: String
|
||||||
}
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
@@ -27,6 +28,7 @@ export default class extends Controller {
|
|||||||
filename: this.filenameValue,
|
filename: this.filenameValue,
|
||||||
mediaType: this.mediaTypeValue,
|
mediaType: this.mediaTypeValue,
|
||||||
imdbId: this.imdbIdValue,
|
imdbId: this.imdbIdValue,
|
||||||
|
episodeId: this.episodeIdValue
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ class DownloadMediaInput implements InputInterface
|
|||||||
#[SourceRequest('imdbId')]
|
#[SourceRequest('imdbId')]
|
||||||
public string $imdbId,
|
public string $imdbId,
|
||||||
|
|
||||||
|
#[SourceRequest('episodeId', nullify: true)]
|
||||||
|
public ?string $episodeId = null,
|
||||||
|
|
||||||
public ?int $userId = null,
|
public ?int $userId = null,
|
||||||
|
|
||||||
public ?int $downloadId = null,
|
public ?int $downloadId = null,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use App\Download\Action\Input\PauseDownloadInput;
|
|||||||
use App\Download\Action\Input\ResumeDownloadInput;
|
use App\Download\Action\Input\ResumeDownloadInput;
|
||||||
use App\Download\Framework\Repository\DownloadRepository;
|
use App\Download\Framework\Repository\DownloadRepository;
|
||||||
use App\Util\Broadcaster;
|
use App\Util\Broadcaster;
|
||||||
|
use Nihilarr\PTN;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
@@ -28,6 +29,13 @@ class ApiController extends AbstractController
|
|||||||
public function download(
|
public function download(
|
||||||
DownloadMediaInput $input,
|
DownloadMediaInput $input,
|
||||||
): Response {
|
): Response {
|
||||||
|
$ptn = (object) new Ptn()->parse($input->filename);
|
||||||
|
if ($input->mediaType === "tvshows" &&
|
||||||
|
!property_exists($ptn, 'episode') && !property_exists($ptn, 'season')
|
||||||
|
) {
|
||||||
|
$input->filename = $input->episodeId . '_' . $input->filename;
|
||||||
|
}
|
||||||
|
|
||||||
$download = $this->downloadRepository->insert(
|
$download = $this->downloadRepository->insert(
|
||||||
$this->getUser(),
|
$this->getUser(),
|
||||||
$input->url,
|
$input->url,
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ readonly class MonitorTvShowHandler implements HandlerInterface
|
|||||||
|
|
||||||
private function episodeReleasedAfterMonitorCreated(string|DateTimeImmutable $monitorStartDate, array $episodeInShow): bool
|
private function episodeReleasedAfterMonitorCreated(string|DateTimeImmutable $monitorStartDate, array $episodeInShow): bool
|
||||||
{
|
{
|
||||||
$monitorStartDate = Carbon::parse($monitorStartDate);
|
$monitorStartDate = Carbon::parse($monitorStartDate)->setTime(0, 0);
|
||||||
$episodeAirDate = Carbon::parse($episodeInShow['air_date']);
|
$episodeAirDate = Carbon::parse($episodeInShow['air_date']);
|
||||||
return $episodeAirDate >= $monitorStartDate;
|
return $episodeAirDate >= $monitorStartDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ namespace App\Twig\Extensions;
|
|||||||
|
|
||||||
use App\Monitor\Framework\Entity\Monitor;
|
use App\Monitor\Framework\Entity\Monitor;
|
||||||
use App\Monitor\Service\MediaFiles;
|
use App\Monitor\Service\MediaFiles;
|
||||||
|
use App\Torrentio\Action\Result\GetTvShowOptionsResult;
|
||||||
|
use App\Torrentio\Result\TorrentioResult;
|
||||||
use ChrisUllyott\FileSize;
|
use ChrisUllyott\FileSize;
|
||||||
|
use Tmdb\Model\Tv\Episode;
|
||||||
use Twig\Attribute\AsTwigFilter;
|
use Twig\Attribute\AsTwigFilter;
|
||||||
use Twig\Attribute\AsTwigFunction;
|
use Twig\Attribute\AsTwigFunction;
|
||||||
|
|
||||||
@@ -45,4 +48,15 @@ class UtilExtension
|
|||||||
$path
|
$path
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AsTwigFilter('episode_id_from_results')]
|
||||||
|
public function episodeId($result): ?string
|
||||||
|
{
|
||||||
|
if (!$result instanceof GetTvShowOptionsResult) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "S". str_pad($result->season, 2, "0", STR_PAD_LEFT) .
|
||||||
|
"E". str_pad($result->episode, 2, "0", STR_PAD_LEFT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for result in results.results %}
|
{% for result in results.results %}
|
||||||
<tr class="bg-white border-b dark:bg-slate-700 dark:border-gray-600 border-gray-200" data-provider="{{ result.provider }}" data-languages="{{ result.languages|json_encode }}" {% if "tvshows" == results.media.mediaType %} data-season="{{ results.season }} {% endif %}">
|
<tr class="bg-white border-b dark:bg-slate-700 dark:border-gray-600 border-gray-200" data-provider="{{ result.provider }}" data-languages="{{ result.languages|json_encode }}" {% if "tvshows" == results.media.mediaType %} data-season="{{ results.season }}"{% endif %}>
|
||||||
<td id="size" class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-50">
|
<td id="size" class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-50">
|
||||||
{{ result.size }}
|
{{ result.size }}
|
||||||
</td>
|
</td>
|
||||||
@@ -60,7 +60,8 @@
|
|||||||
title: results.media.title,
|
title: results.media.title,
|
||||||
filename: result.filename,
|
filename: result.filename,
|
||||||
mediaType: results.media.mediaType,
|
mediaType: results.media.mediaType,
|
||||||
imdbId: results.media.imdbId
|
imdbId: results.media.imdbId,
|
||||||
|
episodeId: results|episode_id_from_results
|
||||||
}) }}
|
}) }}
|
||||||
{{ stimulus_action('download_button', 'download', 'click') }}
|
{{ stimulus_action('download_button', 'download', 'click') }}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user