Skip to content

Commit d9aeb54

Browse files
authored
Merge branch 'stashapp:main' into tagGalleriesFromImages
2 parents 475fc06 + 322536c commit d9aeb54

File tree

71 files changed

+18584
-18507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+18584
-18507
lines changed

plugins/DateParser/date_parser.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import os
12
import sys, json
2-
3+
from PythonDepManager import ensure_import
4+
ensure_import("dateparser>=1.2.1")
5+
ensure_import("stashapi:stashapp-tools")
36
import stashapi.log as log
47
from stashapi.stashapp import StashInterface
58
import re
@@ -11,30 +14,38 @@ def main():
1114
global pattern
1215

1316
pattern = re.compile(
14-
r"\D(\d{4}|\d{1,2})[\._\- /\\](\d{1,2}|[a-zA-Z]{3,}\.*)[\._\- /\\](\d{4}|\d{1,2})\D"
17+
r"\D((\d{4}|\d{1,2})[\._\- /\\](\d{1,2}|[a-zA-Z]{3,}\.*)[\._\- /\\](\d{4}|\d{1,2}))\D*"
1518
)
1619
json_input = json.loads(sys.stdin.read())
1720
mode_arg = json_input["args"]["mode"]
1821

1922
stash = StashInterface(json_input["server_connection"])
20-
23+
config = stash.get_configuration()["plugins"]
24+
settings = {"setTitle": False}
25+
if "date_parser" in config:
26+
settings.update(config["date_parser"])
2127
if mode_arg == "gallery":
22-
find_date_for_galleries()
28+
find_date_for_galleries(settings)
2329

2430

2531
def parse_date_candidate(string):
2632
result = None
2733
for match in pattern.finditer(string):
28-
g1 = match.group(1)
29-
g2 = match.group(2)
30-
g3 = match.group(3)
34+
g0 = match.group(1)
35+
g1 = match.group(2)
36+
g2 = match.group(3)
37+
g3 = match.group(4)
3138
temp = parse(g1 + " " + g2 + " " + g3)
3239
if temp:
33-
result = temp.strftime("%Y-%m-%d")
40+
potential_title = None
41+
_,ext = os.path.splitext(string)
42+
if not ext and g0 in os.path.basename(string):
43+
potential_title = os.path.basename(string).replace(g0, "").strip()
44+
result = [temp.strftime("%Y-%m-%d"), potential_title]
3445
return result
3546

3647

37-
def find_date_for_galleries():
48+
def find_date_for_galleries(settings):
3849

3950
galleries = stash.find_galleries(f={"is_missing": "date"})
4051

@@ -60,9 +71,11 @@ def find_date_for_galleries():
6071
"Gallery ID ("
6172
+ gallery.get("id")
6273
+ ") has matched the date : "
63-
+ acceptableDate
74+
+ acceptableDate[0]
6475
)
65-
updateObject = {"id": gallery.get("id"), "date": acceptableDate}
76+
updateObject = {"id": gallery.get("id"), "date": acceptableDate[0]}
77+
if settings['setTitle'] and not gallery.get("title") and acceptableDate[1]:
78+
updateObject["title"] = acceptableDate[1]
6679
stash.update_gallery(updateObject)
6780

6881

plugins/DateParser/date_parser.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Gallery Date Parser
2+
# requires: PythonDepManager
23
description: Find date in path or filename and add it to the gallery
3-
version: 0.3.0
4+
version: 1.1.0
45
exec:
56
- python
67
- "{pluginDir}/date_parser.py"
@@ -10,3 +11,8 @@ tasks:
1011
description: Add the date on galleries based on their path
1112
defaultArgs:
1213
mode: gallery
14+
settings:
15+
setTitle:
16+
displayName: Set title ?
17+
description: Set title from folder name minus the found date ? Only applies on galleries without titles
18+
type: BOOLEAN

plugins/DupFileManager/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.log

plugins/DupFileManager/DupFileManager.log

Lines changed: 0 additions & 18075 deletions
This file was deleted.

plugins/DupFileManager/README.md

Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,29 @@
22

33
https://discourse.stashapp.cc/t/dupfilemanager/1331
44

5+
Please post any (**G-Rated**) bugs, feature request, help-request to the following link: [Issues](https://github.com/David-Maisonave/Axter-Stash/issues/new/choose).
6+
7+
58
DupFileManager is a [Stash](https://github.com/stashapp/stash) plugin which manages duplicate files in the Stash system.
69
It has both **task** and **tools-UI** components.
710

11+
## Content
12+
- [Features](#Features)
13+
- [Requirements](#Requirements)
14+
- [Installation](#Installation)
15+
- [Options](#Options)
16+
- [Advanced Options](#Advanced-Options)
17+
- [Future Planned Features, Changes, or Fixes](#Future-Planned-Features-Changes-or-Fixes)
18+
- [Stash Password](#Stash-Password)
19+
- [Screenshots](#Screenshots)
20+
- [Discourse](#Discourse)
21+
22+
823
### Features
924

10-
- Creates a duplicate file report which can be accessed from the settings->tools menu options.The report is created as an HTML file and stored in local path under plugins\DupFileManager\report\DuplicateTagScenes.html.
25+
- Creates a duplicate file report which can be accessed from the Stash->Settings->Tools menu options. The report is created as an HTML file and stored in local path under plugins\DupFileManager\report\DuplicateTagScenes.html.
1126
- See screenshot at the bottom of this page for example report.
12-
- Items on the left side of the report are the primary duplicates designated for deletion. By default, these duplicates are given a special \_duplicate tag.
27+
- Items on the left side of the report are the primary duplicates designated for deletion. By default, these duplicates are given a special _duplicate tag.
1328
- Items on the right side of the report are designated as primary duplicates to keep. They usually have higher resolution, duration and/or preferred paths.
1429
- The report has the following options:
1530
- Delete: Delete file and remove from Stash library.
@@ -24,12 +39,11 @@ It has both **task** and **tools-UI** components.
2439
- Merge: Copy Metadata (tags, performers,& studios) from left to right.
2540
- Can merge potential source in the duplicate file names for tag names, performers, and studios.
2641
- Normally when Stash searches the file name for tag names, performers, and studios, it only does so using the primary file.
27-
- Advance menu (for specially tagged duplicates)
28-
![Screenshot 2024-11-22 145139](https://github.com/user-attachments/assets/d76646f0-c5a8-4069-ad0f-a6e5e96e7ed0)
29-
- Advance menu can be access from the Settings->Tools->**[DupFileManager Tools and Utilities]** menu or from the **reports**.
30-
- Only access Advance Menu from the report when using Stash setup requiring a password.
42+
- Advance menu
43+
- ![Screenshot 2024-12-13 164930](https://github.com/user-attachments/assets/10098a4d-de2f-4e83-94ce-5988c5935404)
44+
- Advance menu can be access from the Stash->Settings->Tools->**[Duplicate File Report]** menu or from the **DupFileManager Tools & Util**.
3145
- Here are **some** of the options available in the **Advance Menu**.
32-
- Delete only specially tagged duplicates in blacklist path.
46+
- Delete specially tagged duplicates in blacklist path.
3347
- Delete duplicates with specified file path.
3448
- Delete duplicates with specific string in File name.
3549
- Delete duplicates with specified file size range.
@@ -38,14 +52,14 @@ It has both **task** and **tools-UI** components.
3852
- Delete duplicates having specified tags.
3953
- Delete duplicates with specified rating.
4054
- Delete duplicates with any of the above combinations.
41-
- Bottom extended portion of the Advanced Menu screen.
42-
- ![Screenshot 2024-11-22 232005](https://github.com/user-attachments/assets/9a0d2e9d-783b-4ea2-8fa5-3805b40af4eb)
55+
- Bottom extended portion of the Advanced Menu is for customizing the report.
56+
- ![Screenshot 2025-01-14 141032](https://github.com/user-attachments/assets/a37e2074-cfec-47ae-9eed-a7769fc2245d)
4357
- Delete duplicate file task with the following options:
44-
- Tasks (Settings->Task->[Plugin Tasks]->DupFileManager)
58+
- Tasks (Stash->Settings->Task->[Plugin Tasks]->DupFileManager)
4559
- **Tag Duplicates** - Set tag DuplicateMarkForDeletion to the duplicates with lower resolution, duration, file name length, and/or black list path.
4660
- **Delete Tagged Duplicates** - Delete scenes having DuplicateMarkForDeletion tag.
4761
- **Delete Duplicates** - Deletes duplicate files. Performs deletion without first tagging.
48-
- Plugin UI options (Settings->Plugins->Plugins->[DupFileManager])
62+
- Plugin UI options (Stash->Settings->Plugins->Plugins->[DupFileManager])
4963
- Has a 3 tier path selection to determine which duplicates to keep, and which should be candidates for deletions.
5064
- **Whitelist** - List of paths NOT to be deleted.
5165
- E.g. C:\Favorite\,E:\MustKeep\
@@ -83,8 +97,39 @@ That's it!!!
8397

8498
### Options
8599

86-
- Options are accessible in the GUI via Settings->Plugins->Plugins->[DupFileManager].
87-
- More options available in DupFileManager_config.py.
100+
- Options are accessible in the GUI via Stash->Settings->Plugins->Plugins->[DupFileManager].
101+
- Also see:
102+
- Stash->Settings->Tools->[Duplicate File Report]
103+
- Stash->Settings->Tools->[DupFileManager Tools and Utilities]
104+
- More options available on the following link:
105+
- [advance_options.html](https://stash.axter.com/1.1/advance_options.html)
106+
- When using a Stash installation that requires a password or that is not using port 9999...
107+
- Access above link from Stash->Settings->Tools->[Duplicate File Report]->[**Advance Duplicate File Menu**]
108+
- Or add the GQL and apiKey as parameters to the URL.
109+
- Example: https://stash.axter.com/1.1/advance_options.html?GQL=http://localhost:9999/graphql&apiKey=1234567890abcdefghijklmnop
110+
- See following for more details: [Stash Password](README.md#Stash-Password)
111+
112+
### Advanced Options
113+
114+
Users can setup a private or alternate remote site by changing variables **remoteReportDirURL** and **js_DirURL** in file DupFileManager_report_config.py.
115+
- The following files are needed at the remote site that is pointed to by **remoteReportDirURL**.
116+
- DupFileManager_report.js
117+
- DupFileManager_report.css
118+
- file.html
119+
- advance_options.html
120+
- The **js_DirURL** path requires the following:
121+
- jquery-3.7.1.min.js
122+
- EasyUI associated files
123+
- jquery.prompt.js and jquery.prompt.css
124+
125+
### Stash Password
126+
127+
- Stash installation configured with a password, need to generate an API-Key.
128+
- To generate an API-Key:
129+
- Go to Stash->Settings->Security->Authentication->[API Key]
130+
- Click on [Generate API-Key]
131+
- Once the API key is generated, DupFileManager will automatically fetch the key.
132+
88133

89134
### Screenshots
90135

@@ -93,7 +138,7 @@ That's it!!!
93138
- ![Screenshot 2024-11-22 225359](https://github.com/user-attachments/assets/dc705b24-e2d7-4663-92fd-1516aa7aacf5)
94139
- If there's a scene on the left side that has a higher resolution or duration, it gets a yellow highlight on the report.
95140
- There's an optional setting that allows both preview videos and preview images to be displayed on the report. See settings **htmlIncludeImagePreview** in the **DupFileManager_report_config.py** file.
96-
- There are many more options available for how the report is created. These options are targeted for more advanced users. The options are all available in the **DupFileManager_report_config.py** file, and the settings have commented descriptions preceeding them. See the **DupFileManager_report_config.py** file in the DupFileManager plugin folder for more details.
141+
- There are many more options available for how the report is created. These options are targeted for more advanced users. The options are all available in the **DupFileManager_report_config.py** file, and the settings have commented descriptions preceding them. See the **DupFileManager_report_config.py** file in the DupFileManager plugin folder for more details.
97142
- Tools UI Menu
98143
![Screenshot 2024-11-22 145512](https://github.com/user-attachments/assets/03e166eb-ddaa-4eb8-8160-4c9180ca1323)
99144
- Can access either **Duplicate File Report (DupFileManager)** or **DupFileManager Tools and Utilities** menu options.
@@ -102,12 +147,40 @@ That's it!!!
102147
- DupFileManager Tools and Utilities
103148
- ![Screenshot 2024-11-22 152023](https://github.com/user-attachments/assets/4daaea9e-f603-4619-b536-e6609135bab1)
104149
- Full bottom extended portion of the Advanced Menu screen.
105-
- ![Screenshot 2024-11-22 232208](https://github.com/user-attachments/assets/bf1f3021-3a8c-4875-9737-60ee3d7fe675)
150+
- ![Screenshot 2025-01-14 141613](https://github.com/user-attachments/assets/77928538-e6f2-47b7-8717-45db054ffbf5)
151+
152+
### Future Planned Features, Changes, or Fixes
153+
- Scheduled Changes
154+
- On Adv Menu, add option to set special _ToBeDeletedTag_ under Delete button menu.
155+
- Remove [Max Dup Process] from the Stash->Plugins GUI. This option already exist in advance menu. Planned for 1.2.0 Version.
156+
- Add chat icon to report which on hover, displays a popup window showing scene details content. Planned for 1.2.0 Version.
157+
- Add studio icon to report; on hover show studio name. Planned for 1.2.0 Version.
158+
- Add option on report to view rating and change it. Use an icon with a number on it to show rating. Planned for 1.2.0 Version.
159+
- On report make flag toggle logic. In other words, when flag button is selected, and scene is already that color, remove the colored flag. Planned for 1.2.0 Version.
160+
- Add report option to set flag to all scenes missing metadata on Scene-ToKeep or having higher resolution or longer duration on **Duplicate-to-Delete** scene. Planned for 1.2.0 Version.
161+
- Add option to [**Advance Duplicate File Menu**] to display cover image for preview image. Planned for 1.2.0 Version.
162+
- On report, when move operation is performed, have it automatically delete the **Duplicate-to-Delete** scene. Planned for 1.2.0 Version.
163+
- On [**Advance Duplicate File Menu**], add a flag option to the menu on the left side, and shrink the tag option. Planned for 1.2.0 Version.
164+
- Change the TagOrFlag option on the right side to a check mark.
165+
- Add option to delete by file type. Planned for 1.2.0 Version.
166+
- On report, have [Flag or Tag] option still enabled after manually disabling scene. Planned for 1.2.0 Version.
167+
- On [**Advance Duplicate File Menu**], have the details section hide fully, or partially when the page is first displayed. Planned for 1.4.0 Version.
168+
- Unscheduled Changes
169+
- Change splitbutton so it hides tooltip when hovering over dropdown side of the button.
170+
- Fix errors on HTML page listed in https://validator.w3.org.
171+
- Add logic to merge performers and galleries separately from tag merging on report.
172+
- Add logic to merge group metadata when selecting merge option on report.
173+
- Add advanced menu directly to the Stash->Settings->Tools menu. (This change does not look doable!!!)
174+
- Add report directly to the Stash->Settings->Tools menu. (This change does not look doable!!!)
175+
- Add double strike-through option to flagging.
176+
- Add option to report to automatically strip width & height from name on rename. Example: foofoo - 1920x1080P.mp4
177+
- Move [Merge Duplicate Tags], [Whitelist Delete In Same Folder], and [Swap Better **] field options from the Stash->Plugins GUI to the advance menu.
178+
179+
180+
### Discourse
181+
[Discourse-DupFileManager](https://discourse.stashapp.cc/t/dupfilemanager/1331)
106182

107-
### Future Planned Features
183+
**Note:**
184+
- The author of this plugin does **not** monitor Discourse. Please post any (**G-Rated**) bugs, feature request, help-request to the following link: [Issues](https://github.com/David-Maisonave/Axter-Stash/issues/new/choose).
185+
- The [Discourse link](https://discourse.stashapp.cc/t/dupfilemanager/1331) should be use for discussion that would be inappropriate in GitHub.
108186

109-
- Add logic to merge performers and galaries seperatly from tag merging on report. Planned for 1.5.0 Version.
110-
- Add code to report to make it when the report updates the screen (due to tag merging), it stays in the same row position. Planned for 1.5.0 Version.
111-
- Add logic to merge group metadata when selecting merge option on report. Planned for 2.0.0 Version.
112-
- Add advanced menu directly to the Settings->Tools menu. Planned for 2.0.0 Version.
113-
- Add report directly to the Settings->Tools menu. Planned for 2.0.0 Version.

0 commit comments

Comments
 (0)