From 552d3a7c65ff2ee9014504befbfbc90f8e49aa97 Mon Sep 17 00:00:00 2001 From: Admin9705 <9705@duck.com> Date: Wed, 18 Feb 2026 09:14:02 -0500 Subject: [PATCH] Removed False Page Warnings --- frontend/static/css/components.css | 4 + frontend/static/css/import-media.css | 6 + frontend/static/js/dist/bundle-settings.js | 160 ++++++++++-------- .../features/settings/custom-formats.js | 30 ---- .../modules/features/settings/import-lists.js | 30 ---- .../settings/media-hunt-import-media.js | 100 +++++++++-- frontend/templates/components/scripts.html | 2 +- .../components/settings_sizes_section.html | 18 +- 8 files changed, 190 insertions(+), 160 deletions(-) diff --git a/frontend/static/css/components.css b/frontend/static/css/components.css index ba6825ae..67e5d9b6 100644 --- a/frontend/static/css/components.css +++ b/frontend/static/css/components.css @@ -401,6 +401,10 @@ background-color: var(--info-color); } +.notification.warning { + background: linear-gradient(135deg, #f59e0b, #d97706); +} + /* Placeholder messages */ .placeholder-message { display: flex; diff --git a/frontend/static/css/import-media.css b/frontend/static/css/import-media.css index dc6ad210..a87915bb 100644 --- a/frontend/static/css/import-media.css +++ b/frontend/static/css/import-media.css @@ -367,6 +367,12 @@ background: rgba(34, 197, 94, 0.3); } +.import-media-btn-confirm:disabled { + opacity: 0.5; + cursor: not-allowed; + pointer-events: none; +} + .import-media-btn-search { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; diff --git a/frontend/static/js/dist/bundle-settings.js b/frontend/static/js/dist/bundle-settings.js index 6c11fad8..5cbf8412 100644 --- a/frontend/static/js/dist/bundle-settings.js +++ b/frontend/static/js/dist/bundle-settings.js @@ -8070,36 +8070,6 @@ document.head.appendChild(styleEl); if (wrapperEl) wrapperEl.style.display = ''; return; } - var indexerCount = (results[4].indexers || []).length; - if (indexerCount === 0) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No indexers configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-import-lists-no-indexers'); - var noCliEl = document.getElementById('settings-import-lists-no-clients'); - var wrapperEl = document.getElementById('settings-import-lists-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = ''; - if (noCliEl) noCliEl.style.display = 'none'; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } - var hasClients = results[5].has_clients === true; - if (!hasClients) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No clients configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-import-lists-no-indexers'); - var noCliEl = document.getElementById('settings-import-lists-no-clients'); - var wrapperEl = document.getElementById('settings-import-lists-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = 'none'; - if (noCliEl) noCliEl.style.display = ''; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } combined.forEach(function(item) { var opt = document.createElement('option'); opt.value = item.value; @@ -9167,6 +9137,29 @@ document.head.appendChild(styleEl); 'use strict'; var PREFIX = 'media-hunt-import-media'; + var IMPORT_MEDIA_PAGE_SIZE = 48; + + function getImportMediaPosterUrl(posterPath, size) { + size = size || 'w92'; + if (!posterPath) return './static/images/blackout.jpg'; + var fullUrl = (posterPath.indexOf('http') === 0) ? posterPath : ('https://image.tmdb.org/t/p/' + size + (posterPath[0] === '/' ? posterPath : '/' + posterPath)); + if (window.tmdbImageCache && window.tmdbImageCache.enabled && window.tmdbImageCache.storage === 'server') { + return './api/tmdb/image?url=' + encodeURIComponent(fullUrl); + } + return fullUrl; + } + + function applyImportMediaCacheToImages(container) { + if (!container || !window.getCachedTMDBImage || !window.tmdbImageCache || !window.tmdbImageCache.enabled || window.tmdbImageCache.storage !== 'browser') return; + var imgs = container.querySelectorAll('img[src^="https://image.tmdb.org"]'); + imgs.forEach(function(img) { + var posterUrlVal = img.getAttribute('src'); + if (!posterUrlVal) return; + window.getCachedTMDBImage(posterUrlVal, window.tmdbImageCache).then(function(cachedUrl) { + if (cachedUrl && cachedUrl !== posterUrlVal) img.src = cachedUrl; + }).catch(function() {}); + }); + } window.MediaHuntImportMedia = { items: [], @@ -9174,6 +9167,7 @@ document.head.appendChild(styleEl); pollInterval: null, currentSearchFolderPath: null, importProgressAbort: false, + _importScrollObserver: null, getApiBase: function() { return this.mode === 'tv' ? './api/tv-hunt' : './api/movie-hunt'; @@ -9242,7 +9236,7 @@ document.head.appendChild(styleEl); confEl.className = 'import-progress-current-confidence ' + (score >= 70 ? 'high' : score >= 40 ? 'medium' : 'low'); } if (posterEl) { - var posterUrl = (currentItem.best_match && currentItem.best_match.poster_path) ? 'https://image.tmdb.org/t/p/w92' + currentItem.best_match.poster_path : './static/images/blackout.jpg'; + var posterUrl = (currentItem.best_match && currentItem.best_match.poster_path) ? getImportMediaPosterUrl(currentItem.best_match.poster_path, 'w92') : './static/images/blackout.jpg'; posterEl.innerHTML = ''; } } else { @@ -9504,9 +9498,52 @@ document.head.appendChild(styleEl); } listEl.innerHTML = ''; - for (var i = 0; i < this.items.length; i++) { - listEl.appendChild(self.createItemElement(this.items[i])); + self._importRenderedCount = 0; + self._appendImportMediaBatch(listEl); + self._setupImportMediaScrollLoad(listEl); + }, + + _appendImportMediaBatch: function(listEl) { + var self = this; + var start = self._importRenderedCount || 0; + var end = Math.min(start + IMPORT_MEDIA_PAGE_SIZE, self.items.length); + for (var i = start; i < end; i++) { + listEl.appendChild(self.createItemElement(self.items[i])); } + self._importRenderedCount = end; + applyImportMediaCacheToImages(listEl); + }, + + _setupImportMediaScrollLoad: function(listEl) { + var self = this; + if (self._importScrollObserver) { + self._importScrollObserver.disconnect(); + self._importScrollObserver = null; + } + if (self._importRenderedCount >= self.items.length) return; + + var sentinel = document.createElement('div'); + sentinel.className = 'import-media-scroll-sentinel'; + sentinel.setAttribute('aria-hidden', 'true'); + sentinel.style.cssText = 'height:1px;visibility:hidden;pointer-events:none;'; + listEl.appendChild(sentinel); + + self._importScrollObserver = new IntersectionObserver(function(entries) { + if (!entries[0] || !entries[0].isIntersecting) return; + if (self._importRenderedCount >= self.items.length) return; + self._importScrollObserver.disconnect(); + sentinel.remove(); + self._appendImportMediaBatch(listEl); + if (self._importRenderedCount < self.items.length) { + var newSentinel = document.createElement('div'); + newSentinel.className = 'import-media-scroll-sentinel'; + newSentinel.setAttribute('aria-hidden', 'true'); + newSentinel.style.cssText = 'height:1px;visibility:hidden;pointer-events:none;'; + listEl.appendChild(newSentinel); + self._importScrollObserver.observe(newSentinel); + } + }, { root: null, rootMargin: '200px', threshold: 0 }); + self._importScrollObserver.observe(sentinel); }, createItemElement: function(item) { @@ -9520,7 +9557,7 @@ document.head.appendChild(styleEl); if (item.status === 'matched' && item.best_match) { var m = item.best_match; - if (m.poster_path) posterUrl = 'https://image.tmdb.org/t/p/w92' + m.poster_path; + if (m.poster_path) posterUrl = getImportMediaPosterUrl(m.poster_path, 'w92'); var scoreClass = m.score >= 70 ? 'high' : (m.score >= 40 ? 'medium' : 'low'); matchHtml = '
' + '
' + self.escapeHtml(m.title) + '
' + @@ -9545,7 +9582,7 @@ document.head.appendChild(styleEl); var sizeStr = item.file_size ? self.formatSize(item.file_size) : ''; var qualityStr = item.parsed_quality || ''; - div.innerHTML = '
' + + div.innerHTML = '
' + '
' + '
' + self.escapeHtml(item.folder_name) + '
' + '
' + self.escapeHtml(item.folder_path || item.root_folder) + '
' + @@ -9557,7 +9594,13 @@ document.head.appendChild(styleEl); var confirmBtns = div.querySelectorAll('.import-media-btn-confirm'); for (var j = 0; j < confirmBtns.length; j++) { - confirmBtns[j].onclick = function() { self.confirmItem(this.getAttribute('data-path')); }; + confirmBtns[j].onclick = function() { + var btn = this; + var path = btn.getAttribute('data-path'); + if (btn.disabled) return; + btn.disabled = true; + self.confirmItem(path, btn); + }; } var searchBtns = div.querySelectorAll('.import-media-btn-search'); for (var j = 0; j < searchBtns.length; j++) { @@ -9617,7 +9660,7 @@ document.head.appendChild(styleEl); if (btn) { btn.disabled = false; btn.innerHTML = ' Scan Folders'; } }, - confirmItem: function(folderPath) { + confirmItem: function(folderPath, btn) { var self = this; var item = this.findItemByPath(folderPath); if (!item || !item.best_match) return; @@ -9643,7 +9686,12 @@ document.head.appendChild(styleEl); } else { if (window.huntarrUI && window.huntarrUI.showNotification) window.huntarrUI.showNotification(data.message || 'Import failed', data.already_exists ? 'info' : 'error'); if (data.already_exists) self.loadItems(); + if (btn) { btn.disabled = false; } } + }) + .catch(function() { + if (window.huntarrUI && window.huntarrUI.showNotification) window.huntarrUI.showNotification('Import failed.', 'error'); + if (btn) { btn.disabled = false; } }); }, @@ -9795,10 +9843,10 @@ document.head.appendChild(styleEl); var r = data.results[i]; var el = document.createElement('div'); el.className = 'import-media-search-result'; - var posterUrl = r.poster_path ? 'https://image.tmdb.org/t/p/w92' + r.poster_path : './static/images/blackout.jpg'; + var posterUrl = r.poster_path ? getImportMediaPosterUrl(r.poster_path, 'w92') : './static/images/blackout.jpg'; var overview = (r.overview || '').substring(0, 120); if (overview.length >= 120) overview += '...'; - el.innerHTML = '
' + + el.innerHTML = '
' + '
' + '
' + self.escapeHtml(r.title) + '
' + '
' + (r.year || 'N/A') + ' · ' + (r.vote_average || 0).toFixed(1) + '
' + @@ -9864,8 +9912,8 @@ document.head.appendChild(styleEl); var m = item.matches[i]; var el = document.createElement('div'); el.className = 'import-media-matches-dropdown-item'; - var posterUrl = m.poster_path ? 'https://image.tmdb.org/t/p/w92' + m.poster_path : './static/images/blackout.jpg'; - el.innerHTML = '
' + self.escapeHtml(m.title) + '
' + (m.year || '') + ' · ' + m.score + '%
'; + var posterUrl = m.poster_path ? getImportMediaPosterUrl(m.poster_path, 'w92') : './static/images/blackout.jpg'; + el.innerHTML = '
' + self.escapeHtml(m.title) + '
' + (m.year || '') + ' · ' + m.score + '%
'; (function(match) { el.onclick = function() { item.best_match = match; @@ -11331,36 +11379,6 @@ document.head.appendChild(styleEl); if (wrapperEl) wrapperEl.style.display = ''; return; } - var indexerCount = (results[4].indexers || []).length; - if (indexerCount === 0) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No indexers configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-custom-formats-no-indexers'); - var noCliEl = document.getElementById('settings-custom-formats-no-clients'); - var wrapperEl = document.getElementById('settings-custom-formats-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = ''; - if (noCliEl) noCliEl.style.display = 'none'; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } - var hasClients = results[5].has_clients === true; - if (!hasClients) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No clients configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-custom-formats-no-indexers'); - var noCliEl = document.getElementById('settings-custom-formats-no-clients'); - var wrapperEl = document.getElementById('settings-custom-formats-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = 'none'; - if (noCliEl) noCliEl.style.display = ''; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } combined.forEach(function(item) { var opt = document.createElement('option'); opt.value = item.value; diff --git a/frontend/static/js/modules/features/settings/custom-formats.js b/frontend/static/js/modules/features/settings/custom-formats.js index 3336f0e8..c8ef2cfc 100644 --- a/frontend/static/js/modules/features/settings/custom-formats.js +++ b/frontend/static/js/modules/features/settings/custom-formats.js @@ -174,36 +174,6 @@ if (wrapperEl) wrapperEl.style.display = ''; return; } - var indexerCount = (results[4].indexers || []).length; - if (indexerCount === 0) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No indexers configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-custom-formats-no-indexers'); - var noCliEl = document.getElementById('settings-custom-formats-no-clients'); - var wrapperEl = document.getElementById('settings-custom-formats-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = ''; - if (noCliEl) noCliEl.style.display = 'none'; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } - var hasClients = results[5].has_clients === true; - if (!hasClients) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No clients configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-custom-formats-no-indexers'); - var noCliEl = document.getElementById('settings-custom-formats-no-clients'); - var wrapperEl = document.getElementById('settings-custom-formats-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = 'none'; - if (noCliEl) noCliEl.style.display = ''; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } combined.forEach(function(item) { var opt = document.createElement('option'); opt.value = item.value; diff --git a/frontend/static/js/modules/features/settings/import-lists.js b/frontend/static/js/modules/features/settings/import-lists.js index f0dd61bd..e9c4f8b2 100644 --- a/frontend/static/js/modules/features/settings/import-lists.js +++ b/frontend/static/js/modules/features/settings/import-lists.js @@ -73,36 +73,6 @@ if (wrapperEl) wrapperEl.style.display = ''; return; } - var indexerCount = (results[4].indexers || []).length; - if (indexerCount === 0) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No indexers configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-import-lists-no-indexers'); - var noCliEl = document.getElementById('settings-import-lists-no-clients'); - var wrapperEl = document.getElementById('settings-import-lists-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = ''; - if (noCliEl) noCliEl.style.display = 'none'; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } - var hasClients = results[5].has_clients === true; - if (!hasClients) { - selectEl.innerHTML = ''; - var emptyOpt = document.createElement('option'); - emptyOpt.value = ''; - emptyOpt.textContent = 'No clients configured'; - selectEl.appendChild(emptyOpt); - var noIdxEl = document.getElementById('settings-import-lists-no-indexers'); - var noCliEl = document.getElementById('settings-import-lists-no-clients'); - var wrapperEl = document.getElementById('settings-import-lists-content-wrapper'); - if (noIdxEl) noIdxEl.style.display = 'none'; - if (noCliEl) noCliEl.style.display = ''; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } combined.forEach(function(item) { var opt = document.createElement('option'); opt.value = item.value; diff --git a/frontend/static/js/modules/features/settings/media-hunt-import-media.js b/frontend/static/js/modules/features/settings/media-hunt-import-media.js index fe9a3e89..001961da 100644 --- a/frontend/static/js/modules/features/settings/media-hunt-import-media.js +++ b/frontend/static/js/modules/features/settings/media-hunt-import-media.js @@ -6,6 +6,29 @@ 'use strict'; var PREFIX = 'media-hunt-import-media'; + var IMPORT_MEDIA_PAGE_SIZE = 48; + + function getImportMediaPosterUrl(posterPath, size) { + size = size || 'w92'; + if (!posterPath) return './static/images/blackout.jpg'; + var fullUrl = (posterPath.indexOf('http') === 0) ? posterPath : ('https://image.tmdb.org/t/p/' + size + (posterPath[0] === '/' ? posterPath : '/' + posterPath)); + if (window.tmdbImageCache && window.tmdbImageCache.enabled && window.tmdbImageCache.storage === 'server') { + return './api/tmdb/image?url=' + encodeURIComponent(fullUrl); + } + return fullUrl; + } + + function applyImportMediaCacheToImages(container) { + if (!container || !window.getCachedTMDBImage || !window.tmdbImageCache || !window.tmdbImageCache.enabled || window.tmdbImageCache.storage !== 'browser') return; + var imgs = container.querySelectorAll('img[src^="https://image.tmdb.org"]'); + imgs.forEach(function(img) { + var posterUrlVal = img.getAttribute('src'); + if (!posterUrlVal) return; + window.getCachedTMDBImage(posterUrlVal, window.tmdbImageCache).then(function(cachedUrl) { + if (cachedUrl && cachedUrl !== posterUrlVal) img.src = cachedUrl; + }).catch(function() {}); + }); + } window.MediaHuntImportMedia = { items: [], @@ -13,6 +36,7 @@ pollInterval: null, currentSearchFolderPath: null, importProgressAbort: false, + _importScrollObserver: null, getApiBase: function() { return this.mode === 'tv' ? './api/tv-hunt' : './api/movie-hunt'; @@ -81,7 +105,7 @@ confEl.className = 'import-progress-current-confidence ' + (score >= 70 ? 'high' : score >= 40 ? 'medium' : 'low'); } if (posterEl) { - var posterUrl = (currentItem.best_match && currentItem.best_match.poster_path) ? 'https://image.tmdb.org/t/p/w92' + currentItem.best_match.poster_path : './static/images/blackout.jpg'; + var posterUrl = (currentItem.best_match && currentItem.best_match.poster_path) ? getImportMediaPosterUrl(currentItem.best_match.poster_path, 'w92') : './static/images/blackout.jpg'; posterEl.innerHTML = ''; } } else { @@ -343,9 +367,52 @@ } listEl.innerHTML = ''; - for (var i = 0; i < this.items.length; i++) { - listEl.appendChild(self.createItemElement(this.items[i])); + self._importRenderedCount = 0; + self._appendImportMediaBatch(listEl); + self._setupImportMediaScrollLoad(listEl); + }, + + _appendImportMediaBatch: function(listEl) { + var self = this; + var start = self._importRenderedCount || 0; + var end = Math.min(start + IMPORT_MEDIA_PAGE_SIZE, self.items.length); + for (var i = start; i < end; i++) { + listEl.appendChild(self.createItemElement(self.items[i])); } + self._importRenderedCount = end; + applyImportMediaCacheToImages(listEl); + }, + + _setupImportMediaScrollLoad: function(listEl) { + var self = this; + if (self._importScrollObserver) { + self._importScrollObserver.disconnect(); + self._importScrollObserver = null; + } + if (self._importRenderedCount >= self.items.length) return; + + var sentinel = document.createElement('div'); + sentinel.className = 'import-media-scroll-sentinel'; + sentinel.setAttribute('aria-hidden', 'true'); + sentinel.style.cssText = 'height:1px;visibility:hidden;pointer-events:none;'; + listEl.appendChild(sentinel); + + self._importScrollObserver = new IntersectionObserver(function(entries) { + if (!entries[0] || !entries[0].isIntersecting) return; + if (self._importRenderedCount >= self.items.length) return; + self._importScrollObserver.disconnect(); + sentinel.remove(); + self._appendImportMediaBatch(listEl); + if (self._importRenderedCount < self.items.length) { + var newSentinel = document.createElement('div'); + newSentinel.className = 'import-media-scroll-sentinel'; + newSentinel.setAttribute('aria-hidden', 'true'); + newSentinel.style.cssText = 'height:1px;visibility:hidden;pointer-events:none;'; + listEl.appendChild(newSentinel); + self._importScrollObserver.observe(newSentinel); + } + }, { root: null, rootMargin: '200px', threshold: 0 }); + self._importScrollObserver.observe(sentinel); }, createItemElement: function(item) { @@ -359,7 +426,7 @@ if (item.status === 'matched' && item.best_match) { var m = item.best_match; - if (m.poster_path) posterUrl = 'https://image.tmdb.org/t/p/w92' + m.poster_path; + if (m.poster_path) posterUrl = getImportMediaPosterUrl(m.poster_path, 'w92'); var scoreClass = m.score >= 70 ? 'high' : (m.score >= 40 ? 'medium' : 'low'); matchHtml = '
' + '
' + self.escapeHtml(m.title) + '
' + @@ -384,7 +451,7 @@ var sizeStr = item.file_size ? self.formatSize(item.file_size) : ''; var qualityStr = item.parsed_quality || ''; - div.innerHTML = '
' + + div.innerHTML = '
' + '
' + '
' + self.escapeHtml(item.folder_name) + '
' + '
' + self.escapeHtml(item.folder_path || item.root_folder) + '
' + @@ -396,7 +463,13 @@ var confirmBtns = div.querySelectorAll('.import-media-btn-confirm'); for (var j = 0; j < confirmBtns.length; j++) { - confirmBtns[j].onclick = function() { self.confirmItem(this.getAttribute('data-path')); }; + confirmBtns[j].onclick = function() { + var btn = this; + var path = btn.getAttribute('data-path'); + if (btn.disabled) return; + btn.disabled = true; + self.confirmItem(path, btn); + }; } var searchBtns = div.querySelectorAll('.import-media-btn-search'); for (var j = 0; j < searchBtns.length; j++) { @@ -456,7 +529,7 @@ if (btn) { btn.disabled = false; btn.innerHTML = ' Scan Folders'; } }, - confirmItem: function(folderPath) { + confirmItem: function(folderPath, btn) { var self = this; var item = this.findItemByPath(folderPath); if (!item || !item.best_match) return; @@ -482,7 +555,12 @@ } else { if (window.huntarrUI && window.huntarrUI.showNotification) window.huntarrUI.showNotification(data.message || 'Import failed', data.already_exists ? 'info' : 'error'); if (data.already_exists) self.loadItems(); + if (btn) { btn.disabled = false; } } + }) + .catch(function() { + if (window.huntarrUI && window.huntarrUI.showNotification) window.huntarrUI.showNotification('Import failed.', 'error'); + if (btn) { btn.disabled = false; } }); }, @@ -634,10 +712,10 @@ var r = data.results[i]; var el = document.createElement('div'); el.className = 'import-media-search-result'; - var posterUrl = r.poster_path ? 'https://image.tmdb.org/t/p/w92' + r.poster_path : './static/images/blackout.jpg'; + var posterUrl = r.poster_path ? getImportMediaPosterUrl(r.poster_path, 'w92') : './static/images/blackout.jpg'; var overview = (r.overview || '').substring(0, 120); if (overview.length >= 120) overview += '...'; - el.innerHTML = '
' + + el.innerHTML = '
' + '
' + '
' + self.escapeHtml(r.title) + '
' + '
' + (r.year || 'N/A') + ' · ' + (r.vote_average || 0).toFixed(1) + '
' + @@ -703,8 +781,8 @@ var m = item.matches[i]; var el = document.createElement('div'); el.className = 'import-media-matches-dropdown-item'; - var posterUrl = m.poster_path ? 'https://image.tmdb.org/t/p/w92' + m.poster_path : './static/images/blackout.jpg'; - el.innerHTML = '
' + self.escapeHtml(m.title) + '
' + (m.year || '') + ' · ' + m.score + '%
'; + var posterUrl = m.poster_path ? getImportMediaPosterUrl(m.poster_path, 'w92') : './static/images/blackout.jpg'; + el.innerHTML = '
' + self.escapeHtml(m.title) + '
' + (m.year || '') + ' · ' + m.score + '%
'; (function(match) { el.onclick = function() { item.best_match = match; diff --git a/frontend/templates/components/scripts.html b/frontend/templates/components/scripts.html index 4ea5df05..b5f3dd39 100644 --- a/frontend/templates/components/scripts.html +++ b/frontend/templates/components/scripts.html @@ -1,7 +1,7 @@ - + diff --git a/frontend/templates/components/settings_sizes_section.html b/frontend/templates/components/settings_sizes_section.html index d030e7e8..bfba1bd0 100644 --- a/frontend/templates/components/settings_sizes_section.html +++ b/frontend/templates/components/settings_sizes_section.html @@ -698,14 +698,10 @@ var wrapperEl = document.getElementById('settings-sizes-content-wrapper'); Promise.all([ safeJsonFetch('./api/movie-hunt/instances', { instances: [] }), - safeJsonFetch('./api/tv-hunt/instances', { instances: [] }), - safeJsonFetch('./api/indexer-hunt/indexers', { indexers: [] }), - safeJsonFetch('./api/movie-hunt/has-clients', { has_clients: false }) + safeJsonFetch('./api/tv-hunt/instances', { instances: [] }) ]).then(function(results) { var movieCount = (results[0].instances || []).length; var tvCount = (results[1].instances || []).length; - var indexerCount = (results[2].indexers || []).length; - var hasClients = results[3].has_clients === true; if (movieCount === 0 && tvCount === 0) { var selectEl = document.getElementById('settings-sizes-instance-select'); if (selectEl) { @@ -720,18 +716,6 @@ if (wrapperEl) wrapperEl.style.display = ''; return; } - if (indexerCount === 0) { - if (noIdxEl) noIdxEl.style.display = ''; - if (noCliEl) noCliEl.style.display = 'none'; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } - if (!hasClients) { - if (noIdxEl) noIdxEl.style.display = 'none'; - if (noCliEl) noCliEl.style.display = ''; - if (wrapperEl) wrapperEl.style.display = 'none'; - return; - } if (noIdxEl) noIdxEl.style.display = 'none'; if (noCliEl) noCliEl.style.display = 'none'; if (wrapperEl) wrapperEl.style.display = '';