Compare commits

..

6 Commits

Author SHA1 Message Date
Brock H Caldwell
9a0b0443d4 chore: lists filename in error output
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 13s
2026-03-01 14:03:04 -06:00
1726b21d1d fix: uses latest tag by default
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 13s
2026-03-01 18:37:09 +00:00
Brock H Caldwell
207fd26f50 fix: prevents 'your torrent is being downloaded' downloads from download seasson handler
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 13s
2026-02-11 16:27:49 -06:00
Brock H Caldwell
aa357725e8 fix: prevents 'your torrent is being downloaded' downloads
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after -1m13s
2026-02-11 16:21:17 -06:00
Brock H Caldwell
759f64ea22 fix(DownloadSeasonHandler): actually captures season/episode numbers 2026-02-08 21:51:02 -06:00
Brock H Caldwell
cc88660c07 fix(DownloadSeasonHandler): captures episode id
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 13s
2026-02-08 15:11:14 -06:00
5 changed files with 45 additions and 31 deletions

View File

@@ -2,7 +2,7 @@
# Torsearch # # Torsearch #
################### ###################
# The version of Torsearch to run. Docker will this tag. # The version of Torsearch to run. Docker will this tag.
TAG=0.38.0 TAG=latest
# The port for which the web server (app container) will # The port for which the web server (app container) will
# serve the application on the host. # serve the application on the host.

View File

@@ -99,6 +99,7 @@ readonly class DownloadMediaHandler implements HandlerInterface
$badFileLocations = [ $badFileLocations = [
'https://torrentio.strem.fun/videos/failed_infringement_v2.mp4' => 'Removed for Copyright Infringement.', 'https://torrentio.strem.fun/videos/failed_infringement_v2.mp4' => 'Removed for Copyright Infringement.',
'https://torrentio.strem.fun/videos/downloading_v2.mp4' => 'Your torrent is downloading to your debrid provider.'
]; ];
$headers = get_headers($downloadUrl, true); $headers = get_headers($downloadUrl, true);

View File

@@ -10,6 +10,8 @@ use App\Download\Action\Command\DownloadSeasonCommand;
use App\Download\Action\Result\DownloadMediaResult; use App\Download\Action\Result\DownloadMediaResult;
use App\Download\Action\Result\DownloadSeasonResult; use App\Download\Action\Result\DownloadSeasonResult;
use App\Download\DownloadOptionEvaluator; use App\Download\DownloadOptionEvaluator;
use App\Download\Framework\Entity\Download;
use App\Download\Framework\Repository\DownloadRepository;
use App\Tmdb\TmdbClient; use App\Tmdb\TmdbClient;
use App\Torrentio\Action\Command\GetTvShowOptionsCommand; use App\Torrentio\Action\Command\GetTvShowOptionsCommand;
use App\Torrentio\Action\Handler\GetTvShowOptionsHandler; use App\Torrentio\Action\Handler\GetTvShowOptionsHandler;
@@ -26,13 +28,13 @@ use Symfony\Component\Messenger\MessageBusInterface;
readonly class DownloadSeasonHandler implements HandlerInterface readonly class DownloadSeasonHandler implements HandlerInterface
{ {
public function __construct( public function __construct(
private MediaFiles $mediaFiles, private MediaFiles $mediaFiles,
private LoggerInterface $logger, private LoggerInterface $logger,
private TmdbClient $tmdb, private TmdbClient $tmdb,
private MessageBusInterface $bus, private MessageBusInterface $bus,
private DownloadOptionEvaluator $downloadOptionEvaluator, private DownloadOptionEvaluator $downloadOptionEvaluator,
private GetTvShowOptionsHandler $getTvShowOptionsHandler, private GetTvShowOptionsHandler $getTvShowOptionsHandler,
private UserRepository $userRepository, private UserRepository $userRepository, private DownloadRepository $downloadRepository,
) {} ) {}
public function handle(CommandInterface $command): ResultInterface public function handle(CommandInterface $command): ResultInterface
@@ -68,13 +70,16 @@ readonly class DownloadSeasonHandler implements HandlerInterface
if (null !== $result) { if (null !== $result) {
$this->logger->info('> [DownloadTvSeasonHandler] ......Found 1 matching result'); $this->logger->info('> [DownloadTvSeasonHandler] ......Found 1 matching result');
$this->logger->info('> [DownloadTvSeasonHandler] ......Dispatching DownloadMediaCommand for "' . $series->title . '" season ' . $command->season . ' episode ' . $episode->episodeNumber); $this->logger->info('> [DownloadTvSeasonHandler] ......Dispatching DownloadMediaCommand for "' . $series->title . '" season ' . $command->season . ' episode ' . $episode->episodeNumber);
$download = $this->createDownload($command, $result->url, $series->title, $result->filename, $episode->episodeNumber);
$this->logger->info('> [DownloadTvSeasonHandler] ......Created Download entity with id ' . $download->getId());
$downloadCommand = new DownloadMediaCommand( $downloadCommand = new DownloadMediaCommand(
$result->url, $download->getUrl(),
$series->title, $download->getTitle(),
$result->filename, $download->getFilename(),
'tvshows', $download->getMediaType(),
$command->imdbId, $download->getImdbId(),
$command->userId, $download->getUser()->getId(),
$download->getId()
); );
$this->bus->dispatch($downloadCommand); $this->bus->dispatch($downloadCommand);
$downloadCommands[] = $downloadCommand; $downloadCommands[] = $downloadCommand;
@@ -90,19 +95,27 @@ readonly class DownloadSeasonHandler implements HandlerInterface
); );
} }
private function getDownloadedEpisodes(string $title) private function createDownload(DownloadSeasonCommand $command, string $url, string $title, string $filename, int $episodeNumber): Download
{ {
// Check current episodes $download = new Download();
$downloadedEpisodes = $this->mediaFiles $download->setUrl($url);
->getEpisodes($title) $download->setTitle($title);
->map(fn($episode) => (object) (new PTN())->parse($episode)) $download->setFilename($filename);
->filter(fn ($episode) => $download->setImdbId($command->imdbId);
property_exists($episode, 'episode') $download->setMediaType(MediaType::TvShow->value);
&& property_exists($episode, 'season') $download->setEpisodeId($this->getEpisodeNumber($command->season, $episodeNumber));
&& null !== $episode->episodeNumber $download->setUser($this->userRepository->find($command->userId));
&& null !== $episode->season $this->downloadRepository->getEntityManager()->persist($download);
) $this->downloadRepository->getEntityManager()->flush();
->rekey(fn($episode) => $episode->episodeNumber); return $download;
$this->logger->info('> [MonitorTvSeasonHandler] Found ' . count($downloadedEpisodes) . ' downloaded episodes for title: ' . $monitor->getTitle()); }
private function getEpisodeNumber(int $season, int $episode): string
{
return sprintf(
"S%sE%s",
str_pad($season, 2, "0", STR_PAD_LEFT),
str_pad($episode, 2, "0", STR_PAD_LEFT)
);
} }
} }

View File

@@ -89,6 +89,7 @@ class DownloadOptionEvaluator
{ {
$badFileLocations = [ $badFileLocations = [
'https://torrentio.strem.fun/videos/failed_infringement_v2.mp4' => 'Removed for Copyright Infringement.', 'https://torrentio.strem.fun/videos/failed_infringement_v2.mp4' => 'Removed for Copyright Infringement.',
'https://torrentio.strem.fun/videos/downloading_v2.mp4' => 'Your torrent is downloading to your debrid provider.'
]; ];
$headers = get_headers($downloadUrl, true); $headers = get_headers($downloadUrl, true);

View File

@@ -2,15 +2,14 @@
{% block body %} {% block body %}
<h2 class="px-4 py-4 text-3xl font-extrabold text-orange-500">500</h2> <h2 class="px-4 py-4 text-3xl font-extrabold text-orange-500">500</h2>
<div class="flex flex-col bg-orange-500/50 p-4 rounded-lg gap-4 w-full md:w-[420px] border-orange-500 border-2 text-gray-50 animate-fade"> <div class="flex flex-col bg-orange-500/50 p-4 rounded-lg gap-4 w-full md:w-[540px] border-orange-500 border-2 text-gray-50 animate-fade">
<div class="flex flex-col m-0 text-center"> <div class="flex flex-col m-0 text-center">
<h3 class="text-2xl text-bold text-center text-gray-50">Oh crap!</h3> <h3 class="text-2xl text-bold text-center text-gray-50">Oh crap!</h3>
</div> </div>
<p class="mb-2">There are many things I'm capable of, but this ain't one of 'em!</p> <p class="mb-2">There are many things I'm capable of, but this ain't one of 'em!</p>
<pre class="bg-gray-800 text-white p-4 rounded-md overflow-x-auto"> <p class="text-sm mb-1">
<code class="language-plaintext"> <code>{{ exception.file }}</code>
{{ exception.message }} </p>
</code> <pre class="bg-gray-800 text-white p-4 rounded-md overflow-x-auto"><code class="language-plaintext">{{ exception.message|trim }}</code></pre>
</pre>
</div> </div>
{% endblock %} {% endblock %}