fix: works with tv & movies
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Monitor\Action\Handler\MonitorTvShowHandler;
|
||||
use App\Monitor\Framework\Scheduler\MonitorDispatcher;
|
||||
use App\Tmdb\Tmdb;
|
||||
use App\Tmdb\TmdbResult;
|
||||
use App\User\Framework\Entity\User;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -23,6 +24,8 @@ final class IndexController extends AbstractController
|
||||
#[Route('/', name: 'app_index')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
return $this->render('index/index.html.twig', [
|
||||
'active_downloads' => $this->getUser()->getActiveDownloads(),
|
||||
'recent_downloads' => $this->getUser()->getDownloads(),
|
||||
|
||||
@@ -10,6 +10,7 @@ class SaveUserMediaPreferencesCommand implements CommandInterface
|
||||
public function __construct(
|
||||
public string $resolution,
|
||||
public string $codec,
|
||||
public string $quality,
|
||||
public string $language,
|
||||
public string $provider,
|
||||
) {}
|
||||
|
||||
@@ -18,6 +18,9 @@ class SaveUserMediaPreferencesInput implements InputInterface
|
||||
#[SourceRequest('resolution')]
|
||||
public string $resolution,
|
||||
|
||||
#[SourceRequest('quality')]
|
||||
public string $quality,
|
||||
|
||||
#[SourceRequest('codec')]
|
||||
public string $codec,
|
||||
|
||||
@@ -33,6 +36,7 @@ class SaveUserMediaPreferencesInput implements InputInterface
|
||||
return new SaveUserMediaPreferencesCommand(
|
||||
$this->resolution,
|
||||
$this->codec,
|
||||
$this->quality,
|
||||
$this->language,
|
||||
$this->provider,
|
||||
);
|
||||
|
||||
@@ -12,6 +12,7 @@ use App\User\Framework\Repository\PreferencesRepository;
|
||||
use App\Util\Broadcaster;
|
||||
use App\Util\CountryLanguages;
|
||||
use App\Util\ProviderList;
|
||||
use App\Util\QualityList;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
@@ -36,7 +37,8 @@ class PreferencesController extends AbstractController
|
||||
[
|
||||
'preferences' => $this->preferencesRepository->findEnabled(),
|
||||
'languages' => $languages,
|
||||
'providers' => ProviderList::$providers,
|
||||
'providers' => ProviderList::getProviders(),
|
||||
'qualities' => QualityList::getBaseQualities(),
|
||||
'mediaPreferences' => $mediaPreferences,
|
||||
'downloadPreferences' => $downloadPreferences,
|
||||
]
|
||||
@@ -67,6 +69,7 @@ class PreferencesController extends AbstractController
|
||||
'preferences' => $this->preferencesRepository->findEnabled(),
|
||||
'languages' => $languages,
|
||||
'providers' => ProviderList::$providers,
|
||||
'qualities' => QualityList::getBaseQualities(),
|
||||
'mediaPreferences' => $mediaPreferences,
|
||||
'downloadPreferences' => $downloadPreferences,
|
||||
]
|
||||
|
||||
115
src/Util/QualityList.php
Normal file
115
src/Util/QualityList.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Util;
|
||||
|
||||
class QualityList
|
||||
{
|
||||
public static $qualities = [
|
||||
"DVD-Rip" => [
|
||||
"DVDRip",
|
||||
"DVDMux",
|
||||
"DVDR",
|
||||
"DVD-Full",
|
||||
"Full-Rip",
|
||||
"ISO rip",
|
||||
"lossless rip",
|
||||
"untouched rip",
|
||||
"DVD-5",
|
||||
"DVD-9",
|
||||
],
|
||||
"HDTV, PDTV or DSRip" => [
|
||||
"DSR",
|
||||
"DSRip",
|
||||
"SATRip",
|
||||
"DTHRip",
|
||||
"DVBRip",
|
||||
"HDTV",
|
||||
"PDTV",
|
||||
"DTVRip",
|
||||
"TVRip",
|
||||
"HDTVRip",
|
||||
],
|
||||
"VODRip" => [
|
||||
"VODRip",
|
||||
"VODR",
|
||||
],
|
||||
"HC HD-Rip" => [
|
||||
"HC",
|
||||
"HD-Rip",
|
||||
],
|
||||
"WEBCap" => [
|
||||
"WEB-Cap",
|
||||
"WEBCAP",
|
||||
"WEB Cap",
|
||||
],
|
||||
"HDRip" => [
|
||||
"HDRip",
|
||||
"WEB-DLRip",
|
||||
],
|
||||
"WEBRip" => [
|
||||
"WEBRip",
|
||||
"WEB Rip",
|
||||
"WEB-Rip",
|
||||
"WEBRip (P2P)",
|
||||
"WEB Rip (P2P)",
|
||||
"WEB-Rip (P2P)",
|
||||
],
|
||||
"WEB-DL" => [
|
||||
"WEBDL",
|
||||
"WEB DL",
|
||||
"WEB-DL",
|
||||
"WEB (Scene)",
|
||||
"WEBRip",
|
||||
],
|
||||
"Blu-ray/BD/BRRip" => [
|
||||
"Blu-Ray",
|
||||
"BluRay",
|
||||
"BLURAY",
|
||||
"BDRip",
|
||||
"BRip",
|
||||
"BRRip",
|
||||
"BDR[13]",
|
||||
"BD25",
|
||||
"BD50",
|
||||
"BD66",
|
||||
"BD100",
|
||||
"BD5",
|
||||
"BD9",
|
||||
"BDMV",
|
||||
"BDISO",
|
||||
"COMPLETE.BLURAY",
|
||||
],
|
||||
"4K" => [
|
||||
"CBR",
|
||||
"VBR",
|
||||
],
|
||||
];
|
||||
|
||||
public static function getQualities(): array
|
||||
{
|
||||
return self::$qualities;
|
||||
}
|
||||
|
||||
public static function getBaseQualities(): array
|
||||
{
|
||||
return array_keys(self::$qualities);
|
||||
}
|
||||
|
||||
public static function getBaseQualityFromSubQuality(string $key): ?string
|
||||
{
|
||||
return array_search($key, self::$qualities) ?? null;
|
||||
}
|
||||
|
||||
public static function getAsReverseMap(): array
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach (self::$qualities as $baseQualtiy => $subQualities) {
|
||||
foreach ($subQualities as $subQuality) {
|
||||
$results[$subQuality] = $baseQualtiy;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user