(false);
+
+ function linkSite(url: string) {
+ const u = new URL(url);
+ return `${u.protocol}//${u.host}`;
+ }
+
+ function renderLink(url?: string) {
+ if (url) {
+ const sanitised = TextUtils.sanitiseURL(url);
+ const siteURL = linkSite(sanitised!);
+
+ return (
+
+ {sanitised}
+
+ );
+ }
+ }
+
+ function getListItems() {
+ const items = urls.map((u) => {renderLink(u)});
+
+ if (items.length > maxCollapsedItems) {
+ if (!expanded) {
+ items.length = maxCollapsedItems;
+ }
+
+ items.push(
+
+
+
+ );
+ }
+
+ return items;
+ }
+
+ return ;
+};
+
+export const SettingsScrapersPanel: React.FC = () => {
+ const Toast = useToast();
+ const {
+ data: performerScrapers,
+ loading: loadingPerformers,
+ } = useListPerformerScrapers();
+ const {
+ data: sceneScrapers,
+ loading: loadingScenes,
+ } = useListSceneScrapers();
+ const {
+ data: movieScrapers,
+ loading: loadingMovies,
+ } = useListMovieScrapers();
+
+ async function onReloadScrapers() {
+ await mutateReloadScrapers().catch((e) => Toast.error(e));
+ }
+
+ function renderPerformerScrapeTypes(types: ScrapeType[]) {
+ const typeStrings = types
+ .filter((t) => t !== ScrapeType.Fragment)
+ .map((t) => {
+ switch (t) {
+ case ScrapeType.Name:
+ return "Search by name";
+ default:
+ return t;
+ }
+ });
+
+ return (
+
+ {typeStrings.map((t) => (
+ - {t}
+ ))}
+
+ );
+ }
+
+ function renderSceneScrapeTypes(types: ScrapeType[]) {
+ const typeStrings = types.map((t) => {
+ switch (t) {
+ case ScrapeType.Fragment:
+ return "Scene Metadata";
+ default:
+ return t;
+ }
+ });
+
+ return (
+
+ {typeStrings.map((t) => (
+ - {t}
+ ))}
+
+ );
+ }
+
+ function renderMovieScrapeTypes(types: ScrapeType[]) {
+ const typeStrings = types.map((t) => {
+ switch (t) {
+ case ScrapeType.Fragment:
+ return "Movie Metadata";
+ default:
+ return t;
+ }
+ });
+
+ return (
+
+ {typeStrings.map((t) => (
+ - {t}
+ ))}
+
+ );
+ }
+
+ function renderURLs(urls: string[]) {
+ return ;
+ }
+
+ function renderSceneScrapers() {
+ const elements = (sceneScrapers?.listSceneScrapers ?? []).map((scraper) => (
+
+ {scraper.name} |
+
+ {renderSceneScrapeTypes(scraper.scene?.supported_scrapes ?? [])}
+ |
+ {renderURLs(scraper.scene?.urls ?? [])} |
+
+ ));
+
+ return renderTable("Scene scrapers", elements);
+ }
+
+ function renderPerformerScrapers() {
+ const elements = (performerScrapers?.listPerformerScrapers ?? []).map(
+ (scraper) => (
+
+ {scraper.name} |
+
+ {renderPerformerScrapeTypes(
+ scraper.performer?.supported_scrapes ?? []
+ )}
+ |
+ {renderURLs(scraper.performer?.urls ?? [])} |
+
+ )
+ );
+
+ return renderTable("Performer scrapers", elements);
+ }
+
+ function renderMovieScrapers() {
+ const elements = (movieScrapers?.listMovieScrapers ?? []).map((scraper) => (
+
+ {scraper.name} |
+
+ {renderMovieScrapeTypes(scraper.movie?.supported_scrapes ?? [])}
+ |
+ {renderURLs(scraper.movie?.urls ?? [])} |
+
+ ));
+
+ return renderTable("Movie scrapers", elements);
+ }
+
+ function renderTable(title: string, elements: JSX.Element[]) {
+ if (elements.length > 0) {
+ return (
+
+
{title}
+
+
+
+ Name |
+ Supported types |
+ URLs |
+
+
+ {elements}
+
+
+ );
+ }
+ }
+
+ if (loadingScenes || loadingPerformers || loadingMovies)
+ return ;
+
+ return (
+ <>
+ Scrapers
+
+
+
+
+
+ {renderSceneScrapers()}
+ {renderPerformerScrapers()}
+ {renderMovieScrapers()}
+
+ >
+ );
+};
diff --git a/ui/v2.5/src/components/Settings/styles.scss b/ui/v2.5/src/components/Settings/styles.scss
index ecef8049ae8..89844ce1474 100644
--- a/ui/v2.5/src/components/Settings/styles.scss
+++ b/ui/v2.5/src/components/Settings/styles.scss
@@ -40,3 +40,33 @@
#configuration-tabs-tabpane-tasks h5 {
margin-bottom: 1em;
}
+
+.scraper-table {
+ display: block;
+ margin-bottom: 16px;
+ overflow: auto;
+ width: 100%;
+
+ tr {
+ border-top: 1px solid #181513;
+
+ &:nth-child(2n) {
+ background-color: #2c3b47;
+ }
+ }
+
+ th,
+ td {
+ border: 1px solid #181513;
+ padding: 6px 13px;
+ }
+
+ ul {
+ margin-bottom: 0;
+ padding-left: 0;
+ }
+
+ li {
+ list-style: none;
+ }
+}
diff --git a/ui/v2.5/src/core/StashService.ts b/ui/v2.5/src/core/StashService.ts
index 4d920fe981a..f4c99107abc 100644
--- a/ui/v2.5/src/core/StashService.ts
+++ b/ui/v2.5/src/core/StashService.ts
@@ -638,6 +638,11 @@ export const queryStashBoxScene = (stashBoxIndex: number, sceneID: string) =>
export const mutateReloadScrapers = () =>
client.mutate({
mutation: GQL.ReloadScrapersDocument,
+ refetchQueries: [
+ GQL.refetchListMovieScrapersQuery(),
+ GQL.refetchListPerformerScrapersQuery(),
+ GQL.refetchListSceneScrapersQuery(),
+ ],
});
export const mutateReloadPlugins = () =>