Search in sources :

Example 1 with Movie

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);
        }
    }
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie)

Example 2 with Movie

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;
}
Also used : Comment(com.uwetrottmann.trakt5.entities.Comment) Episode(com.uwetrottmann.trakt5.entities.Episode) SyncEpisode(com.uwetrottmann.trakt5.entities.SyncEpisode) SyncMovie(com.uwetrottmann.trakt5.entities.SyncMovie) Movie(com.uwetrottmann.trakt5.entities.Movie) Show(com.uwetrottmann.trakt5.entities.Show)

Example 3 with Movie

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;
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie) IOException(java.io.IOException)

Example 4 with 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;
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie) FindResults(com.uwetrottmann.tmdb2.entities.FindResults) IOException(java.io.IOException)

Example 5 with 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;
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie) TvShow(com.uwetrottmann.tmdb2.entities.TvShow) MovieTools(com.battlelancer.seriesguide.ui.movies.MovieTools) TmdbTools2(com.battlelancer.seriesguide.tmdbapi.TmdbTools2)

Aggregations

Movie (com.uwetrottmann.tmdb2.entities.Movie)14 SyncMovie (com.uwetrottmann.trakt5.entities.SyncMovie)3 IOException (java.io.IOException)3 Nullable (androidx.annotation.Nullable)2 MovieDetails (com.battlelancer.seriesguide.ui.movies.MovieDetails)2 Comment (com.uwetrottmann.trakt5.entities.Comment)2 Episode (com.uwetrottmann.trakt5.entities.Episode)2 Movie (com.uwetrottmann.trakt5.entities.Movie)2 Ratings (com.uwetrottmann.trakt5.entities.Ratings)2 Show (com.uwetrottmann.trakt5.entities.Show)2 SyncEpisode (com.uwetrottmann.trakt5.entities.SyncEpisode)2 Movie (org.javaee7.movieplex7.entities.Movie)2 SuppressLint (android.annotation.SuppressLint)1 ContentValues (android.content.ContentValues)1 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