Compare commits
5 Commits
dev-dl-lis
...
v0.16.6
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bfd92a011 | |||
| ac6276f444 | |||
| 6d4bbf2e72 | |||
| 8004de1dc8 | |||
| 2d9a2a1f14 |
@@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
frankenphp {
|
frankenphp {
|
||||||
{$FRANKENPHP_CONFIG}
|
{$FRANKENPHP_CONFIG}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,12 @@ final class SearchController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/result/{mediaType}/{tmdbId}', name: 'app_search_result')]
|
#[Route('/result/{mediaType}/{imdbId}', name: 'app_search_result')]
|
||||||
public function result(
|
public function result(
|
||||||
GetMediaInfoInput $input,
|
GetMediaInfoInput $input,
|
||||||
): Response {
|
): Response {
|
||||||
$result = $this->getMediaInfoHandler->handle($input->toCommand());
|
$result = $this->getMediaInfoHandler->handle($input->toCommand());
|
||||||
|
|
||||||
$this->warmDownloadOptionCache($result->media);
|
$this->warmDownloadOptionCache($result->media);
|
||||||
|
|
||||||
return $this->render('search/result.html.twig', [
|
return $this->render('search/result.html.twig', [
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
namespace App\Download\Framework\Entity;
|
namespace App\Download\Framework\Entity;
|
||||||
|
|
||||||
use App\Download\Framework\Repository\DownloadRepository;
|
use App\Download\Framework\Repository\DownloadRepository;
|
||||||
|
use App\Torrentio\Result\ResultFactory;
|
||||||
|
use App\Torrentio\Result\TorrentioResult;
|
||||||
use App\User\Framework\Entity\User;
|
use App\User\Framework\Entity\User;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Nihilarr\PTN;
|
||||||
use Symfony\UX\Turbo\Attribute\Broadcast;
|
use Symfony\UX\Turbo\Attribute\Broadcast;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: DownloadRepository::class)]
|
#[ORM\Entity(repositoryClass: DownloadRepository::class)]
|
||||||
@@ -162,4 +165,16 @@ class Download
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPtn(): object
|
||||||
|
{
|
||||||
|
$ptn = (object) (new PTN())->parse($this->filename);
|
||||||
|
|
||||||
|
if ($this->mediaType === "tvshows") {
|
||||||
|
$ptn->season = str_pad($ptn->season, 2, "0", STR_PAD_LEFT);
|
||||||
|
$ptn->episode = str_pad($ptn->episode, 2, "0", STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ptn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use OneToMany\RichBundle\Contract\CommandInterface;
|
|||||||
class GetMediaInfoCommand implements CommandInterface
|
class GetMediaInfoCommand implements CommandInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $tmdbId,
|
public string $imdbId,
|
||||||
public string $mediaType,
|
public string $mediaType,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ class GetMediaInfoHandler implements HandlerInterface
|
|||||||
|
|
||||||
public function handle(CommandInterface $command): ResultInterface
|
public function handle(CommandInterface $command): ResultInterface
|
||||||
{
|
{
|
||||||
$media = $this->tmdb->mediaDetails($command->tmdbId, $command->mediaType);
|
$media = $this->tmdb->mediaDetails($command->imdbId, $command->mediaType);
|
||||||
|
|
||||||
return new GetMediaInfoResult($media);
|
return new GetMediaInfoResult($media);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ use OneToMany\RichBundle\Contract\InputInterface;
|
|||||||
class GetMediaInfoInput implements InputInterface
|
class GetMediaInfoInput implements InputInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[SourceRoute('tmdbId')]
|
#[SourceRoute('imdbId')]
|
||||||
public string $tmdbId,
|
public string $imdbId,
|
||||||
|
|
||||||
#[SourceRoute('mediaType')]
|
#[SourceRoute('mediaType')]
|
||||||
public string $mediaType,
|
public string $mediaType,
|
||||||
@@ -21,6 +21,6 @@ class GetMediaInfoInput implements InputInterface
|
|||||||
|
|
||||||
public function toCommand(): CommandInterface
|
public function toCommand(): CommandInterface
|
||||||
{
|
{
|
||||||
return new GetMediaInfoCommand($this->tmdbId, $this->mediaType);
|
return new GetMediaInfoCommand($this->imdbId, $this->mediaType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,9 +133,12 @@ class Tmdb
|
|||||||
if (!$result instanceof Movie && !$result instanceof Tv) {
|
if (!$result instanceof Movie && !$result instanceof Tv) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$results[] = $this->parseResult($result);
|
$results[] = $this->parseResult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$results = array_filter($results, fn ($result) => null !== $result->imdbId);
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +146,16 @@ class Tmdb
|
|||||||
{
|
{
|
||||||
$finder = new Find($this->client);
|
$finder = new Find($this->client);
|
||||||
$result = $finder->findBy($id, ['external_source' => 'imdb_id']);
|
$result = $finder->findBy($id, ['external_source' => 'imdb_id']);
|
||||||
return $this->parseResult($result);
|
|
||||||
|
if (count($result['movie_results']) > 0) {
|
||||||
|
return $result['movie_results'][0]['id'];
|
||||||
|
} elseif (count($result['tv_results']) > 0) {
|
||||||
|
return $result['tv_results'][0]['id'];
|
||||||
|
} elseif (count($result['tv_episode_results']) > 0) {
|
||||||
|
return $result['tv_episode_results'][0]['show_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception("No results found for $id");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function movieDetails(string $id)
|
public function movieDetails(string $id)
|
||||||
@@ -183,6 +195,8 @@ class Tmdb
|
|||||||
|
|
||||||
public function mediaDetails(string $id, string $type)
|
public function mediaDetails(string $id, string $type)
|
||||||
{
|
{
|
||||||
|
$id = $this->find($id);
|
||||||
|
|
||||||
if ($type === "movies") {
|
if ($type === "movies") {
|
||||||
return $this->movieDetails($id);
|
return $this->movieDetails($id);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class GetMovieOptionsHandler implements HandlerInterface
|
|||||||
public function handle(CommandInterface $command): ResultInterface
|
public function handle(CommandInterface $command): ResultInterface
|
||||||
{
|
{
|
||||||
return new GetMovieOptionsResult(
|
return new GetMovieOptionsResult(
|
||||||
media: $this->tmdb->mediaDetails($command->tmdbId, 'movies'),
|
media: $this->tmdb->mediaDetails($command->imdbId, 'movies'),
|
||||||
results: $this->torrentio->search($command->imdbId, 'movies'),
|
results: $this->torrentio->search($command->imdbId, 'movies'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
<tr{{ attributes }} id="ad_download_{{ download.id }}">
|
<tr{{ attributes }} id="ad_download_{{ download.id }}">
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 truncate">
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 truncate">
|
||||||
{{ download.title }}
|
<a href="{{ path('app_search_result', {imdbId: download.imdbId, mediaType: download.mediaType}) }}"
|
||||||
|
class="hover:underline mr-1"
|
||||||
|
>
|
||||||
|
{{ download.title }}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
{% if download.mediaType == "tvshows" %}
|
||||||
|
— <span class="ml-1">(S{{ download.ptn.season }}E{{ download.ptn.episode }})</span>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{% if isWidget == false %}
|
{% if isWidget == false %}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<div{{ attributes }}>
|
<div{{ attributes }}>
|
||||||
<a href="{{ path('app_search_result', {
|
<a href="{{ path('app_search_result', {
|
||||||
mediaType: mediaType,
|
mediaType: mediaType,
|
||||||
tmdbId: tmdbId
|
imdbId: imdbId
|
||||||
}) }}">
|
}) }}">
|
||||||
<img src="{{ image }}" class="w-40 rounded-md" />
|
<img src="{{ image }}" class="w-40 rounded-md" />
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ path('app_search_result', {
|
<a href="{{ path('app_search_result', {
|
||||||
mediaType: mediaType,
|
mediaType: mediaType,
|
||||||
tmdbId: tmdbId
|
imdbId: imdbId
|
||||||
}) }}">
|
}) }}">
|
||||||
<h3 class="text-center text-gray-50 max-w-[16ch] text-extrabold">{{ title }}</h3>
|
<h3 class="text-center text-gray-50 max-w-[16ch] text-extrabold">{{ title }}</h3>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<a class="h-9 rounded-md py-1 px-2 bg-green-600 text-gray-50"
|
<a class="h-9 rounded-md py-1 px-2 bg-green-600 text-gray-50"
|
||||||
href="{{ path('app_search_result', {mediaType: mediaType, tmdbId: tmdbId}) }}"
|
href="{{ path('app_search_result', {mediaType: mediaType, imdbId: imdbId}) }}"
|
||||||
>choose</a>
|
>choose</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<twig:Card title="Popular Movies" contentClass="flex flex-row justify-between w-full">
|
<twig:Card title="Popular Movies" contentClass="flex flex-row justify-between w-full">
|
||||||
{% for movie in popular_movies %}
|
{% for movie in popular_movies %}
|
||||||
<twig:Poster imdbId=""
|
<twig:Poster imdbId="{{ movie.imdbId }}"
|
||||||
tmdbId="{{ movie.tmdbId }}"
|
tmdbId="{{ movie.tmdbId }}"
|
||||||
title="{{ movie.title }}"
|
title="{{ movie.title }}"
|
||||||
description="{{ movie.description }}"
|
description="{{ movie.description }}"
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
</twig:Card>
|
</twig:Card>
|
||||||
<twig:Card title="Popular TV Shows" contentClass="flex flex-row justify-between w-full">
|
<twig:Card title="Popular TV Shows" contentClass="flex flex-row justify-between w-full">
|
||||||
{% for movie in popular_tvshows %}
|
{% for movie in popular_tvshows %}
|
||||||
<twig:Poster imdbId=""
|
<twig:Poster imdbId="{{ movie.imdbId }}"
|
||||||
tmdbId="{{ movie.tmdbId }}"
|
tmdbId="{{ movie.tmdbId }}"
|
||||||
title="{{ movie.title }}"
|
title="{{ movie.title }}"
|
||||||
description="{{ movie.description }}"
|
description="{{ movie.description }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user