Update to v0.5.0 — Prowlarr match UX improvements

This commit is contained in:
Procuria committed 2026-04-06 23:18:27 +02:00
1 parent c483ac0baa
commit a04cc221ea
3 files changed
+143 -15

No files matched your search

+21
View File
@@ -4,6 +4,27 @@ All notable changes to the DarkPeers Mod Queue Helper will be documented in this
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
## [0.5.0] - 2026-04-06
### Added
- **Preferred indexer selection** — new `preferredIndexers` setting (comma-separated list in Settings panel) allows moderators to specify trusted indexers. When multiple indexers return the same release (tied relevance scores), preferred indexers are selected first. Preference is strictly a tiebreaker — never overrides a clearly better match from a non-preferred indexer.
- **Best match link** — best match title now links to the source tracker page via Prowlarr's `infoUrl` field (opens in new tab). Link omitted gracefully when URL unavailable.
- **Field comparison detail** — collapsible "Comparison details" section shows per-field match status (title, year, resolution, source, video codec, audio codec), self-consistency check results (folder ✓/✗, filename ✓/✗), and alternative indexers.
- **Alternative indexers** — up to 3 alternative indexers shown in detail section ("Also found on: BLU, TL")
### Changed
- **Explainability rewrite** — replaced vague "Title consistent with indexed release" with specific moderation summaries:
- `match`: "Name matches release on {indexer} — title, year, resolution, codecs all consistent"
- `likely_match`: "Name likely matches release on {indexer} — minor field differences"
- `uncertain`: "No strong match found — cannot verify release name automatically"
- `likely_renamed`: "Possible rename — {specific issue}"
- `renamed`: "Likely renamed — folder and filename both differ from torrent name"
- **Rename issue labels** — replaced misleading "expected/found" framing with "Torrent name: / Folder name:" to avoid implying the torrent name is the authoritative source
- **Header wording** — "Found on N indexer(s)" replaced with "Found on {indexer}" (single) or "Best match from {indexer} (N indexers total)" (multiple)
- **Match selection algorithm** — replaced single-pass highest-score selection with candidate-based ranking: relevance score (descending, 0.01 epsilon for ties) → preferred indexer rank → seeders (descending)
## [0.4.1] - 2026-04-06 ## [0.4.1] - 2026-04-06
### Fixed ### Fixed
+5 -1
View File
@@ -19,4 +19,8 @@ Tampermonkey checks for updates automatically. To force a check: Tampermonkey ic
## Optional: Prowlarr Integration ## Optional: Prowlarr Integration
Open the settings via Tampermonkey menu > **ModQ Helper Settings** and enter your Prowlarr URL and API key to enable cross-seed detection. Open the settings via Tampermonkey menu > **ModQ Helper Settings** and enter your Prowlarr URL and API key to enable indexer-backed rename detection.
### Preferred Indexers
In the settings panel you can optionally set a comma-separated list of preferred indexers (e.g. `Aither, BLU`). When multiple indexers return the same release, the preferred one is shown as the best match. This is a tiebreaker only — a clearly better match from another indexer still wins.
+117 -14
View File
@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name UNIT3D Mod Queue Helper — DarkPeers // @name UNIT3D Mod Queue Helper — DarkPeers
// @namespace https://gitea.computerliebe.org/Procuria/dp-modq-helper // @namespace https://gitea.computerliebe.org/Procuria/dp-modq-helper
// @version 0.4.1 // @version 0.5.0
// @description Quality-gate checks for DarkPeers — extended moderation rules, title validation, SRRDB & Prowlarr integrations // @description Quality-gate checks for DarkPeers — extended moderation rules, title validation, SRRDB & Prowlarr integrations
// @author TQG Contributors // @author TQG Contributors
// @updateURL https://gitea.computerliebe.org/Procuria/dp-modq-helper/raw/branch/main/modq-helper-darkpeers.user.js // @updateURL https://gitea.computerliebe.org/Procuria/dp-modq-helper/raw/branch/main/modq-helper-darkpeers.user.js
@@ -1226,7 +1226,7 @@ let _resolvedModStatuses = DEFAULT_MOD_STATUSES;
const Settings = { const Settings = {
_KEY: "modq_settings", _KEY: "modq_settings",
_defaults: { _defaults: {
prowlarr: { url: "", apiKey: "", enabled: false }, prowlarr: { url: "", apiKey: "", enabled: false, preferredIndexers: [] },
srrdb: { enabled: true }, srrdb: { enabled: true },
checks: { checks: {
tmdbMatch: true, seasonEpisode: true, namingGuide: true, tmdbMatch: true, seasonEpisode: true, namingGuide: true,
@@ -1349,6 +1349,12 @@ const Settings = {
<input type="password" data-setting="prowlarr.apiKey" value="${s.prowlarr.apiKey}" placeholder="API key" <input type="password" data-setting="prowlarr.apiKey" value="${s.prowlarr.apiKey}" placeholder="API key"
style="background:#1e293b;border:1px solid #334155;color:#e2e8f0;border-radius:4px;padding:4px 8px;font-size:12px;"> style="background:#1e293b;border:1px solid #334155;color:#e2e8f0;border-radius:4px;padding:4px 8px;font-size:12px;">
</label> </label>
<label style="display:flex;flex-direction:column;gap:4px;margin:6px 0;color:#cbd5e1;font-size:13px;">
Preferred indexers:
<input type="text" data-setting="prowlarr.preferredIndexers" value="${(s.prowlarr.preferredIndexers || []).join(", ")}" placeholder="e.g. Aither, BLU (most preferred first)"
style="background:#1e293b;border:1px solid #334155;color:#e2e8f0;border-radius:4px;padding:4px 8px;font-size:12px;">
<small style="color:#64748b;font-size:11px;">Comma-separated. When tied matches exist on multiple indexers, prefer these.</small>
</label>
</fieldset> </fieldset>
<fieldset style="border:1px solid #334155;border-radius:6px;padding:12px;margin-bottom:12px;"> <fieldset style="border:1px solid #334155;border-radius:6px;padding:12px;margin-bottom:12px;">
@@ -1401,9 +1407,13 @@ const Settings = {
const s = self.load(); const s = self.load();
modal.querySelectorAll("[data-setting]").forEach(el => { modal.querySelectorAll("[data-setting]").forEach(el => {
const key = el.getAttribute("data-setting"); const key = el.getAttribute("data-setting");
const val = el.type === "checkbox" ? el.checked let val = el.type === "checkbox" ? el.checked
: el.type === "number" ? parseInt(el.value, 10) : el.type === "number" ? parseInt(el.value, 10)
: el.value; : el.value;
// Parse comma-separated list settings into arrays
if (key === "prowlarr.preferredIndexers") {
val = typeof val === "string" ? val.split(",").map(s => s.trim()).filter(Boolean) : [];
}
const parts = key.split("."); const parts = key.split(".");
let target = s; let target = s;
for (let i = 0; i < parts.length - 1; i++) { for (let i = 0; i < parts.length - 1; i++) {
@@ -3915,19 +3925,70 @@ const RenameDetector = {
}, },
/** /**
* findBestMatch — Select the best Prowlarr result by relevance score. * _indexerRank — Return preference rank for an indexer name.
* Lower = more preferred. Infinity = not in preference list.
*/ */
findBestMatch(uploadTokens, results) { _indexerRank(indexerName, preferredList) {
let best = null; if (!preferredList || preferredList.length === 0) return Infinity;
let bestScore = -1; const idx = preferredList.findIndex(
p => p.toLowerCase() === (indexerName || "").toLowerCase()
);
return idx === -1 ? Infinity : idx;
},
/**
* findBestMatch — Select the best Prowlarr result using candidate ranking.
*
* Sort order:
* 1. relevanceScore (descending) — scores within 0.01 epsilon are ties
* 2. preferredIndexer rank (ascending — lower = more preferred)
* 3. seeders (descending — liveness tiebreaker)
*
* Also tracks up to 3 alternative candidates (score > 0.50) for display.
*/
findBestMatch(uploadTokens, results, preferredIndexers) {
const EPSILON = 0.01;
const candidates = [];
for (const r of results) { for (const r of results) {
const tokens = this.tokenize(r.title || ""); const tokens = this.tokenize(r.title || "");
const score = this.scoreMatch(uploadTokens, tokens); const score = this.scoreMatch(uploadTokens, tokens);
if (score.relevanceScore > bestScore) { candidates.push({
bestScore = score.relevanceScore; title: r.title, indexer: r.indexer, size: r.size,
best = { title: r.title, indexer: r.indexer, size: r.size, tokens, score, relevanceScore: score.relevanceScore }; infoUrl: r.infoUrl || null, guid: r.guid || null, seeders: r.seeders || 0,
tokens, score, relevanceScore: score.relevanceScore,
});
}
if (candidates.length === 0) return null;
const prefs = Array.isArray(preferredIndexers) ? preferredIndexers : [];
candidates.sort((a, b) => {
// Primary: relevanceScore descending (ties within epsilon)
const scoreDiff = b.relevanceScore - a.relevanceScore;
if (Math.abs(scoreDiff) > EPSILON) return scoreDiff;
// Secondary: preferred indexer rank ascending
const rankA = this._indexerRank(a.indexer, prefs);
const rankB = this._indexerRank(b.indexer, prefs);
if (rankA !== rankB) return rankA - rankB;
// Tertiary: seeders descending
return (b.seeders || 0) - (a.seeders || 0);
});
const best = candidates[0];
// Collect alternatives: distinct indexers, score > 0.50, not the best match
const seen = new Set([best.indexer]);
const alternatives = [];
for (let i = 1; i < candidates.length && alternatives.length < 3; i++) {
const c = candidates[i];
if (c.relevanceScore >= 0.50 && !seen.has(c.indexer)) {
seen.add(c.indexer);
alternatives.push({ indexer: c.indexer, title: c.title, relevanceScore: c.relevanceScore });
} }
} }
best.alternatives = alternatives;
return best; return best;
}, },
@@ -4164,7 +4225,30 @@ const U={getStatusIcon(e){switch(e){case"pass":return'<i class="fas fa-check-cir
</div> </div>
<div id="mh-filename-result" class="mh-filename-result"></div> <div id="mh-filename-result" class="mh-filename-result"></div>
</div> </div>
<div class="panel__body mh-body">${T}${this._buildIntegrationPlaceholders(e)}</div>`,n},injectPanel(e){const n=E.getModerationPanel();if(n)n.parentNode.insertBefore(e,n);else{const t=document.querySelector(_resolvedSelectors.torrentTags);t&&t.parentNode.insertBefore(e,t.nextSibling)}this.attachEvents(e)},attachEvents(e){const n=e.querySelector("#mh-toggle-all");if(n){let D=!1;n.addEventListener("click",()=>{D=!D,e.querySelectorAll(".mh-accordion, .mh-section").forEach(x=>x.open=D),n.querySelector("i").className=D?"fas fa-angles-up":"fas fa-angles-down",n.title=D?"Collapse all sections":"Expand all sections"})}const t=e.querySelector("#mh-corrective-text"),s=e.querySelector("#mh-corrective-editor");t&&s&&(t.addEventListener("click",()=>{t.style.display="none",s.style.display="block",s.focus()}),s.addEventListener("blur",()=>{t.textContent=s.value,t.style.display="",s.style.display=""}));const a=()=>s?s.value:"",o=e.querySelector("#mh-copy-message");o&&o.addEventListener("click",()=>{const D=a();navigator.clipboard.writeText(D).then(()=>{const x=o.querySelector("i");x.className="fas fa-check",o.classList.add("mh-btn--success"),setTimeout(()=>{x.className="fas fa-copy",o.classList.remove("mh-btn--success")},2e3)})});const c=D=>{const x=document.querySelectorAll(_resolvedSelectors.moderationForms);for(const p of x){const y=p.querySelector(_resolvedSelectors.moderationStatus);if(y&&y.value===D)return p.querySelector(_resolvedSelectors.moderationMessage)}return null},r=(D,x)=>{const p=e.querySelector(D);p&&p.addEventListener("click",()=>{const y=a(),C=c(x);if(C){C.value=y,C.dispatchEvent(new Event("input",{bubbles:!0}));const h=p.querySelector("i");h.className="fas fa-check",p.classList.add("mh-btn--success"),setTimeout(()=>{h.className="fas fa-paste",p.classList.remove("mh-btn--success")},2e3)}else{const h=p.querySelector("i");h.className="fas fa-xmark",p.classList.add("mh-btn--fail"),setTimeout(()=>{h.className="fas fa-paste",p.classList.remove("mh-btn--fail")},2e3)}})};r("#mh-fill-postpone",_resolvedModStatuses.postpone),r("#mh-fill-reject",_resolvedModStatuses.reject);const d=e.querySelector("#mh-filename-compare-btn"),f=e.querySelector("#mh-filename-block"),A=e.querySelector("#mh-filename-uploaded"),T=e.querySelector("#mh-filename-input"),b=e.querySelector("#mh-filename-run"),u=e.querySelector("#mh-filename-result");if(d&&f&&d.addEventListener("click",()=>{const D=f.style.display!=="none";if(f.style.display=D?"none":"",d.classList.toggle("mh-btn--active",!D),!D&&A){const x=E.getMediaInfoFilename()||"(not found)";A.textContent=x}}),b&&T&&u){const D=()=>{const x=T.value.trim();if(!x){u.innerHTML='<span class="mh-diff-error">Please enter a reference filename.</span>';return}const p=E.getMediaInfoFilename();if(!p||p==="(not found)"){u.innerHTML='<span class="mh-diff-error">Could not read MediaInfo filename from page.</span>';return}const y=z.diff(x,p);u.innerHTML=z.renderDiff(y)};b.addEventListener("click",D),T.addEventListener("keydown",x=>{x.key==="Enter"&&D()})}},_buildIntegrationPlaceholders(results){if(!results.nogroup&&!results.dpTitle)return"";return`<div class="mh-section-group"><details class="mh-section" open><summary class="mh-section__header"><i class="fas fa-plug mh-section__icon"></i><span class="mh-section__title">External Integrations</span></summary><div class="mh-section__body"><div data-integration="srrdb" class="mh-integration mh-integration--loading"><span class="mh-integration__icon"><i class="fas fa-spinner fa-spin"></i></span><span class="mh-integration__label">SRRDB</span><span class="mh-integration__msg">Checking scene database...</span></div><div data-integration="prowlarr" class="mh-integration mh-integration--loading"><span class="mh-integration__icon"><i class="fas fa-spinner fa-spin"></i></span><span class="mh-integration__label">Prowlarr</span><span class="mh-integration__msg">Searching indexers...</span></div></div></details></div>`},renderIntegrationResult(name,result){const esc=(s)=>String(s||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");if(result.error){return`<div class="mh-integration mh-integration--warn"><span class="mh-integration__icon"><i class="fas fa-exclamation-triangle mh-icon--warn"></i></span><span class="mh-integration__label">${esc(name)}</span><span class="mh-integration__msg">${esc(result.error)}</span></div>`}if(result.notConfigured){return`<div class="mh-integration mh-integration--na"><span class="mh-integration__icon"><i class="fas fa-minus-circle mh-icon--na"></i></span><span class="mh-integration__label">${esc(name)}</span><span class="mh-integration__msg">Not configured — open ModQ Helper Settings</span></div>`}if(name==="SRRDB"){if(!result.found){return`<div class="mh-integration mh-integration--na"><span class="mh-integration__icon"><i class="fas fa-minus-circle mh-icon--na"></i></span><span class="mh-integration__label">SRRDB</span><span class="mh-integration__msg">Not found — may not be a scene release</span></div>Line truncated <div class="panel__body mh-body">${T}${this._buildIntegrationPlaceholders(e)}</div>`,n},injectPanel(e){const n=E.getModerationPanel();if(n)n.parentNode.insertBefore(e,n);else{const t=document.querySelector(_resolvedSelectors.torrentTags);t&&t.parentNode.insertBefore(e,t.nextSibling)}this.attachEvents(e)},attachEvents(e){const n=e.querySelector("#mh-toggle-all");if(n){let D=!1;n.addEventListener("click",()=>{D=!D,e.querySelectorAll(".mh-accordion, .mh-section").forEach(x=>x.open=D),n.querySelector("i").className=D?"fas fa-angles-up":"fas fa-angles-down",n.title=D?"Collapse all sections":"Expand all sections"})}const t=e.querySelector("#mh-corrective-text"),s=e.querySelector("#mh-corrective-editor");t&&s&&(t.addEventListener("click",()=>{t.style.display="none",s.style.display="block",s.focus()}),s.addEventListener("blur",()=>{t.textContent=s.value,t.style.display="",s.style.display=""}));const a=()=>s?s.value:"",o=e.querySelector("#mh-copy-message");o&&o.addEventListener("click",()=>{const D=a();navigator.clipboard.writeText(D).then(()=>{const x=o.querySelector("i");x.className="fas fa-check",o.classList.add("mh-btn--success"),setTimeout(()=>{x.className="fas fa-copy",o.classList.remove("mh-btn--success")},2e3)})});const c=D=>{const x=document.querySelectorAll(_resolvedSelectors.moderationForms);for(const p of x){const y=p.querySelector(_resolvedSelectors.moderationStatus);if(y&&y.value===D)return p.querySelector(_resolvedSelectors.moderationMessage)}return null},r=(D,x)=>{const p=e.querySelector(D);p&&p.addEventListener("click",()=>{const y=a(),C=c(x);if(C){C.value=y,C.dispatchEvent(new Event("input",{bubbles:!0}));const h=p.querySelector("i");h.className="fas fa-check",p.classList.add("mh-btn--success"),setTimeout(()=>{h.className="fas fa-paste",p.classList.remove("mh-btn--success")},2e3)}else{const h=p.querySelector("i");h.className="fas fa-xmark",p.classList.add("mh-btn--fail"),setTimeout(()=>{h.className="fas fa-paste",p.classList.remove("mh-btn--fail")},2e3)}})};r("#mh-fill-postpone",_resolvedModStatuses.postpone),r("#mh-fill-reject",_resolvedModStatuses.reject);const d=e.querySelector("#mh-filename-compare-btn"),f=e.querySelector("#mh-filename-block"),A=e.querySelector("#mh-filename-uploaded"),T=e.querySelector("#mh-filename-input"),b=e.querySelector("#mh-filename-run"),u=e.querySelector("#mh-filename-result");if(d&&f&&d.addEventListener("click",()=>{const D=f.style.display!=="none";if(f.style.display=D?"none":"",d.classList.toggle("mh-btn--active",!D),!D&&A){const x=E.getMediaInfoFilename()||"(not found)";A.textContent=x}}),b&&T&&u){const D=()=>{const x=T.value.trim();if(!x){u.innerHTML='<span class="mh-diff-error">Please enter a reference filename.</span>';return}const p=E.getMediaInfoFilename();if(!p||p==="(not found)"){u.innerHTML='<span class="mh-diff-error">Could not read MediaInfo filename from page.</span>';return}const y=z.diff(x,p);u.innerHTML=z.renderDiff(y)};b.addEventListener("click",D),T.addEventListener("keydown",x=>{x.key==="Enter"&&D()})}},_buildIntegrationPlaceholders(results){if(!results.nogroup&&!results.dpTitle)return"";return`<div class="mh-section-group"><details class="mh-section" open><summary class="mh-section__header"><i class="fas fa-plug mh-section__icon"></i><span class="mh-section__title">External Integrations</span></summary><div class="mh-section__body"><div data-integration="srrdb" class="mh-integration mh-integration--loading"><span class="mh-integration__icon"><i class="fas fa-spinner fa-spin"></i></span><span class="mh-integration__label">SRRDB</span><span class="mh-integration__msg">Checking scene database...</span></div><div data-integration="prowlarr" class="mh-integration mh-integration--loading"><span class="mh-integration__icon"><i class="fas fa-spinner fa-spin"></i></span><span class="mh-integration__label">Prowlarr</span><span class="mh-integration__msg">Searching indexers...</span></div></div></details></div>`},renderIntegrationResult(name,result){const esc=(s)=>String(s||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");if(result.error){return`<div class="mh-integration mh-integration--warn"><span class="mh-integration__icon"><i class="fas fa-exclamation-triangle mh-icon--warn"></i></span><span class="mh-integration__label">${esc(name)}</span><span class="mh-integration__msg">${esc(result.error)}</span></div>`}if(result.notConfigured){return`<div class="mh-integration mh-integration--na"><span class="mh-integration__icon"><i class="fas fa-minus-circle mh-icon--na"></i></span><span class="mh-integration__label">${esc(name)}</span><span class="mh-integration__msg">Not configured — open ModQ Helper Settings</span></div>`}if(name==="SRRDB"){if(!result.found){return`<div class="mh-integration mh-integration--na"><span class="mh-integration__icon"><i class="fas fa-minus-circle mh-icon--na"></i></span><span class="mh-integration__label">SRRDB</span><span class="mh-integration__msg">Not found — may not be a scene release</span></div>Line truncated
// Best match title with optional link
const titleText=esc(bestMatch.title);const indexerText=esc(bestMatch.indexer);const linkHtml=bestMatch.infoUrl?` <a href="${esc(bestMatch.infoUrl)}" target="_blank" rel="noopener" title="Open on ${indexerText}" class="mh-integration__link"><i class="fas fa-external-link-alt"></i></a>`:"";
matchHtml+=`<div class="mh-integration__detail"><strong>Best match:</strong> ${titleText} <span class="mh-integration__indexer">[${indexerText}]</span>${linkHtml}</div>`;
// Summary line — specific to confidence level
const summaryMessages={"match":`Name matches release on ${indexerText} — title, year, resolution, codecs all consistent`,"likely_match":`Name likely matches release on ${indexerText} — minor field differences`,"uncertain":"No strong match found — cannot verify release name automatically","likely_renamed":issues.length>0?`Possible rename — ${issues[0].type==="folder"?"folder name differs from torrent name":"filename differs from torrent name"}`:"Possible rename detected — review filenames","renamed":"Likely renamed — folder and filename both differ from torrent name"};
const summaryIcons={"match":"check-circle mh-icon--pass","likely_match":"check-circle mh-icon--pass","uncertain":"info-circle mh-icon--advisory","likely_renamed":"exclamation-triangle mh-icon--warn","renamed":"exclamation-triangle mh-icon--warn"};
const summaryClasses={"match":"pass","likely_match":"pass","uncertain":"advisory","likely_renamed":"warn","renamed":"warn"};
matchHtml+=`<div class="mh-integration__detail mh-integration__detail--${summaryClasses[confLevel]||"advisory"}"><i class="fas fa-${summaryIcons[confLevel]||"info-circle mh-icon--advisory"}"></i> ${summaryMessages[confLevel]||"Review manually"}</div>`;
// Rename issues — reframed labels
if(confLevel==="likely_renamed"||confLevel==="renamed"){const issueItems=issues.map(i=>{if(i.type==="folder")return`<li>Torrent name: <code>${esc(i.expected)}</code><br>Folder name: <code>${esc(i.found)}</code></li>`;if(i.type==="filename")return`<li>Torrent name: <code>${esc(i.expected)}</code><br>Filename: <code>${esc(i.found)}</code></li>`;return`<li><code>${esc(i.expected)}</code> vs <code>${esc(i.found)}</code></li>`}).join("");if(issueItems)matchHtml+=`<ul class="mh-integration__diffs">${issueItems}</ul>`}
// Group note
if(conf.note&&confLevel!=="likely_renamed"&&confLevel!=="renamed"){matchHtml+=`<div class="mh-integration__detail mh-integration__detail--note"><small>${esc(conf.note)}</small></div>`}
// Collapsible field comparison detail
const fieldLabels={titleName:"Title",year:"Year",resolution:"Resolution",source:"Source",vcodec:"Video codec",acodec:"Audio codec"};const fieldEntries=Object.entries(fs).filter(([k])=>fieldLabels[k]);if(fieldEntries.length>0){let detailRows=fieldEntries.map(([k,v])=>{const label=fieldLabels[k];const icon=v>=1.0?'<i class="fas fa-check mh-icon--pass"></i>':v>0?'<i class="fas fa-minus mh-icon--warn"></i>':'<i class="fas fa-times mh-icon--fail"></i>';return`<div class="mh-field-row">${icon} <span class="mh-field-label">${label}</span></div>`}).join("");
// Self-consistency summary
const selfIssues=issues.filter(i=>i.severity==="high");const folderOk=!selfIssues.some(i=>i.type==="folder");const fileOk=!selfIssues.some(i=>i.type==="filename");detailRows+=`<div class="mh-field-row mh-field-row--self"><small>Self-check: folder ${folderOk?"✓":"✗"} · filename ${fileOk?"✓":"✗"}</small></div>`;
// Alternatives
if(alts.length>0){const altNames=alts.map(a=>esc(a.indexer)).join(", ");detailRows+=`<div class="mh-field-row mh-field-row--alts"><small>Also found on: ${altNames}</small></div>`}
matchHtml+=`<details class="mh-integration__expand"><summary class="mh-integration__expand-trigger"><small>Comparison details</small></summary><div class="mh-integration__fields">${detailRows}</div></details>`}}
const prowlStatusMap={"match":"pass","likely_match":"pass","uncertain":"advisory","likely_renamed":"warn","renamed":"warn"};const prowlIconMap={"match":"check-circle mh-icon--pass","likely_match":"check-circle mh-icon--pass","uncertain":"info-circle mh-icon--advisory","likely_renamed":"exclamation-triangle mh-icon--warn","renamed":"exclamation-triangle mh-icon--warn"};const confLevel=bestMatch?.confidence?.level||"uncertain";const prowlStatus=prowlStatusMap[confLevel]||"advisory";const prowlIcon=prowlIconMap[confLevel]||"info-circle mh-icon--advisory";
// Header: precise indexer wording
const headerMsg=count===1?`Found on ${esc(bestMatch?.indexer||"1 indexer")}`:`Best match from ${esc(bestMatch?.indexer||"unknown")} (${count} indexers total)`;
return`<div class="mh-integration mh-integration--${prowlStatus}"><span class="mh-integration__icon"><i class="fas fa-${prowlIcon}"></i></span><span class="mh-integration__label">Prowlarr</span><span class="mh-integration__msg">${headerMsg}</span>${matchHtml}</div>`}return`<div class="mh-integration mh-integration--na"><span class="mh-integration__icon"><i class="fas fa-info-circle mh-icon--na"></i></span><span class="mh-integration__label">${esc(name)}</span><span class="mh-integration__msg">${result.found?"Found":"Not found"}</span></div>`}};
/* ======================================================================== /* ========================================================================
* CSS — Panel styles (injected via GM_addStyle) * CSS — Panel styles (injected via GM_addStyle)
@@ -4740,6 +4824,22 @@ const Z=`
.mh-integration__diffs { margin: 4px 0 0 16px; padding: 0; list-style: disc; font-size: 11px; } .mh-integration__diffs { margin: 4px 0 0 16px; padding: 0; list-style: disc; font-size: 11px; }
.mh-integration__compare { margin-top: 4px; font-size: 11px; opacity: 0.85; } .mh-integration__compare { margin-top: 4px; font-size: 11px; opacity: 0.85; }
.mh-integration__compare div { padding: 2px 0; } .mh-integration__compare div { padding: 2px 0; }
.mh-integration__detail--advisory { color: rgba(96, 165, 250, 0.80); }
.mh-integration__detail--note { color: var(--text-color, #8c8c8c); }
.mh-integration__link { color: rgba(96, 165, 250, 0.70); text-decoration: none; margin-left: 4px; font-size: 11px; }
.mh-integration__link:hover { color: rgba(96, 165, 250, 1); }
.mh-integration__expand { margin-top: 6px; }
.mh-integration__expand-trigger { cursor: pointer; list-style: none; color: rgba(96, 165, 250, 0.70); user-select: none; }
.mh-integration__expand-trigger::-webkit-details-marker,
.mh-integration__expand-trigger::marker { display: none; }
.mh-integration__expand-trigger::before { content: "▸ "; }
.mh-integration__expand[open] > .mh-integration__expand-trigger::before { content: "▾ "; }
.mh-integration__fields { padding: 4px 0 0 8px; }
.mh-field-row { font-size: 11px; padding: 1px 0; color: var(--text-color, #cbd5e1); display: flex; align-items: center; gap: 4px; }
.mh-field-row i { font-size: 10px; width: 12px; text-align: center; }
.mh-field-label { min-width: 80px; }
.mh-field-row--self { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(59, 61, 62, 0.40); color: var(--text-color, #8c8c8c); }
.mh-field-row--alts { color: var(--text-color, #8c8c8c); }
`;; `;;
/* ======================================================================== /* ========================================================================
@@ -4911,7 +5011,8 @@ function main() {
const searchResult = await Integrations.prowlarr.search(settings.prowlarr, tvScope.searchQuery); const searchResult = await Integrations.prowlarr.search(settings.prowlarr, tvScope.searchQuery);
if (searchResult.found && searchResult.results.length > 0) { if (searchResult.found && searchResult.results.length > 0) {
const bestMatch = RenameDetector.findBestMatch(uploadTokens, searchResult.results); const preferredIndexers = settings.prowlarr?.preferredIndexers || [];
const bestMatch = RenameDetector.findBestMatch(uploadTokens, searchResult.results, preferredIndexers);
if (bestMatch) { if (bestMatch) {
const assessment = RenameDetector.assessRename(data, bestMatch, tvScope); const assessment = RenameDetector.assessRename(data, bestMatch, tvScope);
@@ -4919,9 +5020,11 @@ function main() {
title: bestMatch.title, title: bestMatch.title,
indexer: bestMatch.indexer, indexer: bestMatch.indexer,
size: bestMatch.size, size: bestMatch.size,
infoUrl: bestMatch.infoUrl,
uploadedTitle: data.torrentName, uploadedTitle: data.torrentName,
relevanceScore: bestMatch.relevanceScore, relevanceScore: bestMatch.relevanceScore,
confidence: assessment, confidence: assessment,
alternatives: bestMatch.alternatives || [],
}; };
} }
} }