Compare commits
7 Commits
v0.31.5
...
dev-torren
| Author | SHA1 | Date | |
|---|---|---|---|
| f9ddd70668 | |||
| 33bfe40b11 | |||
| f3a2f35571 | |||
| 9eef567974 | |||
| 070723581a | |||
| f3a5c2012e | |||
| 5581a82554 |
@@ -168,6 +168,7 @@ dialog[data-dialog-target="dialog"][closing] {
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form[name="torrentio_preferences_form"],
|
||||||
#filter {
|
#filter {
|
||||||
.ts-wrapper {
|
.ts-wrapper {
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ security:
|
|||||||
# Easy way to control access for large sections of your site
|
# Easy way to control access for large sections of your site
|
||||||
# Note: Only the *first* access control that matches will be used
|
# Note: Only the *first* access control that matches will be used
|
||||||
access_control:
|
access_control:
|
||||||
- { path: ^/monitors/ical.ics, roles: PUBLIC_ACCESS }
|
- { path: ^/monitors/ical/, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/reset-password, roles: PUBLIC_ACCESS }
|
- { path: ^/reset-password, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/getting-started, roles: PUBLIC_ACCESS }
|
- { path: ^/getting-started, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/register, roles: PUBLIC_ACCESS }
|
- { path: ^/register, roles: PUBLIC_ACCESS }
|
||||||
|
|||||||
@@ -1,20 +1,6 @@
|
|||||||
FROM dunglas/frankenphp:php8.4-alpine
|
ARG APP_VERSION
|
||||||
|
|
||||||
ENV SERVER_NAME=":80"
|
FROM code.caldwell.digital/torsearch/torsearch-app:${APP_VERSION}
|
||||||
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
|
||||||
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
|
||||||
|
|
||||||
ARG APP_VERSION="0.dev"
|
|
||||||
ENV APP_VERSION="${APP_VERSION}"
|
|
||||||
|
|
||||||
RUN install-php-extensions \
|
|
||||||
pdo_mysql \
|
|
||||||
gd \
|
|
||||||
intl \
|
|
||||||
zip \
|
|
||||||
opcache
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
|
|
||||||
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "scheduler_monitor" ]
|
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "scheduler_monitor" ]
|
||||||
|
|
||||||
|
|||||||
47
migrations/Version20250831013403.php
Normal file
47
migrations/Version20250831013403.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250831013403 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
DROP TABLE sessions
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE download CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE user_preference CHANGE preference_value preference_value VARCHAR(1024) DEFAULT NULL
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
CREATE TABLE sessions (sess_id VARBINARY(128) NOT NULL, sess_data LONGBLOB NOT NULL, sess_lifetime INT UNSIGNED NOT NULL, sess_time INT UNSIGNED NOT NULL, INDEX sess_lifetime_idx (sess_lifetime), PRIMARY KEY(sess_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_bin` ENGINE = InnoDB COMMENT = ''
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE download CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE user_preference CHANGE preference_value preference_value VARCHAR(255) DEFAULT NULL
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -4,7 +4,6 @@ namespace App\Base\Framework\Command;
|
|||||||
|
|
||||||
use App\User\Framework\Entity\Preference;
|
use App\User\Framework\Entity\Preference;
|
||||||
use App\User\Framework\Entity\UserPreference;
|
use App\User\Framework\Entity\UserPreference;
|
||||||
use App\User\Framework\Repository\PreferenceOptionRepository;
|
|
||||||
use App\User\Framework\Repository\PreferencesRepository;
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
use App\User\Framework\Repository\UserRepository;
|
use App\User\Framework\Repository\UserRepository;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
@@ -139,9 +138,16 @@ class SeedDatabaseCommand extends Command
|
|||||||
'id' => 'enable_ical_up_ep',
|
'id' => 'enable_ical_up_ep',
|
||||||
'name' => 'Enable a publicly available iCal calendar?',
|
'name' => 'Enable a publicly available iCal calendar?',
|
||||||
'description' => 'Enable a publicly accessible iCal URL for your upcoming episodes.',
|
'description' => 'Enable a publicly accessible iCal URL for your upcoming episodes.',
|
||||||
'enabled' => false,
|
'enabled' => true,
|
||||||
'type' => 'calendar'
|
'type' => 'calendar'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'id' => 'torrentio_url',
|
||||||
|
'name' => 'A custom Torrentio URL',
|
||||||
|
'description' => 'If you want to use a custom Torrentio URL, enter it here. Otherwise, leave it blank to use the one provided as an environment variable.',
|
||||||
|
'enabled' => true,
|
||||||
|
'type' => 'torrentio'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class CalendarController extends AbstractController
|
|||||||
|
|
||||||
return new Response($calendar->get(), 200, [
|
return new Response($calendar->get(), 200, [
|
||||||
'Content-Type' => 'text/calendar',
|
'Content-Type' => 'text/calendar',
|
||||||
'Content-Disposition' => 'attachment; filename="upcoming-episodes.ics"',
|
'Content-Disposition' => 'inline; filename="upcoming-episodes.ics"',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ class GetMediaInfoHandler implements HandlerInterface
|
|||||||
public function handle(CommandInterface $command): ResultInterface
|
public function handle(CommandInterface $command): ResultInterface
|
||||||
{
|
{
|
||||||
$media = $this->tmdb->mediaDetails($command->imdbId, $command->mediaType);
|
$media = $this->tmdb->mediaDetails($command->imdbId, $command->mediaType);
|
||||||
|
$relatedMedia = $this->tmdb->relatedMedia($media->tmdbId, $command->mediaType);
|
||||||
|
|
||||||
return new GetMediaInfoResult($media, $command->season, $command->episode);
|
return new GetMediaInfoResult($media, $relatedMedia, $command->season, $command->episode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class GetMediaInfoResult implements ResultInterface
|
|||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public TmdbResult $media,
|
public TmdbResult $media,
|
||||||
|
public array $relatedMedia,
|
||||||
public ?int $season,
|
public ?int $season,
|
||||||
public ?int $episode,
|
public ?int $episode,
|
||||||
) {}
|
) {}
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ use App\Search\Action\Handler\SearchHandler;
|
|||||||
use App\Search\Action\Input\GetMediaInfoInput;
|
use App\Search\Action\Input\GetMediaInfoInput;
|
||||||
use App\Search\Action\Input\SearchInput;
|
use App\Search\Action\Input\SearchInput;
|
||||||
use App\Search\Action\Result\RedirectToMediaResult;
|
use App\Search\Action\Result\RedirectToMediaResult;
|
||||||
use App\Tmdb\TmdbResult;
|
|
||||||
use App\Torrentio\Action\Command\GetMovieOptionsCommand;
|
|
||||||
use App\Torrentio\Action\Command\GetTvShowOptionsCommand;
|
|
||||||
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;
|
||||||
|
|||||||
@@ -247,6 +247,21 @@ class Tmdb
|
|||||||
return $series;
|
return $series;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function relatedMedia(string $tmdbId, string $mediaType, int $maxResults = 6)
|
||||||
|
{
|
||||||
|
$repos = [
|
||||||
|
'movies' => $this->movieRepository,
|
||||||
|
'tvshows' => $this->tvRepository,
|
||||||
|
];
|
||||||
|
|
||||||
|
$results = $repos[$mediaType]->getRecommendations($tmdbId);
|
||||||
|
return Map::from(array_values($results->toArray()))
|
||||||
|
->slice(0, 6)
|
||||||
|
->map(function ($result) use ($mediaType) {
|
||||||
|
return $this->parseResult($result, $mediaType);
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
public function mediaDetails(string $id, string $type)
|
public function mediaDetails(string $id, string $type)
|
||||||
{
|
{
|
||||||
$id = $this->find($id);
|
$id = $this->find($id);
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ use Carbon\Carbon;
|
|||||||
use App\Torrentio\Exception\TorrentioRateLimitException;
|
use App\Torrentio\Exception\TorrentioRateLimitException;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||||
use Symfony\Contracts\Cache\ItemInterface;
|
use Symfony\Contracts\Cache\ItemInterface;
|
||||||
use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
||||||
|
|
||||||
class Torrentio
|
class Torrentio
|
||||||
{
|
{
|
||||||
private string $baseUrl = 'https://torrentio.strem.fun/providers%253Dyts%252Ceztv%252Crarbg%252C1337x%252Cthepiratebay%252Ckickasstorrents%252Ctorrentgalaxy%252Cmagnetdl%252Chorriblesubs%252Cnyaasi%7Csort%253Dqualitysize%7Cqualityfilter%253D480p%252Cscr%252Ccam%7Crealdebrid={realDebridKey}/stream/movie';
|
private string $baseUrl = 'https://torrentio.strem.fun/realdebrid={realDebridKey}/stream/movie';
|
||||||
|
|
||||||
private string $searchUrl;
|
private string $searchUrl;
|
||||||
|
|
||||||
@@ -25,8 +26,15 @@ class Torrentio
|
|||||||
#[Autowire(env: 'REAL_DEBRID_KEY')] private string $realDebridKey,
|
#[Autowire(env: 'REAL_DEBRID_KEY')] private string $realDebridKey,
|
||||||
private TagAwareCacheInterface $cache,
|
private TagAwareCacheInterface $cache,
|
||||||
private LoggerInterface $logger,
|
private LoggerInterface $logger,
|
||||||
|
private Security $security,
|
||||||
) {
|
) {
|
||||||
$this->searchUrl = str_replace('{realDebridKey}', $this->realDebridKey, $this->baseUrl);
|
// $this->searchUrl = str_replace('{realDebridKey}', $this->realDebridKey, $this->baseUrl);
|
||||||
|
$user = $this->security->getUser();
|
||||||
|
$this->searchUrl = $user->getUserPreference('torrentio_url')->getPreferenceValue() . '/stream/movie';
|
||||||
|
|
||||||
|
// dd($this->searchUrl);
|
||||||
|
|
||||||
|
|
||||||
$this->client = new Client([
|
$this->client = new Client([
|
||||||
'base_uri' => $this->searchUrl,
|
'base_uri' => $this->searchUrl,
|
||||||
]);
|
]);
|
||||||
@@ -36,25 +44,26 @@ class Torrentio
|
|||||||
{
|
{
|
||||||
$cacheKey = "torrentio.{$imdbCode}";
|
$cacheKey = "torrentio.{$imdbCode}";
|
||||||
|
|
||||||
$results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode, $type) {
|
// $results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode, $type) {
|
||||||
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
// $item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
||||||
$item->tag(['torrentio', $type, $imdbCode]);
|
// $item->tag(['torrentio', $type, $imdbCode]);
|
||||||
try {
|
try {
|
||||||
$response = $this->client->get("$this->searchUrl/$imdbCode.json");
|
$response = $this->client->get("$this->searchUrl/$imdbCode.json");
|
||||||
return json_decode(
|
$results = json_decode(
|
||||||
$response->getBody()->getContents(),
|
$response->getBody()->getContents(),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
// dd($results);
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
if ($exception->getCode() === 429) {
|
if ($exception->getCode() === 429) {
|
||||||
$this->logger->warning("> [TorrentioClient] Rate limit exceeded");
|
$this->logger->warning("> [TorrentioClient] Rate limit exceeded");
|
||||||
return null;
|
throw $exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->error("> [TorrentioClient] Request error: " . $response->getStatusCode() . " - " . $response->getBody()->getContents());
|
$this->logger->error("> [TorrentioClient] Request error: " . $response->getStatusCode() . " - " . $response->getBody()->getContents());
|
||||||
return [];
|
// return [];
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (true === $parseResults) {
|
if (true === $parseResults) {
|
||||||
return $this->parse($results);
|
return $this->parse($results);
|
||||||
@@ -65,26 +74,26 @@ class Torrentio
|
|||||||
|
|
||||||
public function fetchEpisodeResults(string $imdbId, int $season, int $episode, bool $parseResults = true): array
|
public function fetchEpisodeResults(string $imdbId, int $season, int $episode, bool $parseResults = true): array
|
||||||
{
|
{
|
||||||
$cacheKey = "torrentio.$imdbId.$season.$episode";
|
// $cacheKey = "torrentio.$imdbId.$season.$episode";
|
||||||
$results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbId, $season, $episode) {
|
// $results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbId, $season, $episode) {
|
||||||
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
// $item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
||||||
$item->tag(['torrentio', 'tvshows', 'torrentio.tvshows', $imdbId, "torrentio.$imdbId", "$imdbId.$season", "torrentio.$imdbId.$season", "$imdbId.$season.$episode", "torrentio.$imdbId.$season.$episode"]);
|
// $item->tag(['torrentio', 'tvshows', 'torrentio.tvshows', $imdbId, "torrentio.$imdbId", "$imdbId.$season", "torrentio.$imdbId.$season", "$imdbId.$season.$episode", "torrentio.$imdbId.$season.$episode"]);
|
||||||
try {
|
try {
|
||||||
$response = $this->client->get("$this->searchUrl/$imdbId:$season:$episode.json");
|
$response = $this->client->get("$this->searchUrl/$imdbId:$season:$episode.json");
|
||||||
return json_decode(
|
$results = json_decode(
|
||||||
$response->getBody()->getContents(),
|
$response->getBody()->getContents(),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
if ($exception->getCode() === 429) {
|
if ($exception->getCode() === 429) {
|
||||||
$this->logger->warning("> [TorrentioClient] Rate limit exceeded");
|
$this->logger->warning("> [TorrentioClient] Rate limit exceeded");
|
||||||
return null;
|
throw $exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->error("> [TorrentioClient] Request error: " . $response->getStatusCode() . " - " . $response->getBody()->getContents());
|
$this->logger->error("> [TorrentioClient] Request error: " . $response->getStatusCode() . " - " . $response->getBody()->getContents());
|
||||||
return [];
|
// return [];
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (null === $results) {
|
if (null === $results) {
|
||||||
throw new TorrentioRateLimitException();
|
throw new TorrentioRateLimitException();
|
||||||
|
|||||||
50
src/Torrentio/Client/TorrentioUrl.php
Normal file
50
src/Torrentio/Client/TorrentioUrl.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Torrentio\Client;
|
||||||
|
|
||||||
|
use App\Values\TorrentioDebridProviderChoices;
|
||||||
|
|
||||||
|
class TorrentioUrl
|
||||||
|
{
|
||||||
|
const BASE_URL = "https://torrentio.strem.fun/";
|
||||||
|
|
||||||
|
public ?array $providers = null;
|
||||||
|
public ?array $language = null;
|
||||||
|
public ?array $qualityfilter = null;
|
||||||
|
public ?string $sorting = null;
|
||||||
|
public ?string $debridProvider = null;
|
||||||
|
public ?string $limit = null;
|
||||||
|
public ?string $sizefilter = null;
|
||||||
|
public ?string $debridToken = null;
|
||||||
|
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
$result = "";
|
||||||
|
if (null !== $this->debridProvider && null !== $this->debridToken) {
|
||||||
|
$result .= "$this->debridProvider=$this->debridToken";
|
||||||
|
}
|
||||||
|
|
||||||
|
return static::BASE_URL . $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromString(string $url): self
|
||||||
|
{
|
||||||
|
$arrayData = ['providers', 'language', 'qualityfilter'];
|
||||||
|
$data = explode('|', str_replace('/', '', urldecode(urldecode(parse_url($url)['path']))));
|
||||||
|
|
||||||
|
$result = new self();
|
||||||
|
foreach ($data as $item) {$item = explode('=', $item);
|
||||||
|
if (count($item) !== 2) continue;
|
||||||
|
if (in_array($item[0], array_keys(TorrentioDebridProviderChoices::$providers))) {
|
||||||
|
$result->debridProvider = $item[0];
|
||||||
|
$result->debridToken = $item[1];
|
||||||
|
} elseif (in_array($item[0], $arrayData)) {
|
||||||
|
$result->{$item[0]} = explode(',', $item[1]);
|
||||||
|
} else {
|
||||||
|
$result->{$item[0]} = $item[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
99
src/Torrentio/Framework/Form/TorrentioPreferencesForm.php
Normal file
99
src/Torrentio/Framework/Form/TorrentioPreferencesForm.php
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Torrentio\Framework\Form;
|
||||||
|
|
||||||
|
use Aimeos\Map;
|
||||||
|
use App\User\Database\ProviderList;
|
||||||
|
use App\Values\TorrentioDebridProviderChoices;
|
||||||
|
use App\Values\TorrentioExcludeQualityChoices;
|
||||||
|
use App\Values\TorrentioLanguageChoices;
|
||||||
|
use App\Values\TorrentioProviderChoices;
|
||||||
|
use App\Values\TorrentioSortChoices;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
|
class TorrentioPreferencesForm extends AbstractType
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly UrlGeneratorInterface $urlGenerator,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$this->addChoiceField($builder, 'providers', TorrentioProviderChoices::asSelectOptions());
|
||||||
|
$this->addChoiceField($builder, 'sorting', TorrentioSortChoices::asSelectOptions(), 1);
|
||||||
|
$this->addChoiceField($builder, 'language', TorrentioLanguageChoices::asSelectOptions());
|
||||||
|
$this->addChoiceField($builder, 'qualityfilter', TorrentioExcludeQualityChoices::asSelectOptions());
|
||||||
|
$this->addTextField($builder, 'limit');
|
||||||
|
$this->addTextField($builder, 'sizefilter');
|
||||||
|
$this->addChoiceField($builder, 'debridProvider', TorrentioDebridProviderChoices::asSelectOptions(), 1);
|
||||||
|
$this->addTextField($builder, 'debridToken');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function addChoiceField(FormBuilderInterface $builder, string $fieldName, array $choices, ?int $maxItems = null): void
|
||||||
|
{
|
||||||
|
$question = [
|
||||||
|
'attr' => [
|
||||||
|
'class' => 'min-w-24 text-input mb-4',
|
||||||
|
],
|
||||||
|
'row_attr' => [
|
||||||
|
'class' => 'filter-label text-white'
|
||||||
|
],
|
||||||
|
'label_attr' => ['class' => 'block font-semibold mb-2'],
|
||||||
|
'choices' => $choices,
|
||||||
|
'required' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (null === $maxItems) {
|
||||||
|
$question['multiple'] = true;
|
||||||
|
$question['attr'] += [
|
||||||
|
'data-result-filter-target' => $fieldName,
|
||||||
|
'data-controller' => 'symfony--ux-autocomplete--autocomplete',
|
||||||
|
'data-symfony--ux-autocomplete--autocomplete-tom-select-options-value' => json_encode([
|
||||||
|
'highlight' => false,
|
||||||
|
'maxItems' => $maxItems,
|
||||||
|
]),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$question += [
|
||||||
|
'multiple' => false,
|
||||||
|
'expanded' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder->add($fieldName, ChoiceType::class, $question);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addTextField(FormBuilderInterface $builder, string $fieldName, ?array $options = null): void
|
||||||
|
{
|
||||||
|
$optinos = $options ?? [
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
'method' => 'post',
|
||||||
|
'action' => $this->urlGenerator->generate('app.torrentio-preferences.save'),
|
||||||
|
'class' => 'min-w-24 text-input mb-4 block',
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$builder->add(
|
||||||
|
$fieldName,
|
||||||
|
TextType::class,
|
||||||
|
$optinos,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'id' => 'torrentio-preferences-form',
|
||||||
|
// 'action' => $this->urlGenerator->generate('app_user_media_preferences_submit'),
|
||||||
|
'attr' => [
|
||||||
|
'class' => 'filter-items w-full p-4 text-md dark:text-gray-50 rounded-lg',
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Command;
|
||||||
|
|
||||||
|
use App\Torrentio\Client\TorrentioUrl;
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||||
|
|
||||||
|
/** @implements CommandInterface<SaveUserMediaPreferencesCommand> */
|
||||||
|
class SaveUserTorrentioPreferencesCommand implements CommandInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public TorrentioUrl $torrentioUrl,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Handler;
|
||||||
|
|
||||||
|
use App\User\Action\Command\SaveUserMediaPreferencesCommand;
|
||||||
|
use App\User\Action\Result\SaveUserDownloadPreferencesResult;
|
||||||
|
use App\User\Action\Result\SaveUserMediaPreferencesResult;
|
||||||
|
use App\User\Framework\Entity\User;
|
||||||
|
use App\User\Framework\Entity\UserPreference;
|
||||||
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface as C;
|
||||||
|
use OneToMany\RichBundle\Contract\HandlerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\ResultInterface as R;
|
||||||
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
|
|
||||||
|
/** @implements HandlerInterface<SaveUserMediaPreferencesCommand> */
|
||||||
|
class SaveUserTorrentioPreferencesHandler implements HandlerInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly EntityManagerInterface $entityManager,
|
||||||
|
private readonly PreferencesRepository $preferenceRepository,
|
||||||
|
private readonly Security $token,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function handle(C $command): R
|
||||||
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = $this->token->getUser();
|
||||||
|
|
||||||
|
if ($user->hasUserPreference('torrentio_url')) {
|
||||||
|
$user->updateUserPreference('torrentio_url', (string) $command->torrentioUrl);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
} else {
|
||||||
|
$preference = $this->preferenceRepository->find('torrentio_url');
|
||||||
|
$user->addUserPreference(
|
||||||
|
(new UserPreference())
|
||||||
|
->setUser($user)
|
||||||
|
->setPreference($preference)
|
||||||
|
->setPreferenceValue((string) $command->torrentioUrl)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
return new SaveUserDownloadPreferencesResult($user->getDownloadPreferences());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,20 +5,31 @@ namespace App\User\Database;
|
|||||||
class ProviderList
|
class ProviderList
|
||||||
{
|
{
|
||||||
public static $providers = [
|
public static $providers = [
|
||||||
'1337x',
|
'YTS',
|
||||||
'Comando',
|
|
||||||
'EZTV',
|
'EZTV',
|
||||||
'ilCorSaRoNeRo',
|
|
||||||
'MagnetDL',
|
|
||||||
'MejorTorrent',
|
|
||||||
'RARBG',
|
'RARBG',
|
||||||
'Rutor',
|
'1337x',
|
||||||
'Rutracker',
|
|
||||||
'ThePirateBay',
|
'ThePirateBay',
|
||||||
'Torrent9',
|
'KickassTorrents',
|
||||||
'TorrentGalaxy',
|
'TorrentGalaxy',
|
||||||
|
'MagnetDL',
|
||||||
|
'HorribleSubs',
|
||||||
|
'NyaaSi',
|
||||||
|
'TokyoTosho',
|
||||||
|
'AniDex',
|
||||||
|
'🇷🇺 Rutor',
|
||||||
|
'🇷🇺 Rutracker',
|
||||||
|
'🇵🇹 Comando',
|
||||||
|
'🇵🇹 BluDV',
|
||||||
|
'🇫🇷 Torrent9',
|
||||||
|
'🇮🇹 ilCorSaRoNeRo',
|
||||||
|
'🇪🇸 MejorTorrent',
|
||||||
|
'🇪🇸 Wolfmax4k',
|
||||||
|
'🇲🇽 Cinecalidad',
|
||||||
|
'🇵🇱 BestTorrents'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public static function getProviders()
|
public static function getProviders()
|
||||||
{
|
{
|
||||||
return self::$providers;
|
return self::$providers;
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ declare(strict_types=1);
|
|||||||
namespace App\User\Framework\Controller\Web;
|
namespace App\User\Framework\Controller\Web;
|
||||||
|
|
||||||
use App\Base\Service\Broadcaster;
|
use App\Base\Service\Broadcaster;
|
||||||
|
use App\Torrentio\Client\TorrentioUrl;
|
||||||
|
use App\Torrentio\Framework\Form\TorrentioPreferencesForm;
|
||||||
use App\User\Action\Command\SaveUserMediaPreferencesCommand;
|
use App\User\Action\Command\SaveUserMediaPreferencesCommand;
|
||||||
|
use App\User\Action\Command\SaveUserTorrentioPreferencesCommand;
|
||||||
use App\User\Action\Handler\SaveUserCalendarPreferencesHandler;
|
use App\User\Action\Handler\SaveUserCalendarPreferencesHandler;
|
||||||
use App\User\Action\Handler\SaveUserDownloadPreferencesHandler;
|
use App\User\Action\Handler\SaveUserDownloadPreferencesHandler;
|
||||||
use App\User\Action\Handler\SaveUserMediaPreferencesHandler;
|
use App\User\Action\Handler\SaveUserMediaPreferencesHandler;
|
||||||
|
use App\User\Action\Handler\SaveUserTorrentioPreferencesHandler;
|
||||||
use App\User\Action\Input\SaveUserCalendarPreferencesInput;
|
use App\User\Action\Input\SaveUserCalendarPreferencesInput;
|
||||||
use App\User\Action\Input\SaveUserDownloadPreferencesInput;
|
use App\User\Action\Input\SaveUserDownloadPreferencesInput;
|
||||||
use App\User\Action\Input\SaveUserMediaPreferencesInput;
|
use App\User\Action\Input\SaveUserMediaPreferencesInput;
|
||||||
@@ -38,6 +42,9 @@ class PreferencesController extends AbstractController
|
|||||||
$calendarPreferences = $this->getUser()->getCalendarPreferences();
|
$calendarPreferences = $this->getUser()->getCalendarPreferences();
|
||||||
$formData = (array) UserPreferencesFactory::createFromUser($this->getUser());
|
$formData = (array) UserPreferencesFactory::createFromUser($this->getUser());
|
||||||
$form = $this->createForm(UserMediaPreferencesForm::class, $formData);
|
$form = $this->createForm(UserMediaPreferencesForm::class, $formData);
|
||||||
|
$torrentioForm = $this->createForm(TorrentioPreferencesForm::class, TorrentioUrl::fromString(
|
||||||
|
$this->getUser()->getUserPreference('torrentio_url')->getPreferenceValue()
|
||||||
|
));
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
'user/preferences.html.twig',
|
'user/preferences.html.twig',
|
||||||
@@ -45,6 +52,7 @@ class PreferencesController extends AbstractController
|
|||||||
'downloadPreferences' => $downloadPreferences,
|
'downloadPreferences' => $downloadPreferences,
|
||||||
'calendarPreferences' => $calendarPreferences,
|
'calendarPreferences' => $calendarPreferences,
|
||||||
'preferences_form' => $form,
|
'preferences_form' => $form,
|
||||||
|
'torrentio_form' => $torrentioForm,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -131,4 +139,26 @@ class PreferencesController extends AbstractController
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/user/preferences/torrentio', 'app.torrentio-preferences.save', methods: ['POST'])]
|
||||||
|
public function saveTorrentioPreferences(Request $request, SaveUserTorrentioPreferencesHandler $handler)
|
||||||
|
{
|
||||||
|
$form = $this->createForm(TorrentioPreferencesForm::class, new TorrentioUrl());
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$command = new SaveUserTorrentioPreferencesCommand(
|
||||||
|
$form->getData(),
|
||||||
|
);
|
||||||
|
$handler->handle($command);
|
||||||
|
$this->broadcaster->alert('Success', 'Your Torrentio preferences have been saved.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'user/preferences.html.twig',
|
||||||
|
[
|
||||||
|
'preferences_form' => $form,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\User\Framework\Entity;
|
|||||||
use Aimeos\Map;
|
use Aimeos\Map;
|
||||||
use App\Download\Framework\Entity\Download;
|
use App\Download\Framework\Entity\Download;
|
||||||
use App\Monitor\Framework\Entity\Monitor;
|
use App\Monitor\Framework\Entity\Monitor;
|
||||||
|
use App\Torrentio\Client\TorrentioUrl;
|
||||||
use App\User\Framework\Repository\UserRepository;
|
use App\User\Framework\Repository\UserRepository;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
@@ -342,4 +343,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
return $this->hasUserPreference('enable_ical_up_ep') &&
|
return $this->hasUserPreference('enable_ical_up_ep') &&
|
||||||
(bool) $this->getUserPreference('enable_ical_up_ep')->getPreferenceValue() === true;
|
(bool) $this->getUserPreference('enable_ical_up_ep')->getPreferenceValue() === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTorrentioUrl()
|
||||||
|
{
|
||||||
|
return $this->hasUserPreference('torrentio_url')
|
||||||
|
? TorrentioUrl::fromString($this->getUserPreference('torrentio_url')->getPreferenceValue())
|
||||||
|
: null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class UserPreference
|
|||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
private ?Preference $preference = null;
|
private ?Preference $preference = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 1024, nullable: true)]
|
||||||
private ?string $preference_value = null;
|
private ?string $preference_value = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
|||||||
27
src/Values/TorrentioDebridProviderChoices.php
Normal file
27
src/Values/TorrentioDebridProviderChoices.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Values;
|
||||||
|
|
||||||
|
class TorrentioDebridProviderChoices
|
||||||
|
{
|
||||||
|
public static array $providers = [
|
||||||
|
'realdebrid' => 'RealDebrid',
|
||||||
|
'premiumize' => 'Premiumize',
|
||||||
|
'alldebrid' => 'AllDebrid',
|
||||||
|
'debridlink' => 'DebridLink',
|
||||||
|
'easydebrid' => 'EasyDebrid',
|
||||||
|
'offcloud' => 'Offcloud',
|
||||||
|
'torbox' => 'TorBox',
|
||||||
|
'putio' => 'Put.io',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static function getProviders(): array
|
||||||
|
{
|
||||||
|
return self::$providers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function asSelectOptions(): array
|
||||||
|
{
|
||||||
|
return array_flip(self::$providers);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/Values/TorrentioExcludeQualityChoices.php
Normal file
34
src/Values/TorrentioExcludeQualityChoices.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Values;
|
||||||
|
|
||||||
|
class TorrentioExcludeQualityChoices
|
||||||
|
{
|
||||||
|
public static array $choices = [
|
||||||
|
'brremux' => 'BluRay REMUX',
|
||||||
|
'hdrall' => 'HDR/HDR10+/Dolby Vision',
|
||||||
|
'dolbyvision' => 'Dolby Vision',
|
||||||
|
'dolbyvisionwithhdr' => 'Dolby Vision + HDR',
|
||||||
|
'threed' => '3D',
|
||||||
|
'nonthreed' => 'Non 3D (DO NOT SELECT IF NOT SURE)',
|
||||||
|
'4k' => '4k',
|
||||||
|
'1080p' => '1080p',
|
||||||
|
'720p' => '720p',
|
||||||
|
'480p' => '480p',
|
||||||
|
'other' => 'Other (DVDRip/HDRip/BDRip...)',
|
||||||
|
'scr' => 'Screener',
|
||||||
|
'cam' => 'Cam',
|
||||||
|
'unknown' => 'Unknown'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public static function getChoices(): array
|
||||||
|
{
|
||||||
|
return self::$choices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function asSelectOptions(): array
|
||||||
|
{
|
||||||
|
return array_flip(self::$choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
src/Values/TorrentioLanguageChoices.php
Normal file
60
src/Values/TorrentioLanguageChoices.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Values;
|
||||||
|
|
||||||
|
class TorrentioLanguageChoices
|
||||||
|
{
|
||||||
|
public static array $languages = [
|
||||||
|
'japanese' => '🇯🇵 Japanese',
|
||||||
|
'russian' => '🇷🇺 Russian',
|
||||||
|
'italian' => '🇮🇹 Italian',
|
||||||
|
'portuguese' => '🇵🇹 Portuguese',
|
||||||
|
'spanish' => '🇪🇸 Spanish',
|
||||||
|
'latino' => '🇲🇽 Latino',
|
||||||
|
'korean' => '🇰🇷 Korean',
|
||||||
|
'chinese' => '🇨🇳 Chinese',
|
||||||
|
'taiwanese' => '🇹🇼 Taiwanese',
|
||||||
|
'french' => '🇫🇷 French',
|
||||||
|
'german' => '🇩🇪 German',
|
||||||
|
'dutch' => '🇳🇱 Dutch',
|
||||||
|
'hindi' => '🇮🇳 Hindi',
|
||||||
|
'telugu' => '🇮🇳 Telugu',
|
||||||
|
'tamil' => '🇮🇳 Tamil',
|
||||||
|
'polish' => '🇵🇱 Polish',
|
||||||
|
'lithuanian' => '🇱🇹 Lithuanian',
|
||||||
|
'latvian' => '🇱🇻 Latvian',
|
||||||
|
'estonian' => '🇪🇪 Estonian',
|
||||||
|
'czech' => '🇨🇿 Czech',
|
||||||
|
'slovakian' => '🇸🇰 Slovakian',
|
||||||
|
'slovenian' => '🇸🇮 Slovenian',
|
||||||
|
'hungarian' => '🇭🇺 Hungarian',
|
||||||
|
'romanian' => '🇷🇴 Romanian',
|
||||||
|
'bulgarian' => '🇧🇬 Bulgarian',
|
||||||
|
'serbian' => '🇷🇸 Serbian',
|
||||||
|
'croatian' => '🇭🇷 Croatian',
|
||||||
|
'ukrainian' => '🇺🇦 Ukrainian',
|
||||||
|
'greek' => '🇬🇷 Greek',
|
||||||
|
'danish' => '🇩🇰 Danish',
|
||||||
|
'finnish' => '🇫🇮 Finnish',
|
||||||
|
'swedish' => '🇸🇪 Swedish',
|
||||||
|
'norwegian' => '🇳🇴 Norwegian',
|
||||||
|
'turkish' => '🇹🇷 Turkish',
|
||||||
|
'arabic' => '🇸🇦 Arabic',
|
||||||
|
'persian' => '🇮🇷 Persian',
|
||||||
|
'hebrew' => '🇮🇱 Hebrew',
|
||||||
|
'vietnamese' => '🇻🇳 Vietnamese',
|
||||||
|
'indonesian' => '🇮🇩 Indonesian',
|
||||||
|
'malay' => '🇲🇾 Malay',
|
||||||
|
'thai' => '🇹🇭 Thai'
|
||||||
|
];
|
||||||
|
|
||||||
|
public static function getLanguages(): array
|
||||||
|
{
|
||||||
|
return self::$languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function asSelectOptions(): array
|
||||||
|
{
|
||||||
|
return array_flip(self::$languages);
|
||||||
|
}
|
||||||
|
}
|
||||||
41
src/Values/TorrentioProviderChoices.php
Normal file
41
src/Values/TorrentioProviderChoices.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Values;
|
||||||
|
|
||||||
|
class TorrentioProviderChoices
|
||||||
|
{
|
||||||
|
public static array $choices = [
|
||||||
|
'yts' => 'YTS',
|
||||||
|
'eztv' => 'EZTV',
|
||||||
|
'rarbg' => 'RARBG',
|
||||||
|
'1337x' => '1337x',
|
||||||
|
'thepiratebay' => 'ThePirateBay',
|
||||||
|
'kickasstorrents' => 'KickassTorrents',
|
||||||
|
'torrentgalaxy' => 'TorrentGalaxy',
|
||||||
|
'magnetdl' => 'MagnetDL',
|
||||||
|
'horriblesubs' => 'HorribleSubs',
|
||||||
|
'nyaasi' => 'NyaaSi',
|
||||||
|
'tokyotosho' => 'TokyoTosho',
|
||||||
|
'anidex' => 'AniDex',
|
||||||
|
'rutor' => '🇷🇺 Rutor',
|
||||||
|
'rutracker' => '🇷🇺 Rutracker',
|
||||||
|
'comando' => '🇵🇹 Comando',
|
||||||
|
'bludv' => '🇵🇹 BluDV',
|
||||||
|
'torrent9' => '🇫🇷 Torrent9',
|
||||||
|
'ilcorsaronero' => '🇮🇹 ilCorSaRoNeRo',
|
||||||
|
'mejortorrent' => '🇪🇸 MejorTorrent',
|
||||||
|
'wolfmax4k' => '🇪🇸 Wolfmax4k',
|
||||||
|
'cinecalidad' => '🇲🇽 Cinecalidad',
|
||||||
|
'besttorrents' => '🇵🇱 BestTorrents'
|
||||||
|
];
|
||||||
|
|
||||||
|
public static function getChoices(): array
|
||||||
|
{
|
||||||
|
return self::$choices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function asSelectOptions(): array
|
||||||
|
{
|
||||||
|
return array_flip(self::$choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/Values/TorrentioSortChoices.php
Normal file
23
src/Values/TorrentioSortChoices.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Values;
|
||||||
|
|
||||||
|
class TorrentioSortChoices
|
||||||
|
{
|
||||||
|
public static array $choices = [
|
||||||
|
'quality' => 'By quality then seeders',
|
||||||
|
'qualitysize' => 'By quality then size',
|
||||||
|
'seeders' => 'By seeders',
|
||||||
|
'size' => 'By size',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static function getChoices(): array
|
||||||
|
{
|
||||||
|
return self::$choices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function asSelectOptions(): array
|
||||||
|
{
|
||||||
|
return array_flip(self::$choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<twig:SearchBar />
|
<twig:SearchBar />
|
||||||
<div class="md:flex md:items-center md:gap-12">
|
<div class="md:flex md:items-center md:gap-12">
|
||||||
<nav aria-label="Global" class="md:block">
|
<nav aria-label="Global" class="md:block">
|
||||||
<ul class="flex items-center gap-6 text-sm">
|
<ul class="ml-4 flex items-end md:items-center md:gap-6 text-sm">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('app.monitor.upcoming-episodes') }}" data-turbo="false" title="View upcoming episodes of the shows you're subscribed to.">
|
<a href="{{ path('app.monitor.upcoming-episodes') }}" data-turbo="false" title="View upcoming episodes of the shows you're subscribed to.">
|
||||||
<twig:ux:icon name="solar:calendar-linear" width="25px" class="text-orange-500" />
|
<twig:ux:icon name="solar:calendar-linear" width="25px" class="text-orange-500" />
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if this.isWidget and this.monitors.items|length > 5 %}
|
{% if this.isWidget and this.monitors.items|length > 5 %}
|
||||||
<tr id="monitor_view_all">
|
<tr id="monitor_view_all">
|
||||||
<td colspan="100%" class="py-2 whitespace-nowrap bg-gray-400 dark:bg-gray-700 uppercase text-xs font-medium text-center text-black dark:text-white min-w-[50ch] max-w-[50ch] truncate">
|
<td colspan="100%" class="py-2 whitespace-nowrap bg-orange-500/80 uppercase text-xs font-medium text-center truncate dark:text-black">
|
||||||
<a href="{{ path('app_monitors') }}">View All Monitors</a>
|
<a href="{{ path('app_monitors') }}">View All Monitors</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<button class="submit-button flex flex-row gap-2 items-center">
|
<button class="submit-button {{ class|default('flex flex-row gap-2 items-center') }}">
|
||||||
{% if show_icon|default %}
|
{% if show_icon|default %}
|
||||||
<twig:ux:icon name="zondicons:checkmark" width=".8rem" class="text-green-500" />
|
<twig:ux:icon name="zondicons:checkmark" width=".8rem" class="text-green-500" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{% block h2 %}Upcoming Episodes{% endblock %}
|
{% block h2 %}Upcoming Episodes{% endblock %}
|
||||||
|
|
||||||
{% block action_buttons %}
|
{% block action_buttons %}
|
||||||
<a href="{{ path('app.monitor.upcoming-episodes') }}"
|
<a href="{{ path('app.monitor.upcoming-episodes') }}" data-turbo="false"
|
||||||
class="h-6 bg-orange-500/80 hover:bg-orange-600/80 px-2 text-white rounded-ms text-sm font-semibold">
|
class="h-6 bg-orange-500/80 hover:bg-orange-600/80 px-2 text-white rounded-ms text-sm font-semibold">
|
||||||
Upcoming Episodes
|
Upcoming Episodes
|
||||||
</a>
|
</a>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<twig:Card title="Upcoming episodes of shows your monitoring">
|
<twig:Card title="Upcoming episodes of shows your monitoring">
|
||||||
<a href="{{ path('app.monitors.ical') }}" title="Subscribe to the 'Upcoming Episodes' calendar via iCal. Click to export the events to a .ics file or copy the link and use it to subscribe in a calendar app that supports iCal/ics calendars." class="mb-2 self-end dark:text-white decoration-underline">
|
<a href="{{ path('app.monitors.ical', {email: app.user.email}) }}" title="Subscribe to the 'Upcoming Episodes' calendar via iCal. Click to export the events to a .ics file or copy the link and use it to subscribe in a calendar app that supports iCal/ics calendars." class="mb-2 self-end dark:text-white decoration-underline">
|
||||||
<twig:ux:icon name="lets-icons:calendar-add-light" width="24" class="text-orange-500" />
|
<twig:ux:icon name="lets-icons:calendar-add-light" width="24" class="text-orange-500" />
|
||||||
</a>
|
</a>
|
||||||
<div id="calendar" class="text-white">
|
<div id="calendar" class="text-white">
|
||||||
@@ -39,10 +39,7 @@
|
|||||||
const calendarEl = document.getElementById('calendar');
|
const calendarEl = document.getElementById('calendar');
|
||||||
const calendar = new FullCalendar.Calendar(calendarEl, {
|
const calendar = new FullCalendar.Calendar(calendarEl, {
|
||||||
initialView: getView(),
|
initialView: getView(),
|
||||||
events: {
|
events: data['episodes'],
|
||||||
url: '{{ path('app.monitors.ical') }}',
|
|
||||||
format: 'ics'
|
|
||||||
},
|
|
||||||
windowResize: function(arg) {
|
windowResize: function(arg) {
|
||||||
this.changeView(getView());
|
this.changeView(getView());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
{% block title %}{{ results.media.title }} — Download Options — Torsearch{% endblock %}
|
{% block title %}{{ results.media.title }} — Download Options — Torsearch{% endblock %}
|
||||||
|
|
||||||
|
{% block h2 %}Media Results{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="p-4 flex flex-col grow gap-4">
|
<div class="p-4 flex flex-col grow gap-4">
|
||||||
<h2 class="mb-2 text-3xl font-bold text-gray-50">Media Results</h2>
|
|
||||||
<div class="flex flex-row w-full gap-2">
|
<div class="flex flex-row w-full gap-2">
|
||||||
<twig:Card title="" class="w-full" contentClass="flex flex-col gap-4 justify-between w-full text-gray-50">
|
<twig:Card title="" class="w-full" contentClass="flex flex-col gap-4 justify-between w-full text-gray-50">
|
||||||
<div class="p-2 md:p-4 flex flex-col md:flex-row gap-6">
|
<div class="p-2 md:p-4 flex flex-col md:flex-row gap-6">
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
<div class="w-full flex flex-col">
|
<div class="w-full flex flex-col">
|
||||||
<div class="mb-4 flex flex-row gap-2 justify-between">
|
<div class="mb-4 flex flex-row gap-2 justify-between">
|
||||||
<h3 class="text-xl font-medium leading-tight font-bold text-gray-50">
|
<h3 class="text-xl font-medium leading-tight font-bold text-gray-50">
|
||||||
{{ results.media.title }} ({{ results.media.year }})
|
{{ results.media.title }} ({{ results.media.year|date('Y') }})
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
{% if results.media.mediaType == "tvshows" %}
|
{% if results.media.mediaType == "tvshows" %}
|
||||||
@@ -95,12 +96,35 @@
|
|||||||
{% elseif "tvshows" == results.media.mediaType %}
|
{% elseif "tvshows" == results.media.mediaType %}
|
||||||
<twig:TvEpisodeList
|
<twig:TvEpisodeList
|
||||||
results="results"
|
results="results"
|
||||||
:imdbId="results.media.imdbId" :season="results.season" :perPage="20" :pageNumber="1"
|
loading="defer"
|
||||||
:tmdbId="results.media.tmdbId" :title="results.media.title" loading="defer" :episodeNumber="results.episode"
|
:imdbId="results.media.imdbId"
|
||||||
|
:season="results.season"
|
||||||
|
:perPage="20"
|
||||||
|
:pageNumber="1"
|
||||||
|
:tmdbId="results.media.tmdbId"
|
||||||
|
:title="results.media.title"
|
||||||
|
:episodeNumber="results.episode"
|
||||||
/>
|
/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</twig:Card>
|
</twig:Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<twig:Card title="Related Media" contentClass="flex flex-col gap-4 text-white">
|
||||||
|
<p>Results similar to "{{ results.media.title }}" that you may be interested in.</p>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-2 gap-4 md:flex flex-col md:flex-row justify-between w-full">
|
||||||
|
{% for media in results.relatedMedia %}
|
||||||
|
<twig:Poster imdbId="{{ media.imdbId }}"
|
||||||
|
tmdbId="{{ media.tmdbId }}"
|
||||||
|
title="{{ media.title }}"
|
||||||
|
description="{{ media.description }}"
|
||||||
|
image="{{ media.poster }}"
|
||||||
|
year="{{ media.year }}"
|
||||||
|
mediaType="{{ media.mediaType }}"
|
||||||
|
/>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</twig:Card>
|
||||||
</div>
|
</div>
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
|
|||||||
@@ -57,4 +57,30 @@
|
|||||||
</form>
|
</form>
|
||||||
</twig:Card>
|
</twig:Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="p-4 flex flex-col md:flex-row gap-2">
|
||||||
|
<twig:Card title="Torrentio Preferences" class="w-full">
|
||||||
|
<p class="text-gray-50 mb-4">Configure your Torrentio client.</p>
|
||||||
|
{{ form_start(torrentio_form, {
|
||||||
|
action: path('app.torrentio-preferences.save')
|
||||||
|
}) }}
|
||||||
|
<div class="flex flex-col md:flex-row gap-2">
|
||||||
|
<div class="self-end mb-4">
|
||||||
|
{{ form_row(torrentio_form.providers) }}
|
||||||
|
{{ form_row(torrentio_form.sorting) }}
|
||||||
|
{{ form_row(torrentio_form.language) }}
|
||||||
|
{{ form_row(torrentio_form.qualityfilter) }}
|
||||||
|
{{ form_row(torrentio_form.limit) }}
|
||||||
|
{{ form_row(torrentio_form.sizefilter) }}
|
||||||
|
{{ form_row(torrentio_form.debridProvider) }}
|
||||||
|
{{ form_row(torrentio_form.debridToken) }}
|
||||||
|
{{ form_widget(torrentio_form._token) }}
|
||||||
|
<div class="w-[5rem]">
|
||||||
|
<twig:SubmitButton show_icon text="Save"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ form_end(preferences_form) }}
|
||||||
|
</twig:Card>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user