use of org.javaee7.movieplex7.entities.Movie in project SeriesGuide by UweTrottmann.
the class MoviesAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof MovieViewHolder) {
MovieViewHolder actualHolder = (MovieViewHolder) holder;
Movie movie = getMovie(position);
actualHolder.movieTmdbId = movie.id;
actualHolder.title.setText(movie.title);
if (movie.release_date != null) {
actualHolder.date.setText(dateFormatMovieReleaseDate.format(movie.release_date));
} else {
actualHolder.date.setText("");
}
// poster
// use fixed size so bitmaps can be re-used on config change
ServiceUtils.loadWithPicasso(context, posterBaseUrl + movie.poster_path).resizeDimen(R.dimen.movie_poster_width, R.dimen.movie_poster_height).centerCrop().into(actualHolder.poster);
// set unique transition names
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
actualHolder.poster.setTransitionName(getTransitionNamePrefix() + movie.id);
}
}
}
use of org.javaee7.movieplex7.entities.Movie in project SeriesGuide by UweTrottmann.
the class TraktTask method buildComment.
private Comment buildComment() {
Comment comment = new Comment();
comment.comment = mArgs.getString(InitBundle.MESSAGE);
comment.spoiler = mArgs.getBoolean(InitBundle.ISSPOILER);
// as determined by "science", episode comments are most likely, so check for them first
// episode?
int episodeTvdbId = mArgs.getInt(InitBundle.EPISODE_TVDBID);
if (episodeTvdbId != 0) {
comment.episode = new Episode();
comment.episode.ids = EpisodeIds.tvdb(episodeTvdbId);
return comment;
}
// show?
int showTvdbId = mArgs.getInt(InitBundle.SHOW_TVDBID);
if (showTvdbId != 0) {
comment.show = new Show();
comment.show.ids = ShowIds.tvdb(showTvdbId);
return comment;
}
// movie!
int movieTmdbId = mArgs.getInt(InitBundle.MOVIE_TMDB_ID);
comment.movie = new Movie();
comment.movie.ids = MovieIds.tmdb(movieTmdbId);
return comment;
}
use of org.javaee7.movieplex7.entities.Movie in project nzbhydra2 by theotherp.
the class TmdbHandler method getMovieByTmdbId.
private Movie getMovieByTmdbId(String tmdbId) throws InfoProviderException {
Movie movie;
Call<Movie> movieCall = tmdb.moviesService().summary(Integer.valueOf(tmdbId), configProvider.getBaseConfig().getSearching().getLanguage().orElse("en"), null);
try {
Response<Movie> response = movieCall.execute();
if (!response.isSuccessful()) {
throw new InfoProviderException("Error while contacting TMDB: " + response.errorBody().string());
}
movie = response.body();
} catch (IOException e) {
throw new InfoProviderException("Error while contacting TMDB", e);
}
return movie;
}
use of org.javaee7.movieplex7.entities.Movie in project nzbhydra2 by theotherp.
the class TmdbHandler method getMovieByImdbId.
private Movie getMovieByImdbId(String imdbId) throws InfoProviderException {
Movie movie;
Call<FindResults> resultsCall = tmdb.findService().find(imdbId, ExternalSource.IMDB_ID, configProvider.getBaseConfig().getSearching().getLanguage().orElse("en"));
try {
Response<FindResults> response = resultsCall.execute();
if (!response.isSuccessful()) {
throw new InfoProviderException("Error while contacting TMDB: " + response.errorBody().string());
}
if (response.body().movie_results.size() == 0) {
throw new InfoProviderException(String.format("TMDB query for IMDB ID %s returned no searchResults", imdbId));
}
movie = response.body().movie_results.get(0);
} catch (IOException e) {
throw new InfoProviderException("Error while contacting TMDB", e);
}
return movie;
}
use of org.javaee7.movieplex7.entities.Movie in project SeriesGuide by UweTrottmann.
the class SgPicassoRequestHandler method load.
@Override
public Result load(Request request, int networkPolicy) throws IOException {
String scheme = request.uri.getScheme();
String host = request.uri.getHost();
if (host == null)
return null;
if (SCHEME_SHOW_TMDB.equals(scheme)) {
int showTmdbId = Integer.parseInt(host);
String language = request.uri.getQueryParameter(QUERY_LANGUAGE);
if (language == null || language.length() == 0) {
language = DisplaySettings.LANGUAGE_EN;
}
TvShow showDetails = new TmdbTools2().getShowDetails(showTmdbId, language, context);
if (showDetails != null) {
String url = ImageTools.tmdbOrTvdbPosterUrl(showDetails.poster_path, context, false);
if (url != null) {
return loadFromNetwork(Uri.parse(url), networkPolicy);
}
}
}
if (SCHEME_MOVIE_TMDB.equals(scheme)) {
int movieTmdbId = Integer.valueOf(host);
MovieTools movieTools = SgApp.getServicesComponent(context).movieTools();
Movie movieSummary = movieTools.getMovieSummary(movieTmdbId);
if (movieSummary != null && movieSummary.poster_path != null) {
final String imageUrl = TmdbSettings.getImageBaseUrl(context) + TmdbSettings.POSTER_SIZE_SPEC_W342 + movieSummary.poster_path;
return loadFromNetwork(Uri.parse(imageUrl), networkPolicy);
}
}
return null;
}
Aggregations