Search in sources :

Example 16 with Movie

use of org.javaee7.movieplex7.entities.Movie in project SeriesGuide by UweTrottmann.

the class MigrationTest method getTestMovieDetails.

private static MovieDetails getTestMovieDetails(@Nullable Integer tmdbId) {
    MovieDetails movieDetails = new MovieDetails();
    Movie tmdbMovie = new Movie();
    if (tmdbId != null) {
        tmdbMovie.id = tmdbId;
    } else {
        tmdbMovie.id = 12;
    }
    movieDetails.tmdbMovie(tmdbMovie);
    return movieDetails;
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie) MovieDetails(com.battlelancer.seriesguide.ui.movies.MovieDetails)

Example 17 with Movie

use of org.javaee7.movieplex7.entities.Movie in project SeriesGuide by UweTrottmann.

the class TraktTask method buildComment.

@Nullable
private Comment buildComment() {
    Comment comment = new Comment();
    comment.comment = args.getString(InitBundle.MESSAGE);
    comment.spoiler = args.getBoolean(InitBundle.ISSPOILER);
    // episode?
    long episodeId = args.getLong(InitBundle.EPISODE_ID);
    if (episodeId != 0) {
        // Check in using episode TMDB ID
        // Note: using show Trakt ID and episode numbers does not work (comments on show).
        int episodeTmdbIdOrZero = SgRoomDatabase.getInstance(context).sgEpisode2Helper().getEpisodeTmdbId(episodeId);
        if (episodeTmdbIdOrZero == 0) {
            Timber.e("Failed to get episode %d", episodeId);
            return null;
        }
        comment.episode = new Episode();
        comment.episode.ids = EpisodeIds.tmdb(episodeTmdbIdOrZero);
        return comment;
    }
    // show?
    long showId = args.getLong(InitBundle.SHOW_ID);
    if (showId != 0) {
        Integer showTraktId = ShowTools.getShowTraktId(context, showId);
        if (showTraktId == null) {
            Timber.e("Failed to get show %d", showId);
            return null;
        }
        comment.show = new Show();
        comment.show.ids = ShowIds.trakt(showTraktId);
        return comment;
    }
    // movie!
    int movieTmdbId = args.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) SuppressLint(android.annotation.SuppressLint) Nullable(androidx.annotation.Nullable)

Example 18 with Movie

use of org.javaee7.movieplex7.entities.Movie in project SeriesGuide by UweTrottmann.

the class MovieTools method loadSummaryFromTmdb.

@Nullable
private com.uwetrottmann.tmdb2.entities.Movie loadSummaryFromTmdb(@Nullable String languageCode, String regionCode, int movieTmdbId) {
    // try to get local movie summary
    Movie movie = getMovieSummary("get local movie summary", languageCode, movieTmdbId, true);
    if (movie != null && !TextUtils.isEmpty(movie.overview)) {
        movieTools2.updateReleaseDateForRegion(movie, movie.release_dates, regionCode);
        return movie;
    }
    // fall back to default language if TMDb has no localized text
    Movie movieFallback = getMovieSummary("get default movie summary", null, movieTmdbId, false);
    if (movieFallback != null) {
        // add note about non-translated or non-existing overview
        String untranslatedOverview = movieFallback.overview;
        movieFallback.overview = TextToolsK.textNoTranslationMovieLanguage(context, languageCode);
        if (!TextUtils.isEmpty(untranslatedOverview)) {
            movieFallback.overview += "\n\n" + untranslatedOverview;
        }
        if (movie != null) {
            movieTools2.updateReleaseDateForRegion(movie, movie.release_dates, regionCode);
        }
    }
    return movieFallback;
}
Also used : Movie(com.uwetrottmann.tmdb2.entities.Movie) Nullable(androidx.annotation.Nullable)

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