Skip to content

Commit 5445c7a

Browse files
authored
Add files via upload
1 parent b37fd4e commit 5445c7a

6 files changed

Lines changed: 1263 additions & 0 deletions

File tree

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,169 @@
1+
# Movie Scene Checker — Stash Plugin
12

3+
Compares the scenes inside a Stash **Group** (Movie) against the scene listing
4+
on **AdultDVDEmpire**, so you can see at a glance which scenes you own and
5+
which you're still missing.
6+
7+
---
8+
9+
## Requirements
10+
11+
| Requirement | Notes |
12+
|---|---|
13+
| Stash v0.25+ | Plugin API + patch system |
14+
| Python 3.10+ | Backend scraper |
15+
| `requests`, `beautifulsoup4` | `pip install -r requirements.txt` |
16+
17+
---
18+
19+
## Installation
20+
21+
1. Install via manager or manually pasting the folder into Stash's
22+
plugin directory. Installation documentation found here:
23+
https://discourse.stashapp.cc/t/how-to-install-a-plugin/1015
24+
25+
2. Edit `config.json` with your settings (see **Configuration** below).
26+
27+
3. In Stash → **Settings → Plugins**, click **Reload Plugins**.
28+
You should see **Stash Group ADVE Movie Checker** appear in the list.
29+
30+
4. Open any Group page — a **🎬 Scene Checker** button will appear below
31+
the Edit/Delete buttons.
32+
33+
---
34+
35+
## Configuration
36+
37+
All settings live in `config.json` inside the plugin folder. Open it in any
38+
text editor and fill in the three values:
39+
40+
```json
41+
{
42+
"stash_url": "http://localhost:9999",
43+
"stash_api_key": "",
44+
"adve_session_cookie": "ageConfirmed=true; defaults={}; etoken=PASTE_YOUR_ETOKEN_HERE"
45+
}
46+
```
47+
48+
| Key | Description |
49+
|---|---|
50+
| `stash_url` | URL of your Stash instance. Change if you use a custom port or remote host. |
51+
| `stash_api_key` | API key for your Stash instance. Leave blank if authentication is not enabled. |
52+
| `adve_session_cookie` | Your AdultDVDEmpire session cookie string. See instructions below. |
53+
54+
### How to get your AdultDVDEmpire session cookie
55+
56+
The plugin needs a valid session cookie to access ADVE movie pages.
57+
You only need to do this once — the `etoken` cookie persists until you log out.
58+
59+
1. Open your browser and log into [adultdvdempire.com](https://www.adultdvdempire.com).
60+
61+
2. Open **Developer Tools**:
62+
- **Chrome / Edge**: press `F12` or `Ctrl+Shift+I` (Mac: `Cmd+Option+I`)
63+
- **Firefox**: press `F12` or `Ctrl+Shift+I`
64+
65+
3. Click the **Application** tab (Chrome/Edge) or **Storage** tab (Firefox).
66+
67+
4. In the left sidebar, expand **Cookies** and click
68+
`https://www.adultdvdempire.com`.
69+
70+
5. You will see a table of cookies. Locate these three:
71+
72+
| Cookie name | Example value |
73+
|---|---|
74+
| `ageConfirmed` | `true` |
75+
| `defaults` | `{}` |
76+
| `etoken` | `a1=abc123...&a2=def456...&a3=789...` |
77+
78+
6. Build the cookie string by combining all three in this format:
79+
```
80+
ageConfirmed=true; defaults={}; etoken=PASTE_FULL_ETOKEN_VALUE_HERE
81+
```
82+
Paste the **full value** of `etoken` exactly as shown in DevTools —
83+
it is a long string containing `a1=`, `a2=`, and `a3=` parts.
84+
85+
7. Paste the complete string as the value of `adve_session_cookie` in
86+
`config.json` and save the file. No plugin reload required.
87+
88+
> **Note:** If the scraper ever stops getting through to ADVE, your `etoken`
89+
> may have expired. Repeat steps 1–7 with a freshly logged-in session.
90+
91+
---
92+
93+
## Usage
94+
95+
### Per-Group check (normal use)
96+
97+
1. Open any Group (movie) page in Stash.
98+
2. Click the **🎬 Scene Checker** button below the Edit/Delete buttons.
99+
The panel expands showing a **Check Scenes** button.
100+
3. The Group must have an `adultdvdempire.com` URL in its URL list.
101+
Click **Check Scenes** — the plugin scrapes ADVE and compares the results
102+
against scenes already linked to this Group in Stash.
103+
4. Use the **All / Missing / In Library** filter buttons to narrow the view.
104+
5. Click **** to collapse the panel back to button mode. Results are saved
105+
to disk and will restore automatically the next time you open the page.
106+
107+
### No ADVE URL
108+
109+
If the Group does not have an `adultdvdempire.com` URL in its URL list, the
110+
panel shows a warning. Edit the Group, paste the ADVE movie page URL into
111+
the URL field, save, then click **Check Scenes**.
112+
113+
### Bulk scrape (background task)
114+
115+
In **Settings → Tasks**, run **"Scrape ADVE Scenes for All Groups"** to
116+
pre-cache scene data for every Group that already has an ADVE URL. Note:
117+
this task can take awhile, plan accordingly.
118+
119+
---
120+
121+
## How Matching Works
122+
123+
Each ADVE scene is matched to a Stash scene using these strategies in order:
124+
125+
1. **Performer + duration (primary)** — all performers listed on ADVE must be
126+
present in the Stash scene, AND the duration must be within tolerance
127+
(120 sec base + 10 sec per performer, to account for ADVE's rounded
128+
whole-minute durations).
129+
2. **Performer match alone** — used when ADVE has no duration listed.
130+
3. **Duration match alone** — used when ADVE has no performers listed.
131+
4. **Title match (fallback)** — normalized exact title comparison. Generic
132+
titles like "Scene 1" are skipped to avoid false positives.
133+
134+
---
135+
136+
## Data Persistence & Caching
137+
138+
- Results are written to `results/group_<id>.json` after every run and persist
139+
across page navigations and Stash restarts. The **🎬 Scene Checker** button
140+
shows a completion badge (e.g. `2 / 4`) without needing to re-run.
141+
- ADVE pages are cached in `.cache/` for **24 hours**.
142+
- Click **Re-check** to force a fresh scrape and overwrite stored results.
143+
144+
---
145+
146+
## File Structure
147+
148+
```
149+
Stash_Group_ADVE_Movie_Plugin/
150+
├── Stash_Group_ADVE_Movie_Plugin.yml ← Plugin manifest
151+
├── checker.py ← Backend: scraper + GraphQL + matching
152+
├── config.json ← Your settings (URL, API key, cookie)
153+
├── requirements.txt ← Python dependencies
154+
├── panel.js ← Frontend UI injected into Group pages
155+
├── results/ ← Auto-created; persisted result JSON files
156+
└── .cache/ ← Auto-created; cached ADVE HTML (24 hr TTL)
157+
```
158+
159+
---
160+
161+
## ⚠️ Scraper Fragility Note
162+
163+
The plugin scrapes AdultDVDEmpire's HTML. If ADVE changes their page markup,
164+
the selectors in `checker.py → scrape_adve()` may need updating. The key
165+
pattern to check is the scene anchor:
166+
167+
```python
168+
soup.find_all("a", attrs={"name": re.compile(r"^scene_\d+$")})
169+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Stash Group ADVE Movie Checker"
2+
description: "Compares scenes in a Stash Group against AdultDVDEmpire. Requires an ADVE URL in the Group's URL list."
3+
version: "0.3.0"
4+
5+
ui:
6+
javascript:
7+
- panel.js
8+
assets:
9+
/results: results
10+
csp:
11+
connect-src:
12+
- https://adultdvdempire.com
13+
- https://www.adultdvdempire.com
14+
15+
tasks:
16+
- name: "Check Group Scenes"
17+
description: "Scrapes ADVE for a single Group (triggered by the UI panel)."
18+
defaultArgs:
19+
mode: check_group
20+
21+
- name: "Scrape ADVE Scenes for All Groups"
22+
description: "Scrapes ADVE scene data for every Group that has an ADVE URL."
23+
defaultArgs:
24+
mode: scrape_all
25+
26+
exec:
27+
- python3
28+
- "{pluginDir}/checker.py"

0 commit comments

Comments
 (0)