StashDBFavoriteImport.py
is a Python script that imports your favorite performers from StashDB into your Whisparr instance. It queries your StashDB favorite performers via GraphQL and transforms the data into the appropriate format to be used by Whisparr. The data is then sent to Whisparr through its API.
- Fetches favorite performers from StashDB using GraphQL.
- Queries the Whisparr API to retrieve performer details.
- Transforms and posts performer data into Whisparr.
- Logs successful and failed requests to log files.
- Provides a summary of the import process, including the number of successful and failed requests.
- Python 3.6 or higher
requests
librarypython-dotenv
library
pip install -r requirements.txt
-
Clone the repository:
git clone https://github.com/enymawse/StashDBFavoritesToWhisparr.git cd StashDBFavoritesToWhisparr
-
Create a
.env
file in the root of the project with the following content:STASHDB_APIKEY=your-stashdb-apikey WHISPARR_APIKEY=your-whisparr-apikey ROOT_FOLDER_PATH=/location/of/your/media MONITORED=True SEARCH_ON_ADD=True QUALITY_PROFILE=4
Replace
your-stashdb-apikey
andyour-whisparr-apikey
with your actual API keys. Replace/location/of/your/media
with the location of your root folder. If you don't setMONITORED
orSEARCH_ON_ADD
they default toFalse
which will simply add the performer and not monitor or search when added. Consult the Whisparr Wiki for more details. -
Install the required Python libraries:
pip install -r requirements.txt
-
Ensure your
.env
file is properly set up with valid API keys. -
Run the script:
python StashDBFavoritesToWhisparr.py
-
Once the script completes, it will print a summary:
Import complete: X successful, Y already imported, Z failed.
-
Check the log files for additional details:
StashDBFavoritesToWhisparr.log
for general info logs.StashDBFavoritesToWhisparr_errors.log
for error logs.
STASHDB_APIKEY=abc123def456
WHISPARR_APIKEY=xyz789ghi012
ROOT_FOLDER_PATH=/location/of/your/media
MONITORED=True
SEARCH_ON_ADD=True
QUALITY_PROFILE=4
Quick note about QUALITY_PROFILE
: This int
comes from a GET
request to your Whisparr instance {{baseurl}}/api/v3/qualityprofile
. Check out the Whisparr API Docs for more info.
- The script fetches favorite performers from the StashDB GraphQL API using the provided API key.
- For each favorite performer, it queries Whisparr using their
stashid
. - The performer data is transformed into a format compatible with Whisparr's API.
- The transformed data is sent to Whisparr via a POST request.
- The script logs the responses (both successes and errors) and prints a summary of the results at the end.
- General Log:
StashDBFavoritesToWhisparr.log
- Error Log:
StashDBFavoritesToWhisparr_errors.log
- StashDB GraphQL API: https://stashdb.org/graphql
- Whisparr API: https://api.whisparr.com
- Local Whisparr API: https://yourwhisparrinstance.lan/api/v3
This project is licensed under the MIT License. See the LICENSE file for more information.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
For questions or issues, please open an issue on the GitHub repository.
Ensure you have a requirements.txt
file that includes the necessary Python libraries like requests
and python-dotenv
if you'd like to automate dependency installation:
requests
python-dotenv