Code Monkey home page Code Monkey logo

Comments (6)

Omertron avatar Omertron commented on August 10, 2024

Not sure what you mean, can you explain?

from api-imdb.

modmax avatar modmax commented on August 10, 2024

If you call ImdbApi.setLocale(Locale) then the locale will be passed to ApiBuilder.setLocale(Locale).
Due the fact, that ApiBuilder is a static class and has a static reference of "ApiBuilder.imdbLocale".

This is fine in single threade environments where every request wants the same locale.
But if you have multiple threads and some of them wants to use a different Locale then you have a problem; cause then you must synchronize over all Imdb-Api-Calls and set the locale, so that each thread can use it's own locale.

The static reference can be there; as default, But then there should be the possibilit to give a different locale per request. The same is done in TheTVApi and TheMovieDBApi where you pass the language for every request instead of setting a static reference for language in those APIs.

I came to this, cause the ImdbApi does not deliver the same results for different locales; cause some values are localized. Let's regard the cast list: if I use Locale.US everything is fine, but for Locale the role is localized, so that you "(uncredited)" with Locale.US is not the same than with Locale.DE cause the additional values of roles are localized. That makes it very hard to decide for multiple languages if a actor is uncredited or not .. as example.
Therefore I use Locale.US for cast call and for the rest Locale.DE. But due multi-threading I had
to synchromnize the calls, cause I have to set the static locale before every request to have the expected result when multiple threads are used.
Perhaps it's clearer when you have a close look into the "ImbApiWrapper" class in the YAMJ3 project.

from api-imdb.

modmax avatar modmax commented on August 10, 2024

Furtheron I investigated that the API does not return all informations from the web page.
For example the parental guide is missing in the API;
also the API does not return the Top250 info for a movie; and sometime not the biography of a person.
So in YAMJ3 I needed to do some website calls in addition to the API calls to get all informations I want .. :-)

from api-imdb.

modmax avatar modmax commented on August 10, 2024

Just another thing:
Call "imdbApi.setLocale(Locale.US) in the ImdbApiTest constructor.
Otherwise the default locale (for me DE) will be used and for that country the parentalguid does not work ...

from api-imdb.

Omertron avatar Omertron commented on August 10, 2024

You have to remember that this is an "undocumented" API and that most of this is just guess work as to what does and doesn't work in terms of data.

I will refactor to make the locale a per-method call.

from api-imdb.

modmax avatar modmax commented on August 10, 2024

I know ... :-) ... Much better, that you have "documented" somehow ... :-)

from api-imdb.

Related Issues (10)

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.