Skip to content

Commit

Permalink
Fixes media thumbnails in Kodi Matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
SyncedSynapse committed Apr 10, 2021
1 parent fa130a0 commit 7b63c08
Show file tree
Hide file tree
Showing 16 changed files with 13,859 additions and 53 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/org/xbmc/kore/provider/MediaContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public interface MoviesColumns {
String MOVIEID = "movieid";

String FANART = "fanart";
String THUMBNAIL = "thumbnail";
String POSTER = "thumbnail";
String PLAYCOUNT = "playcount";
String TITLE = "title";
String FILE = "file";
Expand Down Expand Up @@ -179,7 +179,7 @@ public static String getMovieId(Uri uri) {
}

public final static String[] ALL_COLUMNS = {
_ID, UPDATED, HOST_ID, MOVIEID, FANART, THUMBNAIL, PLAYCOUNT, TITLE, FILE, PLOT,
_ID, UPDATED, HOST_ID, MOVIEID, FANART, POSTER, PLAYCOUNT, TITLE, FILE, PLOT,
DIRECTOR, RUNTIME, AUDIO_CHANNELS, AUDIO_CODEC, AUDIO_LANGUAGE,
SUBTITLES_LANGUAGES, VIDEO_ASPECT, VIDEO_CODEC, VIDEO_HEIGHT, VIDEO_WIDTH,
COUNTRIES, GENRES, IMDBNUMBER, MPAA, RATING, SET, SETID, STUDIOS, TAGLINE,
Expand Down Expand Up @@ -227,7 +227,7 @@ public interface TVShowsColumns {
String TVSHOWID = "tvshowid";

String FANART = "fanart";
String THUMBNAIL = "thumbnail";
String POSTER = "thumbnail";
String PLAYCOUNT = "playcount";
String TITLE = "title";
String DATEADDED = "dateadded";
Expand Down Expand Up @@ -274,7 +274,7 @@ public static String getTVShowId(Uri uri) {
}

public final static String[] ALL_COLUMNS = {
_ID, UPDATED, HOST_ID, TVSHOWID, FANART, THUMBNAIL, PLAYCOUNT, TITLE, DATEADDED,
_ID, UPDATED, HOST_ID, TVSHOWID, FANART, POSTER, PLAYCOUNT, TITLE, DATEADDED,
FILE, PLOT, EPISODE, IMDBNUMBER, MPAA, PREMIERED, RATING, STUDIO,
WATCHEDEPISODES, GENRES
};
Expand Down Expand Up @@ -322,7 +322,7 @@ public interface SeasonsColumns {

String LABEL = "label";
String FANART = "fanart";
String THUMBNAIL = "thumbnail";
String POSTER = "thumbnail";
String EPISODE = "episode";
String SHOWTITLE = "showtitle";
String WATCHEDEPISODES = "watchedepisodes";
Expand Down Expand Up @@ -359,7 +359,7 @@ public static String getTVShowSeasonId(Uri uri) {
}

public final static String[] ALL_COLUMNS = {
_ID, UPDATED, HOST_ID, TVSHOWID, SEASON, LABEL, FANART, THUMBNAIL, EPISODE,
_ID, UPDATED, HOST_ID, TVSHOWID, SEASON, LABEL, FANART, POSTER, EPISODE,
SHOWTITLE, WATCHEDEPISODES,
};
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/org/xbmc/kore/provider/MediaDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void onCreate(SQLiteDatabase db) {
MediaContract.MoviesColumns.HOST_ID + " INTEGER NOT NULL " + References.HOST_ID + ", " +
MediaContract.MoviesColumns.MOVIEID + " INTEGER NOT NULL, " +
MediaContract.MoviesColumns.FANART + " TEXT, " +
MediaContract.MoviesColumns.THUMBNAIL + " TEXT, " +
MediaContract.MoviesColumns.POSTER + " TEXT, " +
MediaContract.MoviesColumns.PLAYCOUNT + " INTEGER, " +
MediaContract.MoviesColumns.TITLE + " TEXT, " +
MediaContract.MoviesColumns.FILE + " TEXT, " +
Expand Down Expand Up @@ -229,7 +229,7 @@ public void onCreate(SQLiteDatabase db) {
MediaContract.TVShowsColumns.HOST_ID + " INTEGER NOT NULL " + References.HOST_ID + ", " +
MediaContract.TVShowsColumns.TVSHOWID + " INTEGER NOT NULL, " +
MediaContract.TVShowsColumns.FANART + " TEXT, " +
MediaContract.TVShowsColumns.THUMBNAIL + " TEXT, " +
MediaContract.TVShowsColumns.POSTER + " TEXT, " +
MediaContract.TVShowsColumns.PLAYCOUNT + " INTEGER, " +
MediaContract.TVShowsColumns.TITLE + " TEXT, " +
MediaContract.TVShowsColumns.DATEADDED + " TEXT, " +
Expand Down Expand Up @@ -276,7 +276,7 @@ public void onCreate(SQLiteDatabase db) {
MediaContract.SeasonsColumns.SEASON + " INTEGER NOT NULL, " +
MediaContract.SeasonsColumns.LABEL + " TEXT, " +
MediaContract.SeasonsColumns.FANART + " TEXT, " +
MediaContract.SeasonsColumns.THUMBNAIL + " TEXT, " +
MediaContract.SeasonsColumns.POSTER + " TEXT, " +
MediaContract.SeasonsColumns.EPISODE + " INTEGER, " +
MediaContract.SeasonsColumns.SHOWTITLE + " TEXT, " +
MediaContract.SeasonsColumns.WATCHEDEPISODES + " INTEGER, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void notifyPlaying(PlayerType.GetActivePlayersReturnType getActivePlayer
case ListType.ItemsAll.TYPE_MOVIE:
title = getItemResult.title;
underTitle = getItemResult.tagline;
poster = getItemResult.thumbnail;
poster = getItemResult.art.poster;
smallIcon = R.drawable.ic_movie_white_24dp;
break;
case ListType.ItemsAll.TYPE_EPISODE:
Expand Down
49 changes: 25 additions & 24 deletions app/src/main/java/org/xbmc/kore/service/library/SyncMovies.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,27 @@ public void sync(final SyncOrchestrator orchestrator,
final HostConnection hostConnection,
final Handler callbackHandler,
final ContentResolver contentResolver) {
String properties[] = {
VideoType.FieldsMovie.TITLE, VideoType.FieldsMovie.GENRE,
VideoType.FieldsMovie.YEAR, VideoType.FieldsMovie.RATING,
VideoType.FieldsMovie.DIRECTOR, VideoType.FieldsMovie.TRAILER,
VideoType.FieldsMovie.TAGLINE, VideoType.FieldsMovie.PLOT,
// VideoType.FieldsMovie.PLOTOUTLINE, VideoType.FieldsMovie.ORIGINALTITLE,
// VideoType.FieldsMovie.LASTPLAYED,
VideoType.FieldsMovie.PLAYCOUNT, VideoType.FieldsMovie.DATEADDED,
VideoType.FieldsMovie.WRITER, VideoType.FieldsMovie.STUDIO,
VideoType.FieldsMovie.MPAA, VideoType.FieldsMovie.CAST,
VideoType.FieldsMovie.COUNTRY, VideoType.FieldsMovie.IMDBNUMBER,
VideoType.FieldsMovie.RUNTIME, VideoType.FieldsMovie.SET,
// VideoType.FieldsMovie.SHOWLINK,
VideoType.FieldsMovie.STREAMDETAILS, VideoType.FieldsMovie.TOP250,
VideoType.FieldsMovie.VOTES, VideoType.FieldsMovie.FANART,
VideoType.FieldsMovie.THUMBNAIL, VideoType.FieldsMovie.FILE,
// VideoType.FieldsMovie.SORTTITLE, VideoType.FieldsMovie.RESUME,
VideoType.FieldsMovie.SETID,
// VideoType.FieldsMovie.DATEADDED, VideoType.FieldsMovie.TAG,
// VideoType.FieldsMovie.ART
String[] properties = {
VideoType.FieldsMovie.TITLE, VideoType.FieldsMovie.GENRE,
VideoType.FieldsMovie.YEAR, VideoType.FieldsMovie.RATING,
VideoType.FieldsMovie.DIRECTOR, VideoType.FieldsMovie.TRAILER,
VideoType.FieldsMovie.TAGLINE, VideoType.FieldsMovie.PLOT,
// VideoType.FieldsMovie.PLOTOUTLINE, VideoType.FieldsMovie.ORIGINALTITLE,
// VideoType.FieldsMovie.LASTPLAYED,
VideoType.FieldsMovie.PLAYCOUNT, VideoType.FieldsMovie.DATEADDED,
VideoType.FieldsMovie.WRITER, VideoType.FieldsMovie.STUDIO,
VideoType.FieldsMovie.MPAA, VideoType.FieldsMovie.CAST,
VideoType.FieldsMovie.COUNTRY, VideoType.FieldsMovie.IMDBNUMBER,
VideoType.FieldsMovie.RUNTIME, VideoType.FieldsMovie.SET,
// VideoType.FieldsMovie.SHOWLINK,
VideoType.FieldsMovie.STREAMDETAILS, VideoType.FieldsMovie.TOP250,
VideoType.FieldsMovie.VOTES,
// VideoType.FieldsMovie.FANART, VideoType.FieldsMovie.THUMBNAIL,
VideoType.FieldsMovie.FILE,
// VideoType.FieldsMovie.SORTTITLE, VideoType.FieldsMovie.RESUME,
VideoType.FieldsMovie.SETID,
// VideoType.FieldsMovie.DATEADDED, VideoType.FieldsMovie.TAG,
VideoType.FieldsMovie.ART
};

if (movieId == -1) {
Expand All @@ -117,7 +118,7 @@ public void sync(final SyncOrchestrator orchestrator,
@Override
public void onSuccess(VideoType.DetailsMovie result) {
deleteMovies(contentResolver, hostId, movieId);
List<VideoType.DetailsMovie> movies = new ArrayList<VideoType.DetailsMovie>(1);
List<VideoType.DetailsMovie> movies = new ArrayList<>(1);
movies.add(result);
insertMovies(orchestrator, contentResolver, movies);
orchestrator.syncItemFinished();
Expand All @@ -142,7 +143,7 @@ private void syncAllMovies(final SyncOrchestrator orchestrator,
final HostConnection hostConnection,
final Handler callbackHandler,
final ContentResolver contentResolver,
final String properties[],
final String[] properties,
final int startIdx) {
// Call GetMovies with the current limits set
ListType.Limits limits = new ListType.Limits(startIdx, startIdx + LIMIT_SYNC_MOVIES);
Expand Down Expand Up @@ -215,7 +216,7 @@ private void deleteMovies(final ContentResolver contentResolver,
private void insertMovies(final SyncOrchestrator orchestrator,
final ContentResolver contentResolver,
final List<VideoType.DetailsMovie> movies) {
ContentValues movieValuesBatch[] = new ContentValues[movies.size()];
ContentValues[] movieValuesBatch = new ContentValues[movies.size()];
int castCount = 0;

// Iterate on each movie
Expand All @@ -228,7 +229,7 @@ private void insertMovies(final SyncOrchestrator orchestrator,
// Insert the movies
contentResolver.bulkInsert(MediaContract.Movies.CONTENT_URI, movieValuesBatch);

ContentValues movieCastValuesBatch[] = new ContentValues[castCount];
ContentValues[] movieCastValuesBatch = new ContentValues[castCount];
int count = 0;
// Iterate on each movie/cast
for (VideoType.DetailsMovie movie : movies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public Bundle getSyncExtras() {
VideoType.FieldsTVShow.EPISODE, VideoType.FieldsTVShow.IMDBNUMBER,
VideoType.FieldsTVShow.PREMIERED,
//VideoType.FieldsTVShow.VOTES, VideoType.FieldsTVShow.LASTPLAYED,
VideoType.FieldsTVShow.FANART, VideoType.FieldsTVShow.THUMBNAIL,
VideoType.FieldsTVShow.ART,
//VideoType.FieldsTVShow.FANART, VideoType.FieldsTVShow.THUMBNAIL,
VideoType.FieldsTVShow.FILE,
//VideoType.FieldsTVShow.ORIGINALTITLE, VideoType.FieldsTVShow.SORTTITLE,
// VideoType.FieldsTVShow.EPISODEGUIDE, VideoType.FieldsTVShow.SEASON,
Expand Down Expand Up @@ -209,7 +210,8 @@ private void deleteTVShows(final ContentResolver contentResolver,
VideoType.FieldsSeason.SEASON, VideoType.FieldsSeason.SHOWTITLE,
//VideoType.FieldsSeason.PLAYCOUNT,
VideoType.FieldsSeason.EPISODE,
VideoType.FieldsSeason.FANART, VideoType.FieldsSeason.THUMBNAIL,
//VideoType.FieldsSeason.FANART, VideoType.FieldsSeason.THUMBNAIL,
VideoType.FieldsSeason.ART,
VideoType.FieldsSeason.TVSHOWID, VideoType.FieldsSeason.WATCHEDEPISODES,
//VideoType.FieldsSeason.ART
};
Expand Down Expand Up @@ -278,6 +280,7 @@ public void onError(int errorCode, String description) {
//VideoType.FieldsEpisode.CAST,
VideoType.FieldsEpisode.STREAMDETAILS,
//VideoType.FieldsEpisode.LASTPLAYED,
//VideoType.FieldsEpisode.ART,
VideoType.FieldsEpisode.FANART, VideoType.FieldsEpisode.THUMBNAIL,
VideoType.FieldsEpisode.FILE,
//VideoType.FieldsEpisode.RESUME,
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/org/xbmc/kore/service/library/SyncUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public static ContentValues contentValuesFromMovie(int hostId, VideoType.Details
ContentValues movieValues = new ContentValues();
movieValues.put(MediaContract.MoviesColumns.HOST_ID, hostId);
movieValues.put(MediaContract.MoviesColumns.MOVIEID, movie.movieid);
movieValues.put(MediaContract.MoviesColumns.FANART, movie.fanart);
movieValues.put(MediaContract.MoviesColumns.THUMBNAIL, movie.thumbnail);
movieValues.put(MediaContract.MoviesColumns.FANART, movie.art.fanart);
movieValues.put(MediaContract.MoviesColumns.POSTER, movie.art.poster);
movieValues.put(MediaContract.MoviesColumns.PLAYCOUNT, movie.playcount);
movieValues.put(MediaContract.MoviesColumns.DATEADDED, movie.dateadded);
movieValues.put(MediaContract.MoviesColumns.LASTPLAYED, movie.lastplayed);
Expand Down Expand Up @@ -152,8 +152,8 @@ public static ContentValues contentValuesFromTVShow(int hostId, VideoType.Detail

tvshowValues.put(MediaContract.TVShowsColumns.HOST_ID, hostId);
tvshowValues.put(MediaContract.TVShowsColumns.TVSHOWID, tvshow.tvshowid);
tvshowValues.put(MediaContract.TVShowsColumns.FANART, tvshow.fanart);
tvshowValues.put(MediaContract.TVShowsColumns.THUMBNAIL, tvshow.thumbnail);
tvshowValues.put(MediaContract.TVShowsColumns.FANART, tvshow.art.fanart);
tvshowValues.put(MediaContract.TVShowsColumns.POSTER, tvshow.art.poster);
tvshowValues.put(MediaContract.TVShowsColumns.PLAYCOUNT, tvshow.playcount);
tvshowValues.put(MediaContract.TVShowsColumns.TITLE, tvshow.title);
tvshowValues.put(MediaContract.TVShowsColumns.DATEADDED, tvshow.dateadded);
Expand Down Expand Up @@ -188,8 +188,8 @@ public static ContentValues contentValuesFromSeason(int hostId, VideoType.Detail
seasonValues.put(MediaContract.SeasonsColumns.TVSHOWID, season.tvshowid);
seasonValues.put(MediaContract.SeasonsColumns.SEASON, season.season);
seasonValues.put(MediaContract.SeasonsColumns.LABEL, season.label);
seasonValues.put(MediaContract.SeasonsColumns.FANART, season.fanart);
seasonValues.put(MediaContract.SeasonsColumns.THUMBNAIL, season.thumbnail);
seasonValues.put(MediaContract.SeasonsColumns.FANART, season.art.fanart);
seasonValues.put(MediaContract.SeasonsColumns.POSTER, season.art.poster);
seasonValues.put(MediaContract.SeasonsColumns.EPISODE, season.episode);
seasonValues.put(MediaContract.SeasonsColumns.SHOWTITLE, season.showtitle);
seasonValues.put(MediaContract.SeasonsColumns.WATCHEDEPISODES, season.watchedepisodes);
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/xbmc/kore/ui/BaseMediaActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@ private void updateNowPlayingPanel(PlayerType.PropertyValue getPropertiesResult,
case ListType.ItemsAll.TYPE_MOVIE:
title = getItemResult.title;
details = getItemResult.tagline;
poster = TextUtils.isEmpty(getItemResult.thumbnail) ? getItemResult.fanart
: getItemResult.thumbnail;
poster = TextUtils.isEmpty(getItemResult.art.poster) ? getItemResult.art.fanart
: getItemResult.art.poster;
break;
case ListType.ItemsAll.TYPE_EPISODE:
title = getItemResult.title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ private void setNowPlayingInfo(PlayerType.GetActivePlayersReturnType getActivePl

title = getItemResult.title;
underTitle = getItemResult.tagline;
art = getItemResult.fanart;
poster = getItemResult.thumbnail;
art = getItemResult.art.fanart;
poster = getItemResult.art.poster;

genreSeason = Utils.listStringConcat(getItemResult.genre, ", ");
year = (getItemResult.year > 0)? String.format("%d", getItemResult.year) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
case ListType.ItemsAll.TYPE_MOVIE:
title = TextUtils.isEmpty(item.title)? item.label : item.title;
details = item.tagline;
artUrl = item.thumbnail;
artUrl = item.art.poster;
duration = item.runtime;
break;
case ListType.ItemsAll.TYPE_EPISODE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ private void setNowPlayingInfo(ListType.ItemsAll nowPlaying,

title = nowPlaying.title;
underTitle = nowPlaying.tagline;
thumbnailUrl = nowPlaying.thumbnail;
thumbnailUrl = nowPlaying.art.poster;
currentFastForwardIcon = fastForwardIcon;
currentRewindIcon = rewindIcon;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ private interface MovieDetailsQuery {
BaseColumns._ID,
MediaContract.Movies.TITLE,
MediaContract.Movies.TAGLINE,
MediaContract.Movies.THUMBNAIL,
MediaContract.Movies.POSTER,
MediaContract.Movies.FANART,
MediaContract.Movies.YEAR,
MediaContract.Movies.GENRES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private interface MovieListQuery {
BaseColumns._ID,
MediaContract.Movies.MOVIEID,
MediaContract.Movies.TITLE,
MediaContract.Movies.THUMBNAIL,
MediaContract.Movies.POSTER,
MediaContract.Movies.YEAR,
MediaContract.Movies.GENRES,
MediaContract.Movies.RUNTIME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private interface TVShowDetailsQuery {
String[] PROJECTION = {
BaseColumns._ID,
MediaContract.TVShows.TITLE,
MediaContract.TVShows.THUMBNAIL,
MediaContract.TVShows.POSTER,
MediaContract.TVShows.FANART,
MediaContract.TVShows.PREMIERED,
MediaContract.TVShows.STUDIO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private interface TVShowListQuery {
BaseColumns._ID,
MediaContract.TVShows.TVSHOWID,
MediaContract.TVShows.TITLE,
MediaContract.TVShows.THUMBNAIL,
MediaContract.TVShows.POSTER,
MediaContract.TVShows.FANART,
MediaContract.TVShows.PREMIERED,
MediaContract.TVShows.STUDIO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ private interface SeasonsListQuery {
String[] PROJECTION = {
BaseColumns._ID,
MediaContract.Seasons.SEASON,
MediaContract.Seasons.THUMBNAIL,
MediaContract.Seasons.POSTER,
MediaContract.Seasons.EPISODE,
MediaContract.Seasons.WATCHEDEPISODES
};
Expand Down
Loading

0 comments on commit 7b63c08

Please sign in to comment.