Skip to content

Commit e0de14f

Browse files
authored
Merge branch 'main' into preparebdsmrelease
2 parents 6cbc320 + 1262126 commit e0de14f

35 files changed

+26808
-1572
lines changed

plugins/AITagger/ai_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def process_images_async(image_paths, threshold=config.IMAGE_THRESHOLD, re
3838
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=config.SERVER_TIMEOUT)) as session:
3939
return await post_api_async(session, 'process_images/', {"paths": image_paths, "threshold": threshold, "return_confidence": return_confidence})
4040

41-
async def process_video_async(video_path, frame_interval=config.FRAME_INTERVAL,threshold=config.AI_VIDEO_THRESHOLD, return_confidence=True ,vr_video=False):
41+
async def process_video_async(video_path, vr_video=False, frame_interval=config.FRAME_INTERVAL,threshold=config.AI_VIDEO_THRESHOLD, return_confidence=True):
4242
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=config.SERVER_TIMEOUT)) as session:
4343
return await post_api_async(session, 'process_video/', {"path": video_path, "frame_interval": frame_interval, "threshold": threshold, "return_confidence": return_confidence, "vr_video": vr_video})
4444

plugins/AITagger/ai_tagger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ async def __tag_scene(scene):
246246
vr_video = media_handler.is_vr_scene(scene.get('tags'))
247247
if vr_video:
248248
log.info(f"Processing VR video {scenePath}")
249-
server_result = await ai_server.process_video_async(mutated_path, vr_video)
249+
server_result = await ai_server.process_video_async(video_path=mutated_path, vr_video=vr_video)
250250
if server_result is None:
251251
log.error("Server returned no results")
252252
media_handler.add_error_scene(sceneId)

plugins/AITagger/media_handler.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def initialize(connection):
4343
# ----------------- Tag Methods -----------------
4444

4545

46-
tag_categories = ["actions", "bodyparts"]
46+
tag_categories = ["actions", "bodyparts", "bdsm", "clothing", "describingperson", "environment", "describingbody", "describingimage", "describingscene", "sextoys"]
4747

4848
def get_all_tags_from_server_result(result):
4949
alltags = []
@@ -91,7 +91,11 @@ def remove_tagme_tags_from_images(image_ids):
9191
def add_tags_to_image(image_id, tag_ids):
9292
stash.update_images({"ids": [image_id], "tag_ids": {"ids": tag_ids, "mode": "ADD"}})
9393

94+
worker_counter = 0
95+
9496
def get_image_paths_and_ids(images):
97+
global worker_counter
98+
counter_updated = False
9599
imagePaths = []
96100
imageIds = []
97101
temp_files = []
@@ -100,14 +104,25 @@ def get_image_paths_and_ids(images):
100104
imagePath = image['files'][0]['path']
101105
imageId = image['id']
102106
if '.zip' in imagePath:
107+
if not counter_updated:
108+
worker_counter += 1
109+
counter_updated = True
103110
zip_index = imagePath.index('.zip') + 4
104111
zip_path, img_path = imagePath[:zip_index], imagePath[zip_index+1:].replace('\\', '/')
112+
113+
# Create a unique temporary directory for this worker
114+
temp_dir = os.path.join(config.temp_image_dir, f"worker_{worker_counter}")
115+
os.makedirs(temp_dir, exist_ok=True)
116+
117+
temp_path = os.path.join(temp_dir, img_path)
118+
os.makedirs(os.path.dirname(temp_path), exist_ok=True)
119+
105120
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
106-
temp_path = os.path.join(config.temp_image_dir, img_path)
107-
os.makedirs(os.path.dirname(temp_path), exist_ok=True)
108-
zip_ref.extract(img_path, config.temp_image_dir)
121+
zip_ref.extract(img_path, temp_dir)
109122
imagePath = os.path.abspath(os.path.normpath(temp_path))
110-
temp_files.append(imagePath)
123+
124+
temp_files.append(temp_path)
125+
temp_files.append(temp_dir) # Ensure the temp directory is also added to temp_files
111126
imagePaths.append(imagePath)
112127
imageIds.append(imageId)
113128
except IndexError:

plugins/CommunityScriptsUILibrary/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,26 @@ All the following functions are exposed under `window.csLib` and `csLib`
4949
*/
5050
```
5151

52+
## setConfiguration
53+
```js
54+
/**
55+
* Set configuration of a plugin in the server via GraphQL
56+
* @param {string} pluginId - The ID of the plugin as it is registered in the server
57+
* @param {*} values - The configuration object with the values you want to save in the server
58+
* @returns {Object} - The configuration object of the plugin as it is stored in the server after update
59+
*
60+
* @example
61+
* // fetch config from the server
62+
* const config = await getConfiguration('CommunityScriptsUIPlugin', defaultConfig);
63+
* // config = { theme: 'dark' }
64+
* // update the config based on user input
65+
* // config = { theme: 'light' }
66+
* // save config in the server
67+
* await setConfiguration('CommunityScriptsUIPlugin', config);
68+
* }
69+
*/
70+
```
71+
5272
## waitForElement
5373
```js
5474
/**

plugins/CommunityScriptsUILibrary/cs-ui-lib.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,35 @@
5454
return response.configuration.plugins?.[pluginId] ?? fallback;
5555
};
5656

57+
/**
58+
* Set configuration of a plugin in the server via GraphQL
59+
* @param {string} pluginId - The ID of the plugin as it is registered in the server
60+
* @param {*} values - The configuration object with the values you want to save in the server
61+
* @returns {Object} - The configuration object of the plugin as it is stored in the server after update
62+
*
63+
* @example
64+
* // fetch config from the server
65+
* const config = await getConfiguration('CommunityScriptsUIPlugin', defaultConfig);
66+
* // config = { theme: 'dark' }
67+
* // update the config based on user input
68+
* // config = { theme: 'light' }
69+
* // save config in the server
70+
* await setConfiguration('CommunityScriptsUIPlugin', config);
71+
* }
72+
*/
73+
const setConfiguration = async (pluginId, values) => {
74+
const query = `mutation ConfigurePlugin($pluginId: ID!, $input: Map!) { configurePlugin(plugin_id: $pluginId, input: $input) }`;
75+
const queryBody = {
76+
query: query,
77+
variables: {
78+
pluginId: pluginId,
79+
input: values,
80+
},
81+
};
82+
const response = await csLib.callGQL({ ...queryBody });
83+
return response.configurePlugin;
84+
};
85+
5786
/**
5887
* Waits for an element to be available in the DOM and runs the callback function once it is
5988
* @param {string} selector - The CSS selector of the element to wait for
@@ -105,6 +134,7 @@
105134
baseURL,
106135
callGQL,
107136
getConfiguration,
137+
setConfiguration,
108138
waitForElement,
109139
PathElementListener,
110140
};

plugins/DupFileManager/DupFileManager.css

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/DupFileManager/DupFileManager.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/DupFileManager/DupFileManager.js

Lines changed: 704 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/DupFileManager/DupFileManager.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)