Stash with Pandas
1. Environment file
.env file is a convenient place to store API keys and avoid having those in version controlled notebooks. Create .env file with your own API keys and other values:
cp env.sample .env
2. Install Python and related tools
2.1 Python and Pandas
Recommended: Install Conda and create a new environment for it to keep Pandas separate from other Python environments.
conda create -c conda-forge -n name_of_my_env python pandas
conda activate name_of_my_env
Alternative: Install Python and Pandas.
2.2 pip packages
Install stashapp-tools and dotenv:
pip install stashapp-tools python-dotenv
3. Install Visual Studio Code
Install Visual Studio Code and following extensions:
4. Getting Started
After opening this repository in Visual Studio Code, remember to set correct kernel for Jupyter notebook: https://code.visualstudio.com/docs/datascience/jupyter-kernel-management
Now you can start experimenting with Stash and Pandas by looking at hello_world.ipynb.
Notebooks
Hello World
A handful of samples to get you going.
Scene Matching
Tailored to a workflow where scenes have been matched to StashDB first and you want to match to TPDB without using TPDB's data directly.
Process is as follows:
- Set TPDB_API_KEY value in .env file to your TPDB API key
- Run initial cells to create Stash app connection and create utility functions
- Run studio summary to figure out which networks have most scenes missing TPDB. Open
df_scenes_grouped_by_studioin Data Wrangler. - Iterate following process
- Find studio with name
- Get 100 scenes at a time from Stash app
- Get TPDB matches with phash and get the best match in a single table
- Open
df_matched_scenesin Data Wrangler - Manually verify with Data Wrangler UI that scenes match as you expected
- Save TPDB UUIDs to your Stash app with one of the last cells. There are multiple examples based on if you are comfortable saving TPDB UUIDs only to those scenes which match all identifiers or if you want something more specific.


