Jump to content

FR: Follow TMDB's new language API update


anderbytes

Recommended Posts

anderbytes

As seen in this post: https://www.themoviedb.org/talk/5119221d760ee36c642af4ad  , there's a new update to the API engine where now they can tell apart PT-PT from PT-BR (usually was only PT)

 

I just tested that it works perfectly in new API, as seen below.

 

Movie: Die Hard 2

 

PT (only one until yesterday): https://api.themoviedb.org/3/movie/1573?api_key=##YOUR_API_HERE##&language=pt

PT-PT (now official PT for Portugal) : https://api.themoviedb.org/3/movie/1573?api_key=##YOUR_API_HERE##&language=pt-PT

{"adult":false,"backdrop_path":"/kywkOlRpYtfVlar41R1s8lO46vD.jpg","belongs_to_collection":{"id":1570,"name":"Duro de Matar - Coletânea","poster_path":
"/mbJHXe0fooS9ukOZsZ4PmDQnjcw.jpg","backdrop_path":"/5kHVblr87FUScuab1PVSsK692IL.jpg"},"budget":70000000,"genres":[{"id":28,"name":"Ação"},{"id":53,
"name":"Thriller"}],"homepage":"","id":1573,"imdb_id":"tt0099423","original_language":"en","original_title":"Die Hard 2","overview":"Terroristas
 assumem o controle do aeroporto de Washington, visando libertar um preso político (Franco Nero) que está sendo extraditado, e ameaçam destruir várias
 aeronaves se as exigências deles não forem cumpridas. Mas a esposa (Bonnie Bedelia) de John McClane (Bruce Willis) está em um dos aviões, assim ele
 resolve enfrentar a quadrilha sozinho.","popularity":2.824351,"poster_path":"/2vHKly0sePRowvOGZbQL5PuhwHn.jpg","production_companies":[{"name":
"Twentieth Century Fox Film Corporation","id":306},{"name":"Gordon Company","id":1073},{"name":"Silver Pictures","id":1885}],"production_countries":
[{"iso_3166_1":"US","name":"United States of America"}],"release_date":"1990-07-02","revenue":240031094,"runtime":124,"spoken_languages":[{"iso_639_1":
"en","name":"English"},{"iso_639_1":"es","name":"Español"}],"status":"Released","tagline":"John McClane está de volta na hora e no lugar errados.",
"title":"Assalto ao Aeroporto","video":false,"vote_average":6.4,"vote_count":1045}

PT-BR (item with Brazilian info): https://api.themoviedb.org/3/movie/1573?api_key=##YOUR_API_HERE##&language=pt-BR

{"adult":false,"backdrop_path":"/kywkOlRpYtfVlar41R1s8lO46vD.jpg","belongs_to_collection":{"id":1570,"name":"Duro de Matar (Coleção)","poster_path":
"/mbJHXe0fooS9ukOZsZ4PmDQnjcw.jpg","backdrop_path":"/5kHVblr87FUScuab1PVSsK692IL.jpg"},"budget":70000000,"genres":[{"id":28,"name":"Ação"},{"id":53,
"name":"Thriller"}],"homepage":"","id":1573,"imdb_id":"tt0099423","original_language":"en","original_title":"Die Hard 2","overview":"Terroristas
 assumem o controle do aeroporto de Washington, visando libertar um preso político (Franco Nero) que está sendo extraditado, e ameaçam destruir várias
 aeronaves se as exigências deles não forem cumpridas. Mas a esposa (Bonnie Bedelia) de John McClane (Bruce Willis), um detetive de Nova York, se
 encontra em um dos aviões, assim o marido resolve enfrentar a quadrilha.","popularity":2.824351,"poster_path":"/2vHKly0sePRowvOGZbQL5PuhwHn.jpg",
"production_companies":[{"name":"Twentieth Century Fox Film Corporation","id":306},{"name":"Gordon Company","id":1073},{"name":"Silver Pictures","id":
1885}],"production_countries":[{"iso_3166_1":"US","name":"United States of America"}],"release_date":"1990-07-02","revenue":240031094,"runtime":0,
"spoken_languages":[{"iso_639_1":"en","name":"English"},{"iso_639_1":"es","name":"Español"}],"status":"Released","tagline":"","title":"Duro de Matar 2",
"video":false,"vote_average":6.4,"vote_count":1045}

As they created the PT-BR database from scratch, there will be movies/series missing... but users are adding they in a daily basis, and with the correct info!

 

PLEASE make Emby query correctly pt-BR from TMDB after this update. I`m tired of getting movie names from Portugal.

 

ps: I tried to color the title difference inside the boxes above, but it hasn`t worked. So please note the TITLE difference between them.

Edited by anderbytes
Link to comment
Share on other sites

anderbytes

@@ebr, @@cmcg, @@Luke,

 

This is very important for us Brazilian emby users.

Tnx

 

 

PS: found out that what arrives in "searchInfo.MetadataLanguage" variable passed in (https://github.com/MediaBrowser/Emby/blob/067164f9810736229ecfc1a3d3c0188c9ab4ac3a/MediaBrowser.Providers/Movies/MovieDbProvider.cs#L74) has to pass "pt-BR" from now when Metadata language is configured for "Portuguese (Brazilian)".

 

Can this be made possible? Are there other places to update?

Tnx

Edited by anderbytes
Link to comment
Share on other sites

anderbytes

Forget it.... I've inspected the code and you're doing it right.

 

There's something missing in their SEARCH API.

 

 

Search API corrected. Adjustments in Emby needed as explained in the next post.

Edited by anderbytes
  • Like 1
Link to comment
Share on other sites

anderbytes

@@Luke , the Search API is finally done in TheMovieDB for pt-BR... but there's something that needs adjusting in Emby.

 

As seen today in https://www.themoviedb.org/talk/5119221d760ee36c642af4ad?page=3#56e372a0c3a3685a9e0019ab , the correct typing is "pt-BR" and can't be searched by "pt-br" or anything different than former. The devs there couldn't make it case insensitive, and Emby tries to search using "pt-br", as seen in server logs. :(

 

From what I've found in GitHub, there's only one place in code that the "pt-br" is in small case:

https://github.com/MediaBrowser/Emby/blob/master/MediaBrowser.Server.Implementations/Localization/iso6392.txt#L349

 

Can this be changed to "pt-BR" so the search returns correctly?

 

If you somewhere in the code transform it to small case.... please avoid it, too.

 

Look at how the title differs from:

https://api.themoviedb.org/3/search/movie?api_key=##API_KEY##&query=die+hard+2&year=1990&language=pt-br

to

https://api.themoviedb.org/3/search/movie?api_key=##API_KEY##&query=die+hard+2&year=1990&language=pt-BR

 

 

If I'm right, this is a VERY EASY change to make. I ask you to put it in next stable.

Thanks!!

Edited by anderbytes
Link to comment
Share on other sites

why couldn't they make it case insensitive? they should uppercase on their side if they need that. that's not a very friendly api design. that means every application that uses Tmdb has to update now

  • Like 1
Link to comment
Share on other sites

anderbytes

why couldn't they make it case insensitive? they should uppercase on their side if they need that. that's not a very friendly api design. that means every application that uses Tmdb has to update now

 

I don't know :(

If you notice at the post I mentioned, you'll see I tried to ask them to make case insensitive.

 

 

Personally.... I always thought that "pt-BR" was the correct way to spell it. I've seen some other apps like "Subliminal (subtitle downloader)" that automatically renames to "pt-BR" when choosing portuguese from brazil subtitles.

Link to comment
Share on other sites

anderbytes

That's the only thing that is pending to make Portuguese (Brazil) searches for metadata in Emby better than they ever were.

Please consider.

Link to comment
Share on other sites

anderbytes

why couldn't they make it case insensitive? they should uppercase on their side if they need that. that's not a very friendly api design. that means every application that uses Tmdb has to update now

 

I think I found some standard here.

 

https://tools.ietf.org/html/bcp47#page-1-13

3.1.4.  Subtag and Tag Fields

   The field 'Subtag' contains the subtag defined in the record.  The
   field 'Tag' appears in records whose 'Type' is either 'grandfathered'
   or 'redundant' and contains a tag registered under [RFC3066].

   The 'Subtag' field-body MUST follow the casing conventions described
   in Section 2.1.1.  All subtags use lowercase letters in the field-
   body, with two exceptions:

      Subtags whose 'Type' field is 'script' (in other words, subtags
      defined by ISO 15924) MUST use titlecase.

      Subtags whose 'Type' field is 'region' (in other words, the non-
      numeric region subtags defined by ISO 3166-1) MUST use all
      uppercase.

   The 'Tag' field-body MUST be formatted according to the rules
   described in Section 2.1.1.

"...Subtags whose 'Type' field is 'region' (in other words, the non-numeric region subtags defined by ISO 3166-1) MUST use all uppercase...."

 

--> Probably that's what TheMovieDB is following.

Edited by anderbytes
Link to comment
Share on other sites

  • 2 years later...

I don't know :(

If you notice at the post I mentioned, you'll see I tried to ask them to make case insensitive.

 

 

Personally.... I always thought that "pt-BR" was the correct way to spell it. I've seen some other apps like "Subliminal (subtitle downloader)" that automatically renames to "pt-BR" when choosing portuguese from brazil subtitles.

Addic7ed is now in the Emby plugin catalog. You'll need to configure your Addic7ed credentials in the plugin configuration. Enjoy.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...