Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add AniDB as a provider, Hama.Bundle (anidb|tvdb guid) #1018

Open
Amateur-God opened this issue Aug 28, 2022 · 10 comments
Open
Labels
enhancement New feature or request

Comments

@Amateur-God
Copy link

Feature description

add anidb along with tvdb and imdb for anime,

Use case

i use the hama plugin for plex to use anidb for metadata for my anime shows as tvdb isnt always correct and doesnt handle anime very well, however this results in a Unable to parse a valid provider from guid <PlexGuid:com.plexapp.agents.hama://anidb-4776?lang=en> error.

@Amateur-God Amateur-God added the enhancement New feature or request label Aug 28, 2022
@zeroquinc
Copy link

Would like to see this added as I have the same problem.

@Amateur-God
Copy link
Author

Would like to see this added as I have the same problem.

I've just ended up switching to emby and using the emby anidb and trakt plugins, works perfectly. I recommend it if your system can handle emby

@simonc56
Copy link
Collaborator

Can you give examples of anime which are "not handled very well" by Plex agent and for which anidb is a best choice ?

@zeroquinc
Copy link

Can you give examples of anime which are "not handled very well" by Plex agent and for which anidb is a best choice ?

Dragon Ball Z Kai for example on Trakt: https://trakt.tv/shows/dragon-ball-z-kai

Shows 6 seasons because it follows tmdb. But with the hama plugin you get only 2 seasons because it follows tvdb and anidb I guess.

@simonc56
Copy link
Collaborator

You don't answer the question.
Using Plex agent for Dragon Ball Z Kai is working good. Matches and sync perfectly with trakt.

@zeroquinc
Copy link

zeroquinc commented Dec 26, 2022

You don't answer the question. Using Plex agent for Dragon Ball Z Kai is working good. Matches and sync perfectly with trakt.

Renamed my DBZ Kai pack back to tvdb numbering with FileBot (how it orginally downloaded my files, i renamed them to the Trakt order with 6 seasons to fix scrobbling)

Changed the agent back to Plex with as default tmdb ordering. It changed my 6 seasons back to 2 seasons. Everything up to a certain episode in season 1 won't scrobble anymore because Trakt only knows DBZ Kai as 6 seasons.

image

Metadata dissapeared and scrobbling doesn't work.

         <PlexGuid:local://4158> because provider local has no external Id      
WARNING  <Episode:4159:Dragon-Ball-Z-Kai-s01e158>: Skipping                     
         <PlexGuid:local://4159> because provider local has no external Id      
WARNING  <Episode:4160:Dragon-Ball-Z-Kai-s01e159>: Skipping                     
         <PlexGuid:local://4160> because provider local has no external Id

So not sure what you mean with it matches and syncs perfectly tbh. It only scrobbles fine if I rename my DBZ Kai to the TMDB episode ordering in FileBot. Then it makes it 6 seasons instead of 2 and everything works fine.

If i change the episode ordering back to TVDB in Plex the metadata looks fine for the 2 seasons for all episodes. But still scrobbling wont work, sync gives this error:

         <PlexGuid:imdb://tt1528230> not found on Trakt                         
WARNING  <Episode:4356:Dragon-Ball-Z-Kai-s01e29>: Skipping guid                 
         <PlexGuid:tvdb://1233481> not found on Trakt                           
WARNING  <Episode:4356:Dragon-Ball-Z-Kai-s01e29>: Skipping guid                 
         <PlexGuid:imdb://tt1531707> not found on Trakt        

@simonc56
Copy link
Collaborator

  1. Keep your DBZ Kai pack files to tvdb numbering (how it orginally downloaded)
  2. Use Plex TV Series agent
  3. Check the show settings ordering to be TheTVDB (Aired)
  4. Temporary rename your plextraktsync cache trakt_cache.sqlite to trakt_cache.sqlite.backup
  5. Make sure you have latest plextraktsync version 0.25.3
  6. Sync with command plextraktsync sync --sync=shows

You will only have mismatch with season 1 episode 98 because it is a special (s00e01) and shouldn't be in season 1.

AniDB is not needed here.
Any other example where AniDB is supposed to be better than Plex TV Series agent ?

@BitterSweetcandyshop
Copy link

BitterSweetcandyshop commented May 5, 2023

@twolaw I bring back this, not only due to the fact of Hama being far feature rich beyond the Plex TV options, it's not only series being handled wrong (very rare cases), but also some of these reasons:

  • people like me, with 200 plus anime, who don't want to take the time and cpu to update their collection, without guarantee all metadata will even be available
  • collections, ghost in the shell
  • bringing in more image providers, which plex often failed with my older anime. no I do not have an example since It's been a long time since I used plex tv for anime
  • imo, better genre and ratings gathering due to "isekai" and more anime-exclusive tags not being common place in a general sense
  • providing fall back to other providers, which plex tv scanner does not do when an episode summary is not available. the happens alot with anime due to only japanese summary being available for the first few days and then an english one becoming available a day or more later. (hama handles this by using a language priorty)

I will say plex tv scanner does a great job with anime, but not the best and these additonal features and settings is why I use hama

@BitterSweetcandyshop
Copy link

Hama also works with the vip trakt scrobbling, which I presume works with a lucky search of sorts.

@glensc glensc changed the title Feature request: Add AniDB as a provider Feature request: Add AniDB as a provider, Hama.Bundle (anidb|tvdb guid) May 5, 2023
@Amateur-God
Copy link
Author

Amateur-God commented Oct 26, 2023

you could write a script to get the metadata provider of the library and then use the metadata provider of the library to sync with trakt, something like to get the libraries metadata provider

import requests

PLEX_SERVER_IP = "YOUR_PLEX_SERVER_IP"
PLEX_API_KEY = "YOUR_PLEX_API_KEY"

def get_all_plex_metadata_providers():
    url = f"http://{PLEX_SERVER_IP}:32400/library/sections"
    params = {
        "X-Plex-Token": PLEX_API_KEY
    }
    response = requests.get(url, params=params)
    if response.status_code == 200:
        libraries = response.json()["MediaContainer"]["Directory"]
        metadata_providers = {}
        for library in libraries:
            library_id = library["key"]
            metadata_provider = library.get("agent")
            metadata_providers[library_id] = metadata_provider
        return metadata_providers
    else:
        print(f"Error retrieving metadata providers. Status code: {response.status_code}")
        return None

# Example usage
metadata_providers = get_all_plex_metadata_providers()

if metadata_providers:
    for library_id, metadata_provider in metadata_providers.items():
        print(f"Library ID {library_id} uses metadata provider: {metadata_provider}")

then something like to set the prefered provider based on the libraries metadata provider

def choose_correct_show_info(anidb_info, tvdb_info, tmdb_info, imdb_info, plex_metadata_provider):
    # Define the preferred metadata providers for each Plex metadata provider
    provider_preferences = {
        "anidb": [anidb_info, tvdb_info, tmdb_info, imdb_info],
        "tvdb": [tvdb_info, anidb_info, tmdb_info, imdb_info],
        "tmdb": [tmdb_info, tvdb_info, anidb_info, imdb_info],
        "imdb": [imdb_info, tmdb_info, tvdb_info, anidb_info]
    }

    # Use the Plex metadata provider to get the preferred order
    preferred_providers = provider_preferences.get(plex_metadata_provider, [])

    for provider_info in preferred_providers:
        if provider_info and "id" in provider_info:
            return provider_info

    # If none of the preferred providers have valid information, you might want to handle this case
    return None

and then something like to get show information from each of the providers

# Function to get show information from AniDB
def get_anidb_info(title):
    url = f"http://api.anidb.net:9001/httpapi?request=anime&client=plex-sync&clientver=1&protover=1&aid=0&title={title}"
    response = requests.get(url)
    return response.json()

# Function to get show information from TVdb
def get_tvdb_info(title):
    url = f"https://api.thetvdb.com/search/series?name={title}"
    headers = {
        "Authorization": f"Bearer {TVDB_API_KEY}"
    }
    response = requests.get(url, headers=headers)
    return response.json()

# Function to get show information from TMdb
def get_tmdb_info(title):
    url = f"https://api.themoviedb.org/3/search/tv?api_key={TMDB_API_KEY}&query={title}"
    response = requests.get(url)
    return response.json()

# Function to get show information from IMDb
def get_imdb_info(title):
    url = f"https://v2.sg.media-imdb.com/suggests/{title[0]}/{title}.json"
    response = requests.get(url)
    return response.json()

however my python isnt great so ive probably made lots of mistakes in this but its just to give an idea of how i would personally implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants