From 8c723cfabc8fa62ff58cd5cf12c466785a0abe42 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 18 Aug 2026 11:12:09 -0400 Subject: [PATCH] fix: Implement universal openVideoPreview and add Stash container/transcode stream path resolution --- qbittorrent_performer_sorter.html | 44 ++++++++++++++++++++++++++----- server.py | 5 ++++ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/qbittorrent_performer_sorter.html b/qbittorrent_performer_sorter.html index 1ba0454..af286d2 100644 --- a/qbittorrent_performer_sorter.html +++ b/qbittorrent_performer_sorter.html @@ -5377,11 +5377,38 @@ Return ONLY a valid JSON object with an array named "results": const btnPreviewNext = document.getElementById('btn-preview-next'); const previewState = { - activeType: 'smb', // 'smb' | 'qb' + activeType: 'smb', // 'smb' | 'qb' | 'direct' currentIndex: -1, currentList: [] }; + function openVideoPreview(filePath, title = 'Video Preview', category = null) { + if (!filePath) { + showToast('No video path available for preview', 'error'); + return; + } + previewState.activeType = 'direct'; + previewState.currentIndex = 0; + previewState.currentList = [{ name: title, path: filePath, selectedPerformer: category }]; + + videoModal.classList.add('open'); + if (videoCounter) videoCounter.textContent = '1 / 1'; + if (btnPreviewPrev) btnPreviewPrev.disabled = true; + if (btnPreviewNext) btnPreviewNext.disabled = true; + + const playlistBar = document.getElementById('video-playlist-bar'); + if (playlistBar) playlistBar.style.display = 'none'; + + videoTitle.textContent = title || filePath.split('/').pop() || 'Video Preview'; + + const streamUrl = `/api/stream?path=${encodeURIComponent(filePath)}`; + videoElement.src = streamUrl; + videoElement.load(); + videoElement.play().catch(e => console.log('Autoplay deferred:', e)); + + renderVideoModalPerformerControls({ name: title, path: filePath, selectedPerformer: category }, 'direct'); + } + function openVideoPreviewForSmb(filePath) { const query = smbSearchInput.value.trim().toLowerCase(); const filtered = smbState.files.filter(f => { @@ -7888,11 +7915,14 @@ Return ONLY a valid JSON object with an array named "results": -
- - +
@@ -7931,8 +7961,8 @@ Return ONLY a valid JSON object with an array named "results": }); }); - // Preview listener - container.querySelectorAll('.btn-transcode-preview').forEach(btn => { + // Preview listeners + container.querySelectorAll('.btn-transcode-preview, .btn-transcode-preview-trans').forEach(btn => { btn.addEventListener('click', () => { const p = btn.getAttribute('data-path'); const t = btn.getAttribute('data-title'); diff --git a/server.py b/server.py index 86f32a2..a8bf5df 100644 --- a/server.py +++ b/server.py @@ -664,6 +664,10 @@ def resolve_stream_video_path(requested_path): stem = os.path.splitext(basename)[0] candidate_paths = [ + requested_path.replace('/data/', '/mnt/isolation/videos/'), + requested_path.replace('/data', '/mnt/isolation/videos'), + requested_path.replace('/media/stashapp/generated/', '/mnt/isolation/stashapp/generated/'), + requested_path.replace('/generated/', '/mnt/isolation/stashapp/generated/'), requested_path.replace('/isolation/videos/', '/mnt/isolation/videos/'), requested_path.replace('/isolation/', '/mnt/isolation/'), requested_path.replace('/downloads/', '/mnt/isolation/videos/unsorted/'), @@ -673,6 +677,7 @@ def resolve_stream_video_path(requested_path): requested_path.replace('/downloads/', '/mnt/isolation/downloads/'), os.path.join('/mnt/isolation/videos/unsorted', basename), os.path.join('/mnt/isolation/videos/videodownloader', basename), + os.path.join('/mnt/isolation/stashapp/generated/transcodes', basename), os.path.join('/mnt/isolation/incomplete', basename), os.path.join('/mnt/isolation/downloads', basename) ]