Fribb / MyAnimeList.bundle

Plex Media Server Metadata Agent for MyAnimeList.net
148 stars 15 forks source link

Metadata not updating #29

Closed miqpro closed 3 years ago

miqpro commented 3 years ago

In some cases API returns null as "title_english". Example: https://jikan.fribbtastic.net/v3/anime/42340

This results in warining message "Title was not available" (jikan.py) and plex ignoring rest of the metadata update (summary, rating etc.).

Defaulting to "title" field works on my setup:

            # get the Title that the user desires from the JSON response and add it to the metadata, if that title isn't available then default to the main
            preferredTitle = str(Prefs["preferredTitle"])
            apiTitle = None

            if preferredTitle == "Japanese":
                apiTitle = self.COMMON_UTILS.getJsonValue("title_japanese", detailResult)
            elif preferredTitle == "English":
                apiTitle = self.COMMON_UTILS.getJsonValue("title_english", detailResult)

            if apiTitle is None:
                apiTitle = self.COMMON_UTILS.getJsonValue("title", detailResult)

            if apiTitle is not None:
                Log.Debug("[" + self.AGENT_NAME + "] " + "Title (" + preferredTitle + "): " + str(apiTitle))
                metadata.title = str(apiTitle)
            else:
                Log.Warn("[" + self.AGENT_NAME + "] " + "Title was not available ")
Fribb commented 3 years ago

This is now fixed, the Agent never fell back to the main title if the specified title was not available