timo95 / stash-checker

Userscript to check if a Scene/Performer is present in Stash
MIT License
14 stars 3 forks source link

[StashDB] Reduce scene cover brightness for added scenes #34

Open IAmKontrast opened 5 months ago

IAmKontrast commented 5 months ago

Awesome tool! Great work!

I have one suggestion for StashDB scenes: Check marks before the title are good but I would love to have the option to modify the brightness of the scene covers. This makes it so much easier for the human eye to see which scenes are already in the local Stash. Percentage of the filter: brightness(<number>%); should be configurable.

IAmKontrast commented 4 months ago

I tried to tackle this issue and have found a working solution but its unpleasantly slow. It gets the closest image of the stash-checker symbol (Target.Scene only) and set the img opacity to 10 percent (will be configurable later).

I don't understand why for each scene (observe = true) there are multiple calls for the same elementSelector.

Example 1: On stashdb.org/studios/ pages which contains 20 scenes per page, there are nearly 350 checks (console messages).

check(Target.Scene, `a[href^='/scenes/']${exclude}, a[href^='https://${currentSite()}/scenes/']${exclude}`, {
    ...stashBoxDefault,
    stashIdSelector: (e) => findId(closestUrl(e)),
});

This code results in 12 calls for the same StashId for each scene although the scene url occurs only twice for each scene on the page.

Example 2: hobby.porn and pornhub.com results as well as in six url and title calls for the same query.

@timo95 Could you please explain that to me?

timo95 commented 4 months ago

Number of queries = servers query-types (name, url, etc.) (custom graphql filters + 1)

observe = true should only matter when the DOM changes.

Currently master has 5 hardcoded custom scene filters for WIP #33 debugging, resulting in 6x queries. Also batching is currently deactivated (https://github.com/timo95/stash-checker/blob/85df37de56ce1a917415bb5707b90356aff15dbb/src/check.ts#L96), which results in the slowdowns. With batching activated that many queries wouldn't be a problem.

For the next release this will of course be removed. I am quite lazy with branches/PRs, since I have been the only dev until now.