fix: missing imdb id on torrentio results
This commit is contained in:
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Base\Framework\Controller;
|
namespace App\Base\Framework\Controller;
|
||||||
|
|
||||||
|
use App\Monitor\Action\Command\MonitorTvShowCommand;
|
||||||
use App\Monitor\Action\Handler\MonitorTvShowHandler;
|
use App\Monitor\Action\Handler\MonitorTvShowHandler;
|
||||||
use App\Tmdb\TmdbClient;
|
use App\Tmdb\TmdbClient;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Mailer\MailerInterface;
|
use Symfony\Component\Mailer\MailerInterface;
|
||||||
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Mime\Email;
|
use Symfony\Component\Mime\Email;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
@@ -46,8 +48,9 @@ final class IndexController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/test')]
|
#[Route('/test')]
|
||||||
public function monitorTvShow(): Response
|
public function monitorTvShow(MonitorTvShowHandler $handler): Response
|
||||||
{
|
{
|
||||||
|
// $handler->handle(new MonitorTvShowCommand(82));
|
||||||
return $this->render('index/test.html.twig', []);
|
return $this->render('index/test.html.twig', []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Torrentio
|
|||||||
$results = $this->client->get($imdbCode, $cacheTags);
|
$results = $this->client->get($imdbCode, $cacheTags);
|
||||||
|
|
||||||
if (true === $parseResults) {
|
if (true === $parseResults) {
|
||||||
return $this->parse($results);
|
return $this->parse($results, $imdbCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
@@ -33,13 +33,13 @@ class Torrentio
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (true === $parseResults) {
|
if (true === $parseResults) {
|
||||||
return $this->parse($results);
|
return $this->parse($results, $imdbId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parse(array $data): array
|
public function parse(array $data, string $imdbId): array
|
||||||
{
|
{
|
||||||
$results = [];
|
$results = [];
|
||||||
foreach ($data['streams'] as $stream) {
|
foreach ($data['streams'] as $stream) {
|
||||||
@@ -59,7 +59,8 @@ class Torrentio
|
|||||||
$result = ResultFactory::map(
|
$result = ResultFactory::map(
|
||||||
$stream['url'],
|
$stream['url'],
|
||||||
$stream['title'],
|
$stream['title'],
|
||||||
$bingeGroup
|
$bingeGroup,
|
||||||
|
$imdbId
|
||||||
);
|
);
|
||||||
|
|
||||||
$results[] = $result;
|
$results[] = $result;
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ class ResultFactory
|
|||||||
public static function map(
|
public static function map(
|
||||||
string $url,
|
string $url,
|
||||||
string $title,
|
string $title,
|
||||||
string $bingeGroup = "-"
|
string $bingeGroup = "-",
|
||||||
|
string $imdbId = "-",
|
||||||
) {
|
) {
|
||||||
$ptn = (object) (new PTN())->parse($title);
|
$ptn = (object) (new PTN())->parse($title);
|
||||||
return new TorrentioResult(
|
return new TorrentioResult(
|
||||||
@@ -40,7 +41,8 @@ class ResultFactory
|
|||||||
self::setLanguages($title),
|
self::setLanguages($title),
|
||||||
self::setLanguageFlags($title),
|
self::setLanguageFlags($title),
|
||||||
false,
|
false,
|
||||||
uniqid()
|
uniqid(),
|
||||||
|
$imdbId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class TorrentioResult
|
|||||||
public ?array $languages = [],
|
public ?array $languages = [],
|
||||||
public ?string $languageFlags = "-",
|
public ?string $languageFlags = "-",
|
||||||
public ?bool $selected = false,
|
public ?bool $selected = false,
|
||||||
public ?string $localId = "-"
|
public ?string $localId = "-",
|
||||||
|
public ?string $imdbId = "-",
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
provider="{{ result.provider }}"
|
provider="{{ result.provider }}"
|
||||||
languages="{{ result.languages|json_encode }}"
|
languages="{{ result.languages|json_encode }}"
|
||||||
media-type="{{ results.media.mediaType }}"
|
media-type="{{ results.media.mediaType }}"
|
||||||
imdb-id="{{ results.media.imdbId }}"
|
imdb-id="{{ result.imdbId }}"
|
||||||
filename="{{ result.filename }}"
|
filename="{{ result.filename }}"
|
||||||
data-local-id="{{ result.localId }}"
|
data-local-id="{{ result.localId }}"
|
||||||
{% if "tvshows" == results.media.mediaType %}
|
{% if "tvshows" == results.media.mediaType %}
|
||||||
|
|||||||
Reference in New Issue
Block a user