Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ namespace Jellyfin.Plugin.SeerrFin.Configuration.Advanced;

public class AdvancedRequestModalSettings
{
public bool AllowQualityProfileSelection { get; set; } = true;

public bool TvSeasonPickerEnabled { get; set; } = true;

public bool IncludeSpecialsSeason { get; set; }

public bool RequireExplicitSeasonSelection { get; set; }

public bool ShowRequest4kButton { get; set; } = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public static object BuildFrontendPayload(PluginConfiguration config)
},
requestModal = new
{
allowQualityProfileSelection = advanced.RequestModal.AllowQualityProfileSelection,
tvSeasonPickerEnabled = advanced.RequestModal.TvSeasonPickerEnabled,
includeSpecialsSeason = advanced.RequestModal.IncludeSpecialsSeason,
requireExplicitSeasonSelection = advanced.RequestModal.RequireExplicitSeasonSelection,
Expand Down Expand Up @@ -271,4 +272,4 @@ public static Dictionary<string, string[]> GetQualityLabelAliases(PluginConfigur

return merged;
}
}
}
12 changes: 11 additions & 1 deletion src/Jellyfin.Plugin.SeerrFin/Configuration/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1403,10 +1403,17 @@
<span class="bst-subsection-chevron" aria-hidden="true">▼</span>
</button>
<div class="bst-card">
<div class="bst-toggle-row">
<div class="bst-toggle-copy">
<label class="bst-toggle-label" for="advAllowQualityProfileSelection">Allow users to choose quality</label>
<div class="bst-field-desc">When disabled, requests use the default Radarr or Sonarr profile configured in Seerr.</div>
</div>
<label class="bst-toggle"><input id="advAllowQualityProfileSelection" type="checkbox" checked /><span class="bst-toggle-slider"></span></label>
</div>
<div class="bst-toggle-row">
<div class="bst-toggle-copy">
<label class="bst-toggle-label" for="advTvSeasonPickerEnabled">TV season picker</label>
<div class="bst-field-desc">Show a season picker before choosing a quality profile for TV.</div>
<div class="bst-field-desc">Show a season picker before submitting a TV request.</div>
</div>
<label class="bst-toggle"><input id="advTvSeasonPickerEnabled" type="checkbox" checked /><span class="bst-toggle-slider"></span></label>
</div>
Expand Down Expand Up @@ -2344,6 +2351,7 @@ <h3 id="bstCustomizeModalTitle" class="bst-modal-title"></h3>
RefreshOnTabShow: true
},
RequestModal: {
AllowQualityProfileSelection: true,
TvSeasonPickerEnabled: true,
IncludeSpecialsSeason: false,
RequireExplicitSeasonSelection: false,
Expand Down Expand Up @@ -2446,6 +2454,7 @@ <h3 id="bstCustomizeModalTitle" class="bst-modal-title"></h3>
document.querySelector('#advSplitPartiallyAvailableFilter').checked = r.SplitPartiallyAvailableFilter === true;

const m = advanced.RequestModal;
document.querySelector('#advAllowQualityProfileSelection').checked = m.AllowQualityProfileSelection !== false;
document.querySelector('#advTvSeasonPickerEnabled').checked = m.TvSeasonPickerEnabled !== false;
document.querySelector('#advIncludeSpecialsSeason').checked = m.IncludeSpecialsSeason === true;
document.querySelector('#advRequireExplicitSeasonSelection').checked = m.RequireExplicitSeasonSelection === true;
Expand Down Expand Up @@ -2518,6 +2527,7 @@ <h3 id="bstCustomizeModalTitle" class="bst-modal-title"></h3>
RefreshOnTabShow: document.querySelector('#advRequestsRefreshOnTabShow').checked
},
RequestModal: {
AllowQualityProfileSelection: document.querySelector('#advAllowQualityProfileSelection').checked,
TvSeasonPickerEnabled: document.querySelector('#advTvSeasonPickerEnabled').checked,
IncludeSpecialsSeason: document.querySelector('#advIncludeSpecialsSeason').checked,
RequireExplicitSeasonSelection: document.querySelector('#advRequireExplicitSeasonSelection').checked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,12 @@ public async Task<ActionResult> MakeDiscoverRequest(
return Forbid();
}

bool allowQualityProfileSelection = AdvancedSettingsHelper
.Resolve(SeerrFinPlugin.Instance.Configuration)
.RequestModal
.AllowQualityProfileSelection;
(int statusCode, string body, string contentType) = await _requestService
.SubmitRequestAsync(username, payload, cancellationToken)
.SubmitRequestAsync(username, payload, allowQualityProfileSelection, cancellationToken)
.ConfigureAwait(false);

return new ContentResult
Expand Down
19 changes: 15 additions & 4 deletions src/Jellyfin.Plugin.SeerrFin/Inject/seerrfin-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ window.seerrFinLog = window.seerrFinLog || {
? plugin._displaySettings.Advanced.requestModal
: null;
return {
allowQualityProfileSelection: readAdvancedBool(modal && modal.allowQualityProfileSelection, true),
tvSeasonPickerEnabled: readAdvancedBool(modal && modal.tvSeasonPickerEnabled, true),
includeSpecialsSeason: readAdvancedBool(modal && modal.includeSpecialsSeason, false),
requireExplicitSeasonSelection: readAdvancedBool(modal && modal.requireExplicitSeasonSelection, false),
Expand Down Expand Up @@ -877,8 +878,9 @@ window.seerrFinLog = window.seerrFinLog || {
});
}

function renderQualityModalShell(is4k) {
const title = is4k ? 'Choose 4K quality profile' : 'Choose quality profile';
function renderQualityModalShell(is4k, useSeerrDefaults) {
const title = useSeerrDefaults ? 'Request' : (is4k ? 'Choose 4K quality profile' : 'Choose quality profile');
const loadingText = useSeerrDefaults ? 'Submitting request…' : 'Loading profiles…';
return `
<div class="bst-quality-wrapper">
<div class="bst-quality-backdrop"></div>
Expand All @@ -887,7 +889,7 @@ window.seerrFinLog = window.seerrFinLog || {
<h3 id="bst-quality-title">${title}</h3>
<button type="button" class="bst-quality-close" aria-label="Close">${CLOSE_ICON}</button>
</div>
<div class="bst-quality-list"><div class="bst-quality-loading">Loading profiles…</div></div>
<div class="bst-quality-list"><div class="bst-quality-loading">${loadingText}</div></div>
</div>
</div>`;
}
Expand Down Expand Up @@ -926,10 +928,11 @@ window.seerrFinLog = window.seerrFinLog || {
}

is4k = !!is4k;
const useSeerrDefaults = getRequestModalAdvanced().allowQualityProfileSelection === false;

// Show shell so the click feels instant (fill profiles when the api returns)
closeQualityModal();
document.body.insertAdjacentHTML('beforeend', renderQualityModalShell(is4k));
document.body.insertAdjacentHTML('beforeend', renderQualityModalShell(is4k, useSeerrDefaults));
activeQualityRoot = document.body.lastElementChild;

const list = activeQualityRoot.querySelector('.bst-quality-list');
Expand All @@ -951,6 +954,14 @@ window.seerrFinLog = window.seerrFinLog || {
list.innerHTML = `<div class="bst-quality-empty">${escapeHtml(message || 'Request failed')}</div>`;
}

if (useSeerrDefaults) {
submitRequest(mediaId, mediaType, {
is4k: is4k,
seasons: selectedSeasons
}, finishRequest, failRequest).catch(function () {});
return;
}

ApiClient.ajax({
url: ApiClient.getUrl('SeerrFin/request-options/' + mediaType),
type: 'GET',
Expand Down
1 change: 1 addition & 0 deletions src/Jellyfin.Plugin.SeerrFin/Inject/seerrfin-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ if (typeof window.seerrFinPlugin === 'undefined') {
refreshOnTabShow: self.readAdvancedBool(requests.refreshOnTabShow ?? requests.RefreshOnTabShow, true)
},
requestModal: {
allowQualityProfileSelection: self.readAdvancedBool(requestModal.allowQualityProfileSelection ?? requestModal.AllowQualityProfileSelection, true),
tvSeasonPickerEnabled: self.readAdvancedBool(requestModal.tvSeasonPickerEnabled ?? requestModal.TvSeasonPickerEnabled, true),
includeSpecialsSeason: self.readAdvancedBool(requestModal.includeSpecialsSeason ?? requestModal.IncludeSpecialsSeason, false),
requireExplicitSeasonSelection: self.readAdvancedBool(requestModal.requireExplicitSeasonSelection ?? requestModal.RequireExplicitSeasonSelection, false),
Expand Down
15 changes: 11 additions & 4 deletions src/Jellyfin.Plugin.SeerrFin/Services/JellyseerrRequestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ public RequestOptionsResult GetRequestOptionsResult(string username, string medi
};
}

public async Task<(int StatusCode, string Body, string ContentType)> SubmitRequestAsync(string username, DiscoverRequestPayload payload, CancellationToken cancellationToken)
public Task<(int StatusCode, string Body, string ContentType)> SubmitRequestAsync(string username, DiscoverRequestPayload payload, CancellationToken cancellationToken) =>
SubmitRequestAsync(username, payload, allowQualityProfileSelection: true, cancellationToken: cancellationToken);

public async Task<(int StatusCode, string Body, string ContentType)> SubmitRequestAsync(
string username,
DiscoverRequestPayload payload,
bool allowQualityProfileSelection,
CancellationToken cancellationToken)
{
PluginConfiguration config = SeerrFinPlugin.Instance.Configuration;
if (string.IsNullOrWhiteSpace(config.JellyseerrUrl) || string.IsNullOrWhiteSpace(config.JellyseerrApiKey))
Expand Down Expand Up @@ -104,8 +111,8 @@ public RequestOptionsResult GetRequestOptionsResult(string username, string medi
: "all";
}

// Only Advanced Requests can override Seerr defaults
if (HasRequestAdvanced(permissions))
// Only Advanced Requests can override Seerr defaults, and admins can disable profile selection for the request modal.
if (allowQualityProfileSelection && HasRequestAdvanced(permissions))
{
if (payload.ServerId != null)
{
Expand Down Expand Up @@ -314,4 +321,4 @@ public sealed class RequestOptionsResult
public bool CanRequestAdvanced { get; init; }

public JArray Options { get; init; } = new();
}
}