jellyfin / jellyfin-plugin-tvdb

GNU General Public License v3.0
55 stars 32 forks source link

TVDB Language Fallback Not Working #7

Open jomp16 opened 5 years ago

jomp16 commented 5 years ago

Describe the bug Jellyfin doesn't use the default language, English, to fill missing metadata not available in the default metadata language of the library.

To Reproduce

  1. Go to admin panel
  2. Change language metadata of a library for some language not available in TV series or anime in TheTVDB.
  3. Refresh metadata replacing all previous metadata.
  4. Go to the TV series or anime.
  5. See missing title, or synopsis, since the choosen language doesn't have it.

Expected behavior Jellyfin should pick what it can fron the choosen language, but if the metadata is missing (either title, or synopsis, or idk), fallback to English and pick only the missing metadata.

Logs Jellyfin doesn't throws any error in logs.

Screenshots No screenshot yet.

System (please complete the following information):

Additional context From what I remember, with TheTVDB v1, Jellyfin picked the English one if it found a missing metadata from the choosen language.

anthonylavado commented 5 years ago

Okay, I can confirm that it doesn't fallback to English. I haven't tested this against any earlier version, so are we sure this worked before?

jomp16 commented 5 years ago

I'm sure that Emby before they closed the source code did the fallback to English, but I'm not so sure about Jellyfin before the v2 API migration.

If you want to make sure, then when I'll have the time, I'll download a docker container of version 10.0.0 (I guess that was the version before the v2 change, please confirm it for me), and I'll create a new config and library that doesn't have the Portuguese metadata, to check if Jellyfin will fallback to English.

anthonylavado commented 5 years ago

@jomp16 The change was actually in 10.3, so using a version like 10.2.2 should work.

jomp16 commented 5 years ago

Pulled docker image for 10.2.2, currently it's indexing my Animes library, when it finishes, I'll take a look if it did fallback to English.

jomp16 commented 5 years ago

Take a look on it:

https://www.thetvdb.com/series/sword-art-online-alternative-gun-gale-online/episodes/6638735

There's a portuguese (Português) title "Perdedor do SAO", but no synopsis, right?

Jellyfin took the English synopsis as the fallback

image

I hope that helps you that it worked before.

jomp16 commented 5 years ago

Another case:

https://www.thetvdb.com/series/yuki-yuna-is-a-hero/episodes/4946029

https://www.thetvdb.com/series/yuki-yuna-is-a-hero/seasons/1

You can see there isn't "Português" tab, for the entire season of Yuki Yuna is a Hero so there isn't any localized title or synopsis, right?

image

As you can see, Jellyfin did fallback to English title to fill the missing metadata.

anthonylavado commented 5 years ago

@jomp16 Awesome! Thank you for confirming. We'll have to look at it in closer detail. The TVDB API v2 is... complex to say the least.

jomp16 commented 5 years ago

Another thing I think we should take a look is:

TheTVDB v2 doesn't returns all images (banners, logo, etc), even if it's checked "all languages".

Not sure if it's related to this issue, or it's another issue.

I'll try to remember which anime Jellyfin didn't pick the images, even with all languages checked, to check if 10.2.2 works correctly.

anthonylavado commented 5 years ago

So I wonder if this is related: https://forums.thetvdb.com/viewtopic.php?f=116&t=55870

anthonylavado commented 5 years ago

Aha! So I tested the series mentioned here: https://github.com/jellyfin/jellyfin/issues/1342#issuecomment-490153951

This is the response I get from TheTVDB, when requesting language "en" and "pr":

TVDB API v2 Response for language "en" ```json { "data": { "id": 6638735, "airedSeason": 1, "airedSeasonID": 732221, "airedEpisodeNumber": 6, "episodeName": "SAO Loser", "firstAired": "2018-05-20", "guestStars": [], "director": "|Masayuki Sakoi|", "directors": [ "Masayuki Sakoi" ], "writers": [ "Yōsuke Kuroda" ], "overview": "It's Spring break for Karen, and as she returns from her hometown back to Tokyo, she gets a very unexpected guest.", "language": { "episodeName": "en", "overview": "en" }, "productionCode": "", "showUrl": "", "lastUpdated": 1544637940, "dvdDiscid": "|ANZX-14185/6|ANZB-14185/6|", "dvdSeason": 1, "dvdEpisodeNumber": 6, "dvdChapter": null, "absoluteNumber": 6, "filename": "episodes/335815/6638735.jpg", "seriesId": 335815, "lastUpdatedBy": 515485, "airsAfterSeason": null, "airsBeforeSeason": null, "airsBeforeEpisode": null, "thumbAuthor": 457823, "thumbAdded": "2018-05-18 19:45:41", "thumbWidth": "400", "thumbHeight": "225", "imdbId": "tt8375858", "siteRating": 0, "siteRatingCount": 0 } } ```
TVDB API v2 Response for language "pr" ```json { "data": { "id": 6638735, "airedSeason": 1, "airedSeasonID": 732221, "airedEpisodeNumber": 6, "episodeName": "Perdedor do SAO", "firstAired": "2018-05-20", "guestStars": [], "director": "|Masayuki Sakoi|", "directors": [ "Masayuki Sakoi" ], "writers": [ "Yōsuke Kuroda" ], "overview": null, "language": { "episodeName": "pt", "overview": "pt" }, "productionCode": "", "showUrl": "", "lastUpdated": 1544637940, "dvdDiscid": "|ANZX-14185/6|ANZB-14185/6|", "dvdSeason": 1, "dvdEpisodeNumber": 6, "dvdChapter": null, "absoluteNumber": 6, "filename": "episodes/335815/6638735.jpg", "seriesId": 335815, "lastUpdatedBy": 515485, "airsAfterSeason": null, "airsBeforeSeason": null, "airsBeforeEpisode": null, "thumbAuthor": 457823, "thumbAdded": "2018-05-18 19:45:41", "thumbWidth": "400", "thumbHeight": "225", "imdbId": "tt8375858", "siteRating": 0, "siteRatingCount": 0 }, "errors": { "invalidLanguage": "Some translations were not available in the specified language" } } ```

The key part is in the "pr" request, there is this value:

"overview": null

and this message:

  "errors": {
    "invalidLanguage": "Some translations were not available in the specified language"
}

This is consistent with what the API doc says:

Records are returned with the Episode name and Overview in the desired language, if it exists. If there is no translation for the given language, then the record is still returned but with empty values for the translated fields.

Apparently this has been a problem for some time, as seen on The TVDB Forums.


It's a difficult issue. Each request will only accept one language. In the v1 API, it would fallback to English automatically, as the site was originally created with only English supported. We would want to keep using v1 (just like Emby has), but the problem is that it will eventually be shut off (source). The only API keys you can get today are v2 keys, and you can't request a v1 key (we had a legacy one given to us by another user on a temporary basis).

At this point, I don't think we can do anything unless TheTVDB changes their behaviour. It seems they are open to the idea (source), but keep forgetting.

anthonylavado commented 5 years ago

I've asked about this here: https://forums.thetvdb.com/viewtopic.php?f=17&t=56023

jomp16 commented 5 years ago

Wow, at least we know why it stopped working.

How about we create a new option, called fallback language, in the library settings, that makes Jellyfin fallback to the selected language?

Example:

Or make Jellyfin request a choosen metadata language + English (always) at same time, and then merge the JSON output and fill the metadata?

anthonylavado commented 5 years ago

@jomp16 Yeah, I think it’s a good idea to have the choice of a fallback language. It should default to English, but be configurable.

On Matrix, @cvium has mentioned the following:

Anthony Lavado: I think it's fairly easy to do our own fallback since we have a single point of entry here: https://github.com/jellyfin/jellyfin/blob/master/MediaBrowser.Providers/TV/TheTVDB/TvDbClientManager.cs#L205

I guess the way to go is:

I do agree with one thing the TVDB people said, which is that when you get to non-English shows, always using English as a fallback might still produce missing data (hence the configurable secondary language). At least English should be the most popular, so I think it’s a good default.

stale[bot] commented 5 years ago

Issues go stale after 60d of inactivity. Mark the issue as fresh by adding a comment or commit. Stale issues close after an additional 7d of inactivity. If this issue is safe to close now please do so. If you have any questions you can reach us on Matrix or Social Media.

jomp16 commented 5 years ago

Any progress on this issue?

(Preventing the bot from closing this)

anthonylavado commented 5 years ago

@jomp16 - ah not yet, sorry about that. There have been some backend changes with TVDB, so we’ve been waiting for those to settle.

nextlooper42 commented 5 years ago

I just jump into discussion. TBH it would be nice to have fallback in this style:

Prefered language (slovak for example) >> fallback to language 2 (czech for example) >> fallback to language 3 (english for example).

In europe would make this big sense, many countries use multiple languages. At least toggles for localized poster, plot and rating should be added, with fallback to selected language (for example, localized would be Slovak and fallback English).

It should be all about customization, as all thing regarding metadata :)

stale[bot] commented 5 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh by adding a comment or commit. Stale issues close after an additional 14d of inactivity. If this issue is safe to close now please do so. If you have any questions you can reach us on Matrix or Social Media.

anthonylavado commented 5 years ago

shoo bot, we're working on this in another branch

nextlooper42 commented 4 years ago

Still broken in 10.6.2

virusperfect commented 3 years ago

Still broken in 10.6.4

LinAGKar commented 2 years ago

Any progress on this?

makuc commented 1 year ago

Any progress on this?