fix: works with tv & movies
This commit is contained in:
@@ -16,6 +16,7 @@ export default class extends Controller {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static targets = ['list']
|
static targets = ['list']
|
||||||
|
static outlets = ['loading-icon']
|
||||||
|
|
||||||
options = []
|
options = []
|
||||||
optionsLoaded = false
|
optionsLoaded = false
|
||||||
@@ -33,6 +34,8 @@ export default class extends Controller {
|
|||||||
this.element.innerHTML = response;
|
this.element.innerHTML = response;
|
||||||
this.options = this.element.querySelectorAll('tbody tr');
|
this.options = this.element.querySelectorAll('tbody tr');
|
||||||
this.options.forEach((option) => option.querySelector('.download-btn').dataset['title'] = this.titleValue);
|
this.options.forEach((option) => option.querySelector('.download-btn').dataset['title'] = this.titleValue);
|
||||||
|
this.dispatch('optionsLoaded', {detail: {options: this.options}})
|
||||||
|
this.loadingIconOutlet.toggleIcon();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,19 +36,9 @@ export default class extends Controller {
|
|||||||
await this.filter();
|
await this.filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
async movieResultsOutletConnected(outlet) {
|
// Event is fired from movies/tvshows controllers to populate this data
|
||||||
await this.parseDownloadOptionForFilter(outlet)
|
async loadOptions({detail: { options }}) {
|
||||||
}
|
await options.forEach((option) => {
|
||||||
|
|
||||||
async tvResultsOutletConnected(outlet) {
|
|
||||||
await this.parseDownloadOptionForFilter(outlet)
|
|
||||||
}
|
|
||||||
|
|
||||||
async parseDownloadOptionForFilter(outlet) {
|
|
||||||
if (outlet.options.length === 0) {
|
|
||||||
await outlet.setOptions();
|
|
||||||
}
|
|
||||||
outlet.options.forEach((option) => {
|
|
||||||
this.addLanguages(option, option.dataset);
|
this.addLanguages(option, option.dataset);
|
||||||
this.addProviders(option, option.dataset);
|
this.addProviders(option, option.dataset);
|
||||||
this.addQualities(option, option.dataset);
|
this.addQualities(option, option.dataset);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export default class extends Controller {
|
|||||||
this.countTarget.innerText = 0;
|
this.countTarget.innerText = 0;
|
||||||
this.episodeSelectorTarget.disabled = true;
|
this.episodeSelectorTarget.disabled = true;
|
||||||
}
|
}
|
||||||
|
this.dispatch('optionsLoaded', {detail: {options: this.options}})
|
||||||
this.loadingIconOutlet.increaseCount();
|
this.loadingIconOutlet.increaseCount();
|
||||||
} else {
|
} else {
|
||||||
console.log(`HTTP Response Code: ${response?.status}`)
|
console.log(`HTTP Response Code: ${response?.status}`)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use App\Monitor\Action\Handler\MonitorTvShowHandler;
|
|||||||
use App\Monitor\Framework\Scheduler\MonitorDispatcher;
|
use App\Monitor\Framework\Scheduler\MonitorDispatcher;
|
||||||
use App\Tmdb\Tmdb;
|
use App\Tmdb\Tmdb;
|
||||||
use App\Tmdb\TmdbResult;
|
use App\Tmdb\TmdbResult;
|
||||||
|
use App\User\Framework\Entity\User;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@@ -23,6 +24,8 @@ final class IndexController extends AbstractController
|
|||||||
#[Route('/', name: 'app_index')]
|
#[Route('/', name: 'app_index')]
|
||||||
public function index(Request $request): Response
|
public function index(Request $request): Response
|
||||||
{
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = $this->getUser();
|
||||||
return $this->render('index/index.html.twig', [
|
return $this->render('index/index.html.twig', [
|
||||||
'active_downloads' => $this->getUser()->getActiveDownloads(),
|
'active_downloads' => $this->getUser()->getActiveDownloads(),
|
||||||
'recent_downloads' => $this->getUser()->getDownloads(),
|
'recent_downloads' => $this->getUser()->getDownloads(),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class SaveUserMediaPreferencesCommand implements CommandInterface
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
public string $resolution,
|
public string $resolution,
|
||||||
public string $codec,
|
public string $codec,
|
||||||
|
public string $quality,
|
||||||
public string $language,
|
public string $language,
|
||||||
public string $provider,
|
public string $provider,
|
||||||
) {}
|
) {}
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ class SaveUserMediaPreferencesInput implements InputInterface
|
|||||||
#[SourceRequest('resolution')]
|
#[SourceRequest('resolution')]
|
||||||
public string $resolution,
|
public string $resolution,
|
||||||
|
|
||||||
|
#[SourceRequest('quality')]
|
||||||
|
public string $quality,
|
||||||
|
|
||||||
#[SourceRequest('codec')]
|
#[SourceRequest('codec')]
|
||||||
public string $codec,
|
public string $codec,
|
||||||
|
|
||||||
@@ -33,6 +36,7 @@ class SaveUserMediaPreferencesInput implements InputInterface
|
|||||||
return new SaveUserMediaPreferencesCommand(
|
return new SaveUserMediaPreferencesCommand(
|
||||||
$this->resolution,
|
$this->resolution,
|
||||||
$this->codec,
|
$this->codec,
|
||||||
|
$this->quality,
|
||||||
$this->language,
|
$this->language,
|
||||||
$this->provider,
|
$this->provider,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use App\User\Framework\Repository\PreferencesRepository;
|
|||||||
use App\Util\Broadcaster;
|
use App\Util\Broadcaster;
|
||||||
use App\Util\CountryLanguages;
|
use App\Util\CountryLanguages;
|
||||||
use App\Util\ProviderList;
|
use App\Util\ProviderList;
|
||||||
|
use App\Util\QualityList;
|
||||||
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\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
@@ -36,7 +37,8 @@ class PreferencesController extends AbstractController
|
|||||||
[
|
[
|
||||||
'preferences' => $this->preferencesRepository->findEnabled(),
|
'preferences' => $this->preferencesRepository->findEnabled(),
|
||||||
'languages' => $languages,
|
'languages' => $languages,
|
||||||
'providers' => ProviderList::$providers,
|
'providers' => ProviderList::getProviders(),
|
||||||
|
'qualities' => QualityList::getBaseQualities(),
|
||||||
'mediaPreferences' => $mediaPreferences,
|
'mediaPreferences' => $mediaPreferences,
|
||||||
'downloadPreferences' => $downloadPreferences,
|
'downloadPreferences' => $downloadPreferences,
|
||||||
]
|
]
|
||||||
@@ -67,6 +69,7 @@ class PreferencesController extends AbstractController
|
|||||||
'preferences' => $this->preferencesRepository->findEnabled(),
|
'preferences' => $this->preferencesRepository->findEnabled(),
|
||||||
'languages' => $languages,
|
'languages' => $languages,
|
||||||
'providers' => ProviderList::$providers,
|
'providers' => ProviderList::$providers,
|
||||||
|
'qualities' => QualityList::getBaseQualities(),
|
||||||
'mediaPreferences' => $mediaPreferences,
|
'mediaPreferences' => $mediaPreferences,
|
||||||
'downloadPreferences' => $downloadPreferences,
|
'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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<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') }}
|
||||||
{{ stimulus_action('result_filter', 'filter', 'change') }}
|
|
||||||
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"
|
||||||
data-result-filter-tv-episode-list-outlet=".episode-list"
|
data-result-filter-tv-episode-list-outlet=".episode-list"
|
||||||
|
data-action="change->result-filter#filter movie-results:optionsLoaded@window->result-filter#loadOptions tv-results:optionsLoaded@window->result-filter#loadOptions"
|
||||||
>
|
>
|
||||||
<div class="w-full p-4 flex flex-col md:flex-row gap-4 bg-stone-500 text-md text-gray-500 dark:text-gray-50 rounded-lg">
|
<div class="w-full p-4 flex flex-col md:flex-row gap-4 bg-stone-500 text-md text-gray-500 dark:text-gray-50 rounded-lg">
|
||||||
<label for="resolution">
|
<label for="resolution">
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label for="quality">
|
<label for="quality">
|
||||||
Quality
|
Quality {{ this.userPreferences['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"
|
||||||
|
|||||||
@@ -115,7 +115,10 @@
|
|||||||
<twig:Filter results="{{ results }}" filter="{{ filter }}" />
|
<twig:Filter results="{{ results }}" filter="{{ filter }}" />
|
||||||
|
|
||||||
{% if "movies" == results.media.mediaType %}
|
{% if "movies" == results.media.mediaType %}
|
||||||
<div class="results" {{ stimulus_controller('movie_results', {title: results.media.title, tmdbId: results.media.tmdbId, imdbId: results.media.imdbId}) }}>
|
<div class="results"
|
||||||
|
{{ stimulus_controller('movie_results', {title: results.media.title, tmdbId: results.media.tmdbId, imdbId: results.media.imdbId}) }}
|
||||||
|
data-movie-results-loading-icon-outlet=".loading-icon"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
{% elseif "tvshows" == results.media.mediaType %}
|
{% elseif "tvshows" == results.media.mediaType %}
|
||||||
<twig:TvEpisodeList
|
<twig:TvEpisodeList
|
||||||
|
|||||||
@@ -7,6 +7,20 @@
|
|||||||
<twig:Card title="Media Preferences" class="w-full">
|
<twig:Card title="Media Preferences" class="w-full">
|
||||||
<p class="text-gray-50 mb-2">Define a filter to be pre-applied to your download options.</p>
|
<p class="text-gray-50 mb-2">Define a filter to be pre-applied to your download options.</p>
|
||||||
<form id="media_preferences" class="flex flex-col max-w-64" name="media_preferences" method="post" action="{{ path('app_save_media_preferences') }}">
|
<form id="media_preferences" class="flex flex-col max-w-64" name="media_preferences" method="post" action="{{ path('app_save_media_preferences') }}">
|
||||||
|
<label class="text-gray-50" for="quality">Quality</label>
|
||||||
|
<select class="p-1.5 rounded-md mb-2" name="quality" id="quality" value="{{ mediaPreferences['quality'].getPreferenceValue() }}">
|
||||||
|
<option class="text-gray-800"
|
||||||
|
value=""
|
||||||
|
{{ mediaPreferences['quality'].getPreferenceValue() is null ? "selected" }}
|
||||||
|
>n/a</option>
|
||||||
|
{% for quality in qualities %}
|
||||||
|
<option class="text-gray-800"
|
||||||
|
value="{{ quality }}"
|
||||||
|
{{ quality == mediaPreferences['quality'].getPreferenceValue() ? "selected" }}
|
||||||
|
>{{ quality }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
|
||||||
<label class="text-gray-50" for="resolution">Resolution</label>
|
<label class="text-gray-50" for="resolution">Resolution</label>
|
||||||
<select class="p-1.5 rounded-md mb-2" name="resolution" id="resolution" value="{{ mediaPreferences['resolution'].getPreferenceValue() }}">
|
<select class="p-1.5 rounded-md mb-2" name="resolution" id="resolution" value="{{ mediaPreferences['resolution'].getPreferenceValue() }}">
|
||||||
<option class="text-gray-800"
|
<option class="text-gray-800"
|
||||||
|
|||||||
Reference in New Issue
Block a user