feat: adds quality profile
This commit is contained in:
@@ -27,6 +27,7 @@ export default class extends Controller {
|
|||||||
static values = {
|
static values = {
|
||||||
'media-type': String,
|
'media-type': String,
|
||||||
'episodes': Array,
|
'episodes': Array,
|
||||||
|
'reverseMappedQualities': Object,
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
@@ -100,7 +101,9 @@ export default class extends Controller {
|
|||||||
|
|
||||||
addQualities(option, props) {
|
addQualities(option, props) {
|
||||||
if (!this.qualities.includes(props['quality'])) {
|
if (!this.qualities.includes(props['quality'])) {
|
||||||
this.qualities.push(props['quality']);
|
if (props['quality'].toLowerCase() in this.reverseMappedQualitiesValue) {
|
||||||
|
this.qualities.push(props['quality']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const preferred = this.qualityTarget.dataset.preferred;
|
const preferred = this.qualityTarget.dataset.preferred;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Twig\Components;
|
|||||||
|
|
||||||
use Aimeos\Map;
|
use Aimeos\Map;
|
||||||
use App\User\Framework\Repository\PreferencesRepository;
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
|
use App\Util\QualityList;
|
||||||
use Symfony\Bundle\SecurityBundle\Security;
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
|
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
|
||||||
use Symfony\UX\LiveComponent\DefaultActionTrait;
|
use Symfony\UX\LiveComponent\DefaultActionTrait;
|
||||||
@@ -17,6 +18,8 @@ final class Filter
|
|||||||
|
|
||||||
public array $userPreferences = [];
|
public array $userPreferences = [];
|
||||||
|
|
||||||
|
public array $reverseMappedQualities = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly PreferencesRepository $preferencesRepository,
|
private readonly PreferencesRepository $preferencesRepository,
|
||||||
private readonly Security $security,
|
private readonly Security $security,
|
||||||
@@ -27,5 +30,6 @@ final class Filter
|
|||||||
->toArray();
|
->toArray();
|
||||||
$this->userPreferences = Map::from($this->security->getUser()->getUserPreferenceValues())
|
$this->userPreferences = Map::from($this->security->getUser()->getUserPreferenceValues())
|
||||||
->toArray();
|
->toArray();
|
||||||
|
$this->reverseMappedQualities = QualityList::getAsReverseMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
return Map::from($this->userPreferences)
|
return Map::from($this->userPreferences)
|
||||||
->rekey(fn(UserPreference $userPreference) => $userPreference->getPreference()->getId())
|
->rekey(fn(UserPreference $userPreference) => $userPreference->getPreference()->getId())
|
||||||
->map(function (UserPreference $userPreference) {
|
->map(function (UserPreference $userPreference) {
|
||||||
if (in_array($userPreference->getPreference()->getId(), ['language', 'provider'])) {
|
if (in_array($userPreference->getPreference()->getId(), ['language', 'provider', 'quality'])) {
|
||||||
return $userPreference->getPreferenceValue();
|
return $userPreference->getPreferenceValue();
|
||||||
}
|
}
|
||||||
foreach ($userPreference->getPreference()->getPreferenceOptions() as $preferenceOption) {
|
foreach ($userPreference->getPreference()->getPreferenceOptions() as $preferenceOption) {
|
||||||
|
|||||||
@@ -5,83 +5,83 @@ namespace App\Util;
|
|||||||
class QualityList
|
class QualityList
|
||||||
{
|
{
|
||||||
public static $qualities = [
|
public static $qualities = [
|
||||||
"DVD-Rip" => [
|
"dvd-rip" => [
|
||||||
"DVDRip",
|
"dvdrip",
|
||||||
"DVDMux",
|
"dvdmux",
|
||||||
"DVDR",
|
"dvdr",
|
||||||
"DVD-Full",
|
"dvd-full",
|
||||||
"Full-Rip",
|
"full-rip",
|
||||||
"ISO rip",
|
"iso rip",
|
||||||
"lossless rip",
|
"lossless rip",
|
||||||
"untouched rip",
|
"untouched rip",
|
||||||
"DVD-5",
|
"dvd-5",
|
||||||
"DVD-9",
|
"dvd-9",
|
||||||
],
|
],
|
||||||
"HDTV, PDTV or DSRip" => [
|
"hdtv, pdtv or dsrip" => [
|
||||||
"DSR",
|
"dsr",
|
||||||
"DSRip",
|
"dsrip",
|
||||||
"SATRip",
|
"satrip",
|
||||||
"DTHRip",
|
"dthrip",
|
||||||
"DVBRip",
|
"dvbrip",
|
||||||
"HDTV",
|
"hdtv",
|
||||||
"PDTV",
|
"pdtv",
|
||||||
"DTVRip",
|
"dtvrip",
|
||||||
"TVRip",
|
"tvrip",
|
||||||
"HDTVRip",
|
"hdtvrip",
|
||||||
],
|
],
|
||||||
"VODRip" => [
|
"vodrip" => [
|
||||||
"VODRip",
|
"vodrip",
|
||||||
"VODR",
|
"vodr",
|
||||||
],
|
],
|
||||||
"HC HD-Rip" => [
|
"hc hd-rip" => [
|
||||||
"HC",
|
"hc",
|
||||||
"HD-Rip",
|
"hd-rip",
|
||||||
],
|
],
|
||||||
"WEBCap" => [
|
"webcap" => [
|
||||||
"WEB-Cap",
|
"web-cap",
|
||||||
"WEBCAP",
|
"webcap",
|
||||||
"WEB Cap",
|
"web cap",
|
||||||
],
|
],
|
||||||
"HDRip" => [
|
"hdrip" => [
|
||||||
"HDRip",
|
"hdrip",
|
||||||
"WEB-DLRip",
|
"web-dlrip",
|
||||||
],
|
],
|
||||||
"WEBRip" => [
|
"webrip" => [
|
||||||
"WEBRip",
|
"webrip",
|
||||||
"WEB Rip",
|
"web rip",
|
||||||
"WEB-Rip",
|
"web-rip",
|
||||||
"WEBRip (P2P)",
|
"webrip (p2p)",
|
||||||
"WEB Rip (P2P)",
|
"web rip (p2p)",
|
||||||
"WEB-Rip (P2P)",
|
"web-rip (p2p)",
|
||||||
],
|
],
|
||||||
"WEB-DL" => [
|
"web-dl" => [
|
||||||
"WEBDL",
|
"webdl",
|
||||||
"WEB DL",
|
"web dl",
|
||||||
"WEB-DL",
|
"web-dl",
|
||||||
"WEB (Scene)",
|
"web (scene)",
|
||||||
"WEBRip",
|
"webrip",
|
||||||
],
|
],
|
||||||
"Blu-ray/BD/BRRip" => [
|
"blu-ray/bd/brrip" => [
|
||||||
"Blu-Ray",
|
"blu-ray",
|
||||||
"BluRay",
|
"bluray",
|
||||||
"BLURAY",
|
"bluray",
|
||||||
"BDRip",
|
"bdrip",
|
||||||
"BRip",
|
"brip",
|
||||||
"BRRip",
|
"brrip",
|
||||||
"BDR[13]",
|
"bdr[13]",
|
||||||
"BD25",
|
"bd25",
|
||||||
"BD50",
|
"bd50",
|
||||||
"BD66",
|
"bd66",
|
||||||
"BD100",
|
"bd100",
|
||||||
"BD5",
|
"bd5",
|
||||||
"BD9",
|
"bd9",
|
||||||
"BDMV",
|
"bdmv",
|
||||||
"BDISO",
|
"bdiso",
|
||||||
"COMPLETE.BLURAY",
|
"complete.bluray",
|
||||||
],
|
],
|
||||||
"4K" => [
|
"4k" => [
|
||||||
"CBR",
|
"cbr",
|
||||||
"VBR",
|
"vbr",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div id="filter" class="flex flex-col gap-4"
|
<div id="filter" class="flex flex-col gap-4"
|
||||||
{{ stimulus_controller('result_filter') }}
|
{{ stimulus_controller('result_filter', {reverseMappedQualities: this.reverseMappedQualities}) }}
|
||||||
data-result-filter-media-type-value="{{ results.media.mediaType }}"
|
data-result-filter-media-type-value="{{ results.media.mediaType }}"
|
||||||
data-result-filter-movie-results-outlet=".results"
|
data-result-filter-movie-results-outlet=".results"
|
||||||
data-result-filter-tv-results-outlet=".results"
|
data-result-filter-tv-results-outlet=".results"
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label for="quality">
|
<label for="quality">
|
||||||
Quality {{ this.userPreferences['quality'] }}
|
Quality
|
||||||
<select id="quality"
|
<select id="quality"
|
||||||
data-result-filter-target="quality"
|
data-result-filter-target="quality"
|
||||||
class="px-1 py-0.5 bg-stone-100 text-gray-800 rounded-md"
|
class="px-1 py-0.5 bg-stone-100 text-gray-800 rounded-md"
|
||||||
|
|||||||
Reference in New Issue
Block a user