Search in sources :

Example 6 with Movie

use of com.uwetrottmann.tmdb2.entities.Movie in project SeriesGuide by UweTrottmann.

the class MovieTools method loadSummaryFromTmdb.

@Nullable
private com.uwetrottmann.tmdb2.entities.Movie loadSummaryFromTmdb(String languageCode, int movieTmdbId) {
    // try to get local movie summary
    Movie movie = getMovieSummary("get local movie summary", languageCode, movieTmdbId);
    if (movie != null && !TextUtils.isEmpty(movie.overview)) {
        return movie;
    }
    // fall back to default language if TMDb has no localized text
    movie = getMovieSummary("get default movie summary", null, movieTmdbId);
    if (movie != null) {
        // add note about non-translated or non-existing overview
        String untranslatedOverview = movie.overview;
        movie.overview = context.getString(R.string.no_translation, LanguageTools.getMovieLanguageStringFor(context, languageCode), context.getString(R.string.tmdb));
        if (!TextUtils.isEmpty(untranslatedOverview)) {
            movie.overview += "\n\n" + untranslatedOverview;
        }
    }
    return movie;
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie) BaseMovie(com.uwetrottmann.trakt5.entities.BaseMovie) SyncMovie(com.uwetrottmann.trakt5.entities.SyncMovie) Nullable(android.support.annotation.Nullable)

Example 7 with Movie

use of com.uwetrottmann.tmdb2.entities.Movie in project javaee7-firstcup by ecabrerar.

the class MovieClientBean method addMovie.

public void addMovie() {
    Movie m = new Movie();
    m.setId(bean.getMovieId());
    m.setName(bean.getMovieName());
    m.setActors(bean.getActors());
    target.register(MovieWriter.class).request().post(Entity.entity(m, MediaType.APPLICATION_JSON));
}
Also used : Movie(org.javaee7.movieplex7.entities.Movie)

Example 8 with Movie

use of com.uwetrottmann.tmdb2.entities.Movie in project javaee7-firstcup by ecabrerar.

the class MovieReader method readFrom.

@Override
public Movie readFrom(Class<Movie> type, Type type1, Annotation[] antns, MediaType mt, MultivaluedMap<String, String> mm, InputStream in) throws IOException, WebApplicationException {
    Movie movie = new Movie();
    JsonParser parser = Json.createParser(in);
    while (parser.hasNext()) {
        switch(parser.next()) {
            case KEY_NAME:
                String key = parser.getString();
                parser.next();
                switch(key) {
                    case "id":
                        movie.setId(parser.getInt());
                        break;
                    case "name":
                        movie.setName(parser.getString());
                        break;
                    case "actors":
                        movie.setActors(parser.getString());
                        break;
                    default:
                        break;
                }
                break;
            default:
                break;
        }
    }
    return movie;
}
Also used : Movie(org.javaee7.movieplex7.entities.Movie) JsonParser(javax.json.stream.JsonParser)

Aggregations

Movie (com.uwetrottmann.tmdb2.entities.Movie)5 Ratings (com.uwetrottmann.trakt5.entities.Ratings)2 SyncMovie (com.uwetrottmann.trakt5.entities.SyncMovie)2 Movie (org.javaee7.movieplex7.entities.Movie)2 Intent (android.content.Intent)1 Cursor (android.database.Cursor)1 Bitmap (android.graphics.Bitmap)1 Nullable (android.support.annotation.Nullable)1 NestedScrollView (android.support.v4.widget.NestedScrollView)1 Palette (android.support.v7.graphics.Palette)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 MovieDetails (com.battlelancer.seriesguide.items.MovieDetails)1 MovieCheckInDialogFragment (com.battlelancer.seriesguide.ui.dialogs.MovieCheckInDialogFragment)1 LanguageTools (com.battlelancer.seriesguide.util.LanguageTools)1 Callback (com.squareup.picasso.Callback)1 DiscoverFilter (com.uwetrottmann.tmdb2.entities.DiscoverFilter)1