Backend server for EMP Stash upload helper userscript
Project description
stash-empornium
This script by user humbaba allows torrent files and associated presentations to be created for empornium based on scenes from a local stash instance.
Installation
Using Docker
The docker version is recommended as it comes bundled with all required and recommended backend dependencies. To run the backend as a docker container, copy and paste the following commands:
docker pull bdbenim/stash-empornium:latest
docker run -d \
--name stash-empornium \
-p 9932:9932 \
--mount type=bind,src=/path/to/config,target=/config \
--mount type=bind,src=/path/to/save/torrents,target=/torrents \
--mount type=bind,src=/media,target=/media \
bdbenim/stash-empornium:latest
[!NOTE] Make sure that the target for your
/media
mount matches what stash sees. You may have to change the target, not just the source, to achieve this.
You can configure additional mount points by copying the same syntax as above. This may be useful if your stash library uses multiple directory locations. When in doubt, refer to the File Info tab of the scene in stash to get the file path as stash sees it:
Without Using Docker
The backend can also be run directly by intalling its dependencies and running the python script.
Backend Dependencies
- Python3
- flask
- requests
- vcsi
- configupdater
- cairosvg
- waitress (optional)
- ffmpeg
- mktorrent
Run the following commands to install the backend and dependencies (may vary slightly by OS):
git clone https://github.com/bdbenim/stash-empornium.git
cd stash-empornium
pip install -r requirements.txt
sudo apt-get install -y ffmpeg mktorrent
You can optionally install waitress as a production WSGI server:
pip install waitress
Userscript
Dependencies
Currently the script does not work with other userscript managers, though this may change in the future.
The userscript can be installed here. Place the other files on the same machine as your stash server and ensure dependencies are installed.
Configuration
-
Visit
upload.php
and open the Tampermonkey menu. Set the backend URL, stash URL, and API key (if you use authentication). -
Update config file located at
config/config.ini
:
[backend]
## name of a file in templates/ dir
default_template = fakestash-v2
## where torrents are placed
torrent_directory = /home/foobar/torrents
## port that the backend listens on
port = 9932
[stash]
## url of your stash instance
url = http://localhost:9999
## only needed if you set up authentication for stash
# api_key = 123abc.xyz
The port above corresponds to the backend URL in step 1, so if you change one you must change the other.
Usage
- Run
emp_stash_fill.py
- Get scene ID (it's in the url, e.g. for
http://localhost:9999/scenes/4123
the scene id is4123
) - Go to
upload.php
and enter the scene ID in the "Fill from stash" box - Select the file you want if you have multiple files attached to that scene, tick/untick the generate screens box, pick template if you have defined others
- Click "fill from" and wait as the tedious parts of the upload process are done for you. Status messages should appear and instructions for final steps. Performer tags like
pamela.anderson
will be generated for you, along with resolution tags and url tags of the studio, e.g.1080p
andbrazzers.com
- You still need to load the torrent file (the location on your filesystem will be given to you) into the form, set a category, optionally check for dupes if you didn't do so manually. Also load the torrent file into your client (you can configure the torrent output directory to be a watch dir for your torrent client) and make sure the media file is visible to your torrent client
- When you're satisfied everything is ready, upload
Templates
This repository includes default templates which can be used to fill in the presentation based on data from stash. Currently there are two, however more may be added in the future.
Adding Templates
To add a new template, save it in the templates
directory alongside your config.ini
file. Then add it to your configuration with the following format:
[templates]
filename = description
Templates are written using Jinja syntax. The available variables are:
- audio_bitrate
- audio_codec
- bitrate
- contact_sheet
- container
- cover
- date
- details
- duration
- framerate
- image_count
- performers
- name
- details
- image_remote_url
- tag
- resolution
- screens
- sex_acts
- studio
- studio_logo
- title
- video_codec
Refer to the default templates for examples of how they are used.
Custom Lists
In addition to the template variables described above, additional tag lists may be added to the empornium
config section by following the format of the sex_acts
variable. These will automatically be parsed and made available to any custom templates as comma-separated lists. For instance, you may wish to add a section called performer_attributes
to describe characteristics of performers in the scene.
Titles
Similarly to templates, the title has a few options for formatting. This uses python's builtin string formatter, so variable names are enclosed in braces ({}
) within the string. The default title format is:
[{studio}] {performers} - {title} ({date})[{resolution}]
This would result in something like this:
[Blender Institute] Big Buck Bunny, Frank, Rinky, Gimera - Big Buck Bunny (2008-05-10)[1080p]
The available variables that can be used are:
- codec
- date
- duration
- framerate
- performers
- resolution
- studio
- title
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stash_empornium-0.tar.gz
.
File metadata
- Download URL: stash_empornium-0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36a32d0a90df4e52ba9b14d1391f5a388c486d3a53ea88228ff94c7053e72a35 |
|
MD5 | e643dcc1da38514b317c0c21ea22306a |
|
BLAKE2b-256 | 0a88531c79c39fd8d47d49d933f7e3f5db4fa899622f60d82f0b6a774cf62a35 |
File details
Details for the file stash_empornium-0-py3-none-any.whl
.
File metadata
- Download URL: stash_empornium-0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e62e34f6a144b310e73edf8b2a3876049f8f66dd67797cc7ca745220be34401b |
|
MD5 | 10e3687be58503d55022fb13252359ff |
|
BLAKE2b-256 | 5f7dab3418644fb8590155ab371453bbe986df937b3a412565e08e3b3cfd3804 |