Giter Club home page Giter Club logo

jellyfin.plugin.stash's People

Contributors

dirtyracer1337 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar

jellyfin.plugin.stash's Issues

Fails if filename matches more than one path in stash

I've noticed that metadata fetching seems to silently fail if a given scene name matches more than one file (for example, I have two files in stash named movie.2024.03.18.mp4, but in different folders).

I think this is due to the following logic:

var searchResults = JsonConvert.DeserializeObject<List<Scene>>(data);
if (!string.IsNullOrEmpty(path) && searchResults.Count > 1)
{
return result;
}

The above seems unintentional, especially given that the block immediately after iterates over the list and adds them to the result:

foreach (var searchResult in searchResults)
{
result.Add(new RemoteSearchResult
{
ProviderIds = { { Plugin.Instance.Name, searchResult.id } },
Name = searchResult.title,
PremiereDate = searchResult.date,
ImageUrl = searchResult.paths.screenshot,
});
}
return result;

I think the correct condition should be:

if (!searchResults.Count) return result;

As a side note, the first part of this conditon:

if (!string.IsNullOrEmpty(path)) 

is not relevant to the logic being modelled, and is redundant given that the check is already made above

if (!string.IsNullOrEmpty(path))
{
query = Path.GetFileNameWithoutExtension(path);
}
if (string.IsNullOrEmpty(query))
{
return result;
}

The plugin does not start

I use the Development Build plugin, after restarting the system, it writes that the plugin is not working properly.

version jf 10.9.1

Безымянный

Emby Plugin version cant pull images

Pulling Coverart, Actor photos or any other images is currently broken.

All other textbased metadata is getting through without issue.

Interestingly, when trying to manually identify and match a scene, often (but not always) the correct image is being previewed in the list of matches but then not getting pulled.
In order to verify that this was not just a fluke I tried setting up multiple libararies on my main dockerized emby instance, tried it on a clean install fresh dockerized instance, and a windows10 based server install.

Cannot add to Jellyfin server

How do I add this to the Jellyfin server? I have tried adding it manually and it doesn't working. Adding the URL to the plugin list doesn't help either.

StashDB?

Does this plugin also work with StashDB.org?

Scrapper not run

When scraper an item, it doesn't work.
Here is the log:
[ERR] Error GetDataFromAPI "$Internal system error. Error <runtime error: invalid memory address or nil pointer dereference>"
version: jellyfin 10.9.3 archlinux
use the latest build from github action

Upd: the deployment build also not work as same as above

Upd: Solved. Stash has been updated and then solved.

Emby version?

Will there be a version of this that works with Emby?

Unable to Parse Path from Json

Getting this error in Jellyfin logs when trying to pull the metadata from stashapp

Error Message

[00:49:51] [ERR] [105] Stash.Plugin: Error GetDataFromAPI "$Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at Stash.Providers.StashAPI.GetDataFromAPI(String query, CancellationToken cancellationToken)"

Path naming convention

{Site TitleSlug} - {Release-Date} - {Episode Title} [{Quality.Title}]/{Site.TitleSlug}.{Release-Date}.{PerformersFemale}.{Episode.Title}.{Quality.Title}

Example

 Site- 2022-09-18 - Title [WEBDL-2160p]\Site.2022-09-18.Firstname.Lastname.Title.WEBDL-2160p.mp4

Feature: Add config option for full-path matching for deterministic matching of files on the same disk

Related: #19

The following is a very common deployment:

  1. a user hosts jellyfin on the same host as stash
  2. both stash and jellyfin have access to the same filesystem

In this scenario, the stash API has the unique advantage that there's absolutely no need to guess in order to find an exact match for a given scene in jellyfin.

tl;dr

Either by configuration, or by default, when searching for a scene, use the entire path (incuding extension) in an exact search.

If needed, can allow for mapping of jellyfin -> stash paths, to address cases where the file system is under a different mountpoint between the services.

Current behaviour:

How the search query is currently constructed

  • Take the item's path
  • Take only the base-name (the file's name, discarding the folders leading to it)
  • Strip out the item's extension
  • Use the INCLUDE modifier in the search query so any item in stash with a matching basename will be matched

if (!string.IsNullOrEmpty(path))
{
query = Path.GetFileNameWithoutExtension(path);
}
if (string.IsNullOrEmpty(query))
{
return result;
}
query = HttpUtility.JavaScriptStringEncode(query.Trim());
string searchData;
if (!string.IsNullOrEmpty(path))
{
searchData = string.Format("scene_filter:{{path:{{value:\"\\\"{0}\\\"\",modifier:INCLUDES}}}}", query);
}
else
{
searchData = string.Format("filter:{{q:\"{0}\"}}", query);
}

This has the following issues:

  • If the filename is something common, there will be multiple results
    • In my case, this occurs because I have duplicates of the same scene (see below)
    • In other cases, a file might have a path like follows:
      • /media/Gape Queens (2017) WEB-DL 540p SPLIT SCENES MP4-KLEENEX/1 Adriana Chechik.mp4
      • The base name will be 1 Adriana Chechik
        • This may also match against multiple entries in stash.
        • In this case, the collision is more likely to cause errors than if it were a duplicate of the same scene, as that title could apply to many scenes

Both cases would cause the problem described in #19 to occur

In action

In the current implementation, the following query is constructed:

https://my-stash-instance/graphql?query=query{findScenes(scene_filter%3A{path%3A{value%3A"\"HussiePass.20.09.04.Mz.Dani.\""%2Cmodifier%3AINCLUDES}}){scenes{id%2Ctitle%2Cdate%2Cpaths{screenshot}movies{movie{front_image_path}}}}}

An unescaped / prettified version of this:

take note of the INCLUDES modifier

findScenes(
  scene_filter: {path: {
    value: "HussiePass.20.09.04.Mz.Dani.", 
    modifier: INCLUDES}}
) {
  scenes {
    id
    title
    date
    paths {
      screenshot
    }
    movies {
      movie {
        front_image_path
      }
    }
  }
}

This gives the following result (with some fields redacted for brevity & anonymity)

{
  "data": {
    "findScenes": {
      "scenes": [
        {
          "id": "7899",
          "title": "54 Inch PAWG vs 13 Inch Cock",
          "date": "2020-09-04"
        },
        {
          "id": "7900",
          "title": "54 Inch PAWG vs 13 Inch Cock",
          "date": "2020-09-04"
        },
        {
          "id": "7901",
          "title": "54 Inch PAWG vs 13 Inch Cock",
          "date": "2020-09-04"
        }
      ]
    }
  }
}

Desired behaviour

For example, I can copy the following from jellyfin's Media Info panel:

image

and run the following graphql query from https://my-stash-instance/playground:

take note of the EQUALS modifier

{
  findScenes(
    scene_filter: {
      path: {
        value: "/data/cool_storage/qBittorrent/Complete/xxx_video/HussiePass.20.09.04.Mz.Dani.54.Inch.PAWG.vs.13.Inch.BBC..480p.MP4-XXX/HussiePass.20.09.04.Mz.Dani..mp4",
        modifier: EQUALS}}
  ) {
    scenes {
      id
      title
    }
  }
}

And the following result is returned:

{
  "data": {
    "findScenes": {
      "scenes": [
        {
          "id": "7901",
          "title": "54 Inch PAWG vs 13 Inch Cock"
        }
      ]
    }
  }
}

Comparison between exact and partial matching

To demonstrate these side-by-side:

{
  findScenesExact: findScenes(
    scene_filter: {path: {
      value: "/data/cool_storage/qBittorrent/Complete/xxx_video/HussiePass.20.09.04.Mz.Dani.54.Inch.PAWG.vs.13.Inch.BBC..480p.MP4-XXX/HussiePass.20.09.04.Mz.Dani..mp4",
      modifier: EQUALS}}
  ) {
    scenes {
      id
      title
    }
  }
  findScenesInclude: findScenes(
    scene_filter: {path: {
      value: "HussiePass.20.09.04.Mz.Dani.", 
      modifier: INCLUDES}}
  ) {
    scenes {
      id
      title
      date
    }
  }
}
{
  "data": {
    "findScenesExact": {
      "scenes": [
        {
          "id": "7901",
          "title": "54 Inch PAWG vs 13 Inch Cock"
        }
      ]
    },
    "findScenesInclude": {
      "scenes": [
        {
          "id": "7899",
          "title": "54 Inch PAWG vs 13 Inch Cock",
          "date": "2020-09-04"
        },
        {
          "id": "7900",
          "title": "54 Inch PAWG vs 13 Inch Cock",
          "date": "2020-09-04"
        },
        {
          "id": "7901",
          "title": "54 Inch PAWG vs 13 Inch Cock",
          "date": "2020-09-04"
        }
      ]
    }
  }
}

In the "exact" case we see one result, in the "include" case we see 3 results.

Limitations of the "exact" approach

For some containerized deployments, the mapping of the filesystem may not be identical between stash and jellyfin

This scenario is not unique to stash / jellyfin, and is well-documented in similar media apps, for example, sonarr:
https://trash-guides.info/Sonarr/Sonarr-remote-path-mapping/

To address this, we could add a configuration option for mapping these paths, some apps support this, I myself have implemented similar in my own script for transferring torrents across systems: https://github.com/C84186/qBittorrent_tag_by_pattern/blob/main/paths.py#L60

That being said, I think it's reasonable to make exact matching a configuration option, and then put the onus on the user to ensure their filesystem paths match up (it's not that hard)

Get FrontCover and Director from Stash Movies

First of all: I LOVE this Plugin. I contributed an scraper for Stash that gets the Metadata from Jellyfin and always wanted to have this the other way round as well (but can't write C# Code). Your Plugin is exactly what I was looking for, thanks so much!

I have two enhancement requests:

  • All my full length movies have an FrontCover in Stash in the Movie Category. It would be great if this could be used instead of the Screenshot from the Scene (as far as it exists). It is part of the Graphql resultSet for the Scene:
    movies {
    movie {
    front_image_path
    }
    }

  • It would be great if the Plugin could get the Director of the movies (right now "only" the actors are added

I would love to do this as an pull request, but I am really not skilled enough in C# to understand how to correctly deal with the results from the queries unfortunately.

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.