From 01316957d681e4087389a0413d9a21d4554e19d1 Mon Sep 17 00:00:00 2001
From: David Maisonave <47364845+David-Maisonave@users.noreply.github.com>
Date: Tue, 12 Nov 2024 02:37:30 -0500
Subject: [PATCH] Added image preview option
---
plugins/DupFileManager/DupFileManager.py | 35 ++++++++++++-------
.../DupFileManager/DupFileManager_config.py | 24 +++++++++++++
2 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/plugins/DupFileManager/DupFileManager.py b/plugins/DupFileManager/DupFileManager.py
index 8225fbd..4710d48 100644
--- a/plugins/DupFileManager/DupFileManager.py
+++ b/plugins/DupFileManager/DupFileManager.py
@@ -564,14 +564,16 @@ def mangeDupFiles(merge=False, deleteDup=False, tagDuplicates=False, deleteBlack
stash.Trace(f"duplicateMarkForDeletion = {duplicateMarkForDeletion}")
dupTagId = stash.createTagId(duplicateMarkForDeletion, duplicateMarkForDeletion_descp, ignoreAutoTag=True)
stash.Trace(f"dupTagId={dupTagId} name={duplicateMarkForDeletion}")
- createHtmlReport = stash.Setting('createHtmlReport')
- previewOrStream = "stream" if stash.Setting('streamOverPreview') else "preview"
- htmlReportNameHomePage = htmlReportName
- htmlReportTableRow = stash.Setting('htmlReportTableRow')
- htmlReportTableData = stash.Setting('htmlReportTableData')
- htmlReportVideoPreview = stash.Setting('htmlReportVideoPreview')
- htmlHighlightTimeDiff = stash.Setting('htmlHighlightTimeDiff')
- htmlReportPaginate = stash.Setting('htmlReportPaginate')
+ createHtmlReport = stash.Setting('createHtmlReport')
+ previewOrStream = "stream" if stash.Setting('streamOverPreview') else "preview"
+ htmlIncludeImagePreview = stash.Setting('htmlIncludeImagePreview')
+ htmlImagePreviewPopupSize = stash.Setting('htmlImagePreviewPopupSize')
+ htmlReportNameHomePage = htmlReportName
+ htmlReportTableRow = stash.Setting('htmlReportTableRow')
+ htmlReportTableData = stash.Setting('htmlReportTableData')
+ htmlReportVideoPreview = stash.Setting('htmlReportVideoPreview')
+ htmlHighlightTimeDiff = stash.Setting('htmlHighlightTimeDiff')
+ htmlReportPaginate = stash.Setting('htmlReportPaginate')
addDupWhitelistTag()
addExcludeDupTag()
@@ -594,7 +596,7 @@ def mangeDupFiles(merge=False, deleteDup=False, tagDuplicates=False, deleteBlack
stash.Trace("#########################################################################")
stash.Log(f"Waiting for find_duplicate_scenes_diff to return results; matchDupDistance={matchPhaseDistanceText}; significantTimeDiff={significantTimeDiff}", printTo=LOG_STASH_N_PLUGIN)
stash.startSpinningProcessBar()
- htmlFileData = " paths {screenshot " + previewOrStream + "} " if createHtmlReport else ""
+ htmlFileData = " paths {screenshot sprite " + previewOrStream + "} " if createHtmlReport else ""
mergeFieldData = " code director title rating100 date studio {id} movies {movie {id} } galleries {id} performers {id} urls " if merge else ""
DupFileSets = stash.find_duplicate_scenes(matchPhaseDistance, fragment='id tags {id name} files {path width height duration size video_codec bit_rate frame_rate} details ' + mergeFieldData + htmlFileData)
stash.stopSpinningProcessBar()
@@ -759,8 +761,12 @@ def mangeDupFiles(merge=False, deleteDup=False, tagDuplicates=False, deleteBlack
toKeepFileExist = True if os.path.isfile(DupFileToKeep['files'][0]['path']) else False
fileHtmlReport.write(f"{htmlReportTableRow}")
-
- fileHtmlReport.write(f"{htmlReportTableData}")
+ videoPreview = f""
+ if htmlIncludeImagePreview:
+ imagePreview = f"


"
+ fileHtmlReport.write(f"{htmlReportTableData}| {videoPreview} | {imagePreview} |
")
+ else:
+ fileHtmlReport.write(f"{htmlReportTableData}{videoPreview}")
fileHtmlReport.write(f"{htmlReportTableData}{getPath(DupFile)}")
fileHtmlReport.write(f"| Res | Durration | BitRate | Codec | FrameRate | size | ID | index |
")
fileHtmlReport.write(f"| {DupFile['files'][0]['width']}x{DupFile['files'][0]['height']} | {DupFile['files'][0]['duration']} | {DupFile['files'][0]['bit_rate']} | {DupFile['files'][0]['video_codec']} | {DupFile['files'][0]['frame_rate']} | {DupFile['files'][0]['size']} | {DupFile['id']} | {QtyTagForDel} |
")
@@ -800,7 +806,12 @@ def mangeDupFiles(merge=False, deleteDup=False, tagDuplicates=False, deleteBlack
# Copy *file* from duplicate to ToKeep
fileHtmlReport.write("")
- fileHtmlReport.write(f"{htmlReportTableData}")
+ videoPreview = f""
+ if htmlIncludeImagePreview:
+ imagePreview = f""
+ fileHtmlReport.write(f"{htmlReportTableData}| {videoPreview} | {imagePreview} |
")
+ else:
+ fileHtmlReport.write(f"{htmlReportTableData}{videoPreview}")
fileHtmlReport.write(f"{htmlReportTableData}{getPath(DupFileToKeep)}")
fileHtmlReport.write(f"| Res | Durration | BitRate | Codec | FrameRate | size | ID |
")
fileHtmlReport.write(f"| {DupFileToKeep['files'][0]['width']}x{DupFileToKeep['files'][0]['height']} | {DupFileToKeep['files'][0]['duration']} | {DupFileToKeep['files'][0]['bit_rate']} | {DupFileToKeep['files'][0]['video_codec']} | {DupFileToKeep['files'][0]['frame_rate']} | {DupFileToKeep['files'][0]['size']} | {DupFileToKeep['id']} |
")
diff --git a/plugins/DupFileManager/DupFileManager_config.py b/plugins/DupFileManager/DupFileManager_config.py
index c7236f1..53020ea 100644
--- a/plugins/DupFileManager/DupFileManager_config.py
+++ b/plugins/DupFileManager/DupFileManager_config.py
@@ -82,6 +82,9 @@ config = {
"createHtmlReport" : True,
# If enabled, report displays stream instead of preview for video
"streamOverPreview" : False, # This option works in Chrome, but does not work very well on firefox.
+ # If enabled, report displays an image preview similar to sceneDuplicateChecker
+ "htmlIncludeImagePreview" : False,
+ "htmlImagePreviewPopupSize" : 600,
# Name of the HTML file to create
"htmlReportName" : "DuplicateTagScenes.html",
# HTML report prefix, before table listing
@@ -115,6 +118,27 @@ table, th, td {border:1px solid black;}
.link-button:active {
color:red;
}
+ul {
+ display: flex;
+}
+
+li {
+ list-style-type: none;
+ padding: 10px;
+ position: relative;
+}
+.large {
+ position: absolute;
+ left: -9999px;
+}
+li:hover .large {
+ left: 20px;
+ top: -150px;
+}
+.large-image {
+ border-radius: 4px;
+ box-shadow: 1px 1px 3px 3px rgba(127, 127, 127, 0.15);;
+}