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;
}
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));
}
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;
}
Aggregations