-
I use gallery-dl to download a lot, the problem is there currently isn't a good way to "browse at file location", IE: see the rest of the files in the folder this file is in. Is there a way to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
The assumption is that images will be organized by galleries instead of relying on a folder location. See https://docs.stashapp.cc/in-app-manual/images/ You can filter images by path, but that can get tedious. And browser security sandboxing prevents opening folder location externally in file explorer. You could probably hack your way with a script to bypass it, but that is probably outside of Stash scope. |
Beta Was this translation helpful? Give feedback.
-
You can also just use search by querying the folder name or a partial path. Why isn't Stash good at viewing objects by file system structure like you want? Because before Stash and the app that it took inspiration from, people were doing just that, navigating using a file manager, and it was suboptimal. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/stashapp/stash/issues/1485#issuecomment-1327311022 i think there is a way to do it, is there a good guide on installing/writing scripts, the docs just say to follow a scripts instructions? I think I could write what I'm thinking of myself, I just don't really know where to start with scripts |
Beta Was this translation helpful? Give feedback.
-
I got a version of it working as a userscripts, but only under file info // ==UserScript==
// @name Browse at folder
// @namespace http://tampermonkey.net/
// @version 2024-12-09
// @description Add a button to search for files in the same folder
// @author sntrenter
// @match http://localhost:9999/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=undefined.localhost
// @grant none
// ==/UserScript==
//may need to fix encodings https://www.w3schools.com/tags/ref_urlencode.ASP
(function() {
'use strict';
console.log("hello world!");
// Add a button to search for files in the same folder
document.body.addEventListener('click', function (event) {
// File Info tab is clicked
if (event.target.dataset.rbEventKey === "scene-file-info-panel" || event.target.dataset.rbEventKey === "image-file-info-panel") {
console.log("hit");
let type = event.target.dataset.rbEventKey.split("-")[0] + "s";
console.log(type);
// Wait for the panel to render
setTimeout(() => {
const tabContent = document.querySelector("div.tab-content");
if (!tabContent) return;
// Find the file path link
const fileLink = Array.from(tabContent.querySelectorAll("a"))
.find(link => link.href.startsWith("file:///"));
if (fileLink) {
// Extract the folder path
const filePath = new URL(fileLink.href).pathname;
const folderPath = filePath.substring(0, filePath.lastIndexOf('/')).replace(/%20/g, " ");
console.log(folderPath);
// Double encode the folder path (but fix escaping issues manually)
let adjustedPath = folderPath.replace(/\//g, "\\").replace(/\\/g, "\\\\") + "\\\\";
adjustedPath = adjustedPath.replace(/%7B/g,"{").replace(/%7D/g,"}").replace(/%5F/g, "_");
const searchParams = `("type":"path","value":"\\"${adjustedPath}\\"","modifier":"INCLUDES")`;
console.log(adjustedPath)
// Do not double-encode backslashes, encode the whole string correctly
const searchURL = `/${type}?c=${encodeURIComponent(searchParams)}&sortby=path`;
console.log(searchURL);
// Add a hyperlink (styled as a button) to navigate to the search page
if (!document.querySelector("#folder-search-button")) {
const button = document.createElement("a");
button.id = "folder-search-button";
button.textContent = "Search Folder";
button.href = searchURL; // Set the URL
button.style.display = "inline-block";
button.style.padding = "10px";
button.style.margin = "10px";
button.style.backgroundColor = "#007BFF";
button.style.color = "white";
button.style.textDecoration = "none";
button.style.borderRadius = "5px";
button.style.textAlign = "center";
button.style.cursor = "pointer";
button.onmouseenter = () => (button.style.backgroundColor = "#0056b3");
button.onmouseleave = () => (button.style.backgroundColor = "#007BFF");
tabContent.prepend(button);
}
}
}, 100); // Allow time for the tab content to load
}
});
})(); |
Beta Was this translation helpful? Give feedback.
I got a version of it working as a userscripts, but only under file info
Want to find if there is a way to do it in different areas in the app and not just under file info (such as the carousel)