Skip to content

Python script that imports your favorite performers from StashDB into your Whisparr instance

License

Notifications You must be signed in to change notification settings

enymawse/StashDBFavoritesToWhisparr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StashDB Favorite Import to Whisparr

Overview

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.

Features

  • 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.

Requirements

  • Python 3.6 or higher
  • requests library
  • python-dotenv library

Install required dependencies:

pip install -r requirements.txt

Installation

  1. Clone the repository:

    git clone https://github.com/enymawse/StashDBFavoritesToWhisparr.git
    cd StashDBFavoritesToWhisparr
  2. 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 and your-whisparr-apikey with your actual API keys. Replace /location/of/your/media with the location of your root folder. If you don't set MONITORED or SEARCH_ON_ADD they default to False which will simply add the performer and not monitor or search when added. Consult the Whisparr Wiki for more details.

  3. Install the required Python libraries:

    pip install -r requirements.txt

Usage

  1. Ensure your .env file is properly set up with valid API keys.

  2. Run the script:

    python StashDBFavoritesToWhisparr.py
  3. Once the script completes, it will print a summary:

    Import complete: X successful, Y already imported, Z failed.
    
  4. Check the log files for additional details:

    • StashDBFavoritesToWhisparr.log for general info logs.
    • StashDBFavoritesToWhisparr_errors.log for error logs.

Example .env File

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.

How It Works

  1. The script fetches favorite performers from the StashDB GraphQL API using the provided API key.
  2. For each favorite performer, it queries Whisparr using their stashid.
  3. The performer data is transformed into a format compatible with Whisparr's API.
  4. The transformed data is sent to Whisparr via a POST request.
  5. The script logs the responses (both successes and errors) and prints a summary of the results at the end.

Logging

  • General Log: StashDBFavoritesToWhisparr.log
  • Error Log: StashDBFavoritesToWhisparr_errors.log

API Endpoints

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Contact

For questions or issues, please open an issue on the GitHub repository.

Notes:

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

About

Python script that imports your favorite performers from StashDB into your Whisparr instance

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages