Giter Club home page Giter Club logo

stashapp-tag-importer's Introduction

stashapp-tag-importer

Creates tags and aliases, resolves tag conflicts, and updates tag titles and descriptions from Stashbox (StashDB) to your local Stash instance. It can be run periodically to perform a one way sync to keep your Stash instance up to date with Stashbox (StashDB).

Warning - Back Up Stash Instance Before Use

  • This script is very invasive and makes thousands of changes to your database.
  • Before using this script, back up your Stash instance.
    • Go to Settings > Tasks > Backup, then perform both Backup and Download Backup actions.
    • Make sure you are familiar with the restore process.
    • I would recommend testing out a restore before using this script.
  • This was developed and tested against Stash v0.24.3.
    • If you are on something older, please update.
    • If you are on something newer, I cannot stress enough, please perform a backup before using this script.

Known Issues

  • Tags on Stashbox (StashDB) can have alias collisions if the same alias is associated with two or more tags. stashapp-tag-importer will ping pong aliases between tags on your local Stash instance when this occurs.
    • The only way to solve this is to submit an edit on Stashbox (StashDB) to remove the the duplicate aliases until only one remains on the correct tag.

Features

  • Stat logging and log output of changes to file ./stashdb_tag_importer.log.
  • Caches tags from StashDB to local .json file for offline processing.
    • Automatically redownloads tags from StashDB if the StashDB tag count differs from local .json cache.
  • Error handling for Stash API so operations aren't missed due to random Stash Database locks or other issues.
  • Smart resolution of the following cases.
    • Local Tag does not exist.
      • Create tag.
    • Local Tag has alias that matches a StashDB tag.
      • Remove alias from old local tag.
      • Create tag.
      • Add new tag to all scenes, markers, galleries, and performers with old tag applied.
    • Local Tag exists, but should be alias of StashDB Tag.
      • Merge tag into main tag.
    • Alias for existing Local Tag does not exist.
      • Add alias to existing tag.
    • Alias already associated with different Local Tag.
      • Remove alias from incorrect local tag.
      • Add alias to correct local tag.
      • Add correct tag to all scenes, markers, galleries, and performers with incorrect tag applied.
    • Local Tag Name and / or Description is out of date.
      • Update Tag Name and / or Description.

Installation

  • Make sure you have Python 3.10 or higher installed.
  • Install poetry.
curl -sSL https://install.python-poetry.org | python3 -
  • Clone or download this repository.
  • In the repo, rename the .env.example file to .env, then edit it to include your Stashbox endpoint and API key, and your local Stash instance URL and API key.
  • In the repo, run the following command to install required dependencies.
poetry install

Usage

  • In the repo, run the following command to execute the script.
poetry run python stash_tag_importer/main.py

stashapp-tag-importer's People

Contributors

soundchaser128 avatar unatco90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

stashapp-tag-importer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.