feat: adds quality profile
This commit is contained in:
@@ -27,6 +27,7 @@ export default class extends Controller {
|
||||
static values = {
|
||||
'media-type': String,
|
||||
'episodes': Array,
|
||||
'reverseMappedQualities': Object,
|
||||
}
|
||||
|
||||
async connect() {
|
||||
@@ -100,7 +101,9 @@ export default class extends Controller {
|
||||
|
||||
addQualities(option, props) {
|
||||
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;
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Twig\Components;
|
||||
|
||||
use Aimeos\Map;
|
||||
use App\User\Framework\Repository\PreferencesRepository;
|
||||
use App\Util\QualityList;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
|
||||
use Symfony\UX\LiveComponent\DefaultActionTrait;
|
||||
@@ -17,6 +18,8 @@ final class Filter
|
||||
|
||||
public array $userPreferences = [];
|
||||
|
||||
public array $reverseMappedQualities = [];
|
||||
|
||||
public function __construct(
|
||||
private readonly PreferencesRepository $preferencesRepository,
|
||||
private readonly Security $security,
|
||||
@@ -27,5 +30,6 @@ final class Filter
|
||||
->toArray();
|
||||
$this->userPreferences = Map::from($this->security->getUser()->getUserPreferenceValues())
|
||||
->toArray();
|
||||
$this->reverseMappedQualities = QualityList::getAsReverseMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
return Map::from($this->userPreferences)
|
||||
->rekey(fn(UserPreference $userPreference) => $userPreference->getPreference()->getId())
|
||||
->map(function (UserPreference $userPreference) {
|
||||
if (in_array($userPreference->getPreference()->getId(), ['language', 'provider'])) {
|
||||
if (in_array($userPreference->getPreference()->getId(), ['language', 'provider', 'quality'])) {
|
||||
return $userPreference->getPreferenceValue();
|
||||
}
|
||||
foreach ($userPreference->getPreference()->getPreferenceOptions() as $preferenceOption) {
|
||||
|
||||
@@ -5,83 +5,83 @@ namespace App\Util;
|
||||
class QualityList
|
||||
{
|
||||
public static $qualities = [
|
||||
"DVD-Rip" => [
|
||||
"DVDRip",
|
||||
"DVDMux",
|
||||
"DVDR",
|
||||
"DVD-Full",
|
||||
"Full-Rip",
|
||||
"ISO rip",
|
||||
"dvd-rip" => [
|
||||
"dvdrip",
|
||||
"dvdmux",
|
||||
"dvdr",
|
||||
"dvd-full",
|
||||
"full-rip",
|
||||
"iso rip",
|
||||
"lossless rip",
|
||||
"untouched rip",
|
||||
"DVD-5",
|
||||
"DVD-9",
|
||||
"dvd-5",
|
||||
"dvd-9",
|
||||
],
|
||||
"HDTV, PDTV or DSRip" => [
|
||||
"DSR",
|
||||
"DSRip",
|
||||
"SATRip",
|
||||
"DTHRip",
|
||||
"DVBRip",
|
||||
"HDTV",
|
||||
"PDTV",
|
||||
"DTVRip",
|
||||
"TVRip",
|
||||
"HDTVRip",
|
||||
"hdtv, pdtv or dsrip" => [
|
||||
"dsr",
|
||||
"dsrip",
|
||||
"satrip",
|
||||
"dthrip",
|
||||
"dvbrip",
|
||||
"hdtv",
|
||||
"pdtv",
|
||||
"dtvrip",
|
||||
"tvrip",
|
||||
"hdtvrip",
|
||||
],
|
||||
"VODRip" => [
|
||||
"VODRip",
|
||||
"VODR",
|
||||
"vodrip" => [
|
||||
"vodrip",
|
||||
"vodr",
|
||||
],
|
||||
"HC HD-Rip" => [
|
||||
"HC",
|
||||
"HD-Rip",
|
||||
"hc hd-rip" => [
|
||||
"hc",
|
||||
"hd-rip",
|
||||
],
|
||||
"WEBCap" => [
|
||||
"WEB-Cap",
|
||||
"WEBCAP",
|
||||
"WEB Cap",
|
||||
"webcap" => [
|
||||
"web-cap",
|
||||
"webcap",
|
||||
"web cap",
|
||||
],
|
||||
"HDRip" => [
|
||||
"HDRip",
|
||||
"WEB-DLRip",
|
||||
"hdrip" => [
|
||||
"hdrip",
|
||||
"web-dlrip",
|
||||
],
|
||||
"WEBRip" => [
|
||||
"WEBRip",
|
||||
"WEB Rip",
|
||||
"WEB-Rip",
|
||||
"WEBRip (P2P)",
|
||||
"WEB Rip (P2P)",
|
||||
"WEB-Rip (P2P)",
|
||||
"webrip" => [
|
||||
"webrip",
|
||||
"web rip",
|
||||
"web-rip",
|
||||
"webrip (p2p)",
|
||||
"web rip (p2p)",
|
||||
"web-rip (p2p)",
|
||||
],
|
||||
"WEB-DL" => [
|
||||
"WEBDL",
|
||||
"WEB DL",
|
||||
"WEB-DL",
|
||||
"WEB (Scene)",
|
||||
"WEBRip",
|
||||
"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",
|
||||
"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",
|
||||
"4k" => [
|
||||
"cbr",
|
||||
"vbr",
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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-movie-results-outlet=".results"
|
||||
data-result-filter-tv-results-outlet=".results"
|
||||
@@ -56,7 +56,7 @@
|
||||
</select>
|
||||
</label>
|
||||
<label for="quality">
|
||||
Quality {{ this.userPreferences['quality'] }}
|
||||
Quality
|
||||
<select id="quality"
|
||||
data-result-filter-target="quality"
|
||||
class="px-1 py-0.5 bg-stone-100 text-gray-800 rounded-md"
|
||||
|
||||
Reference in New Issue
Block a user