Skip to content

Commit

Permalink
atv channels refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
yuliskov committed Nov 8, 2024
1 parent dad1fcf commit b618756
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,25 +224,25 @@ public static void deleteWatchNextContinue(Context context, String clipId) {

@WorkerThread
public static void createOrUpdateChannel(Context context, Playlist playlist) {
long oldChannelId = playlist.getPublishedId();
long publishedId = playlist.getPublishedId();

Channel channel = findChannelByProviderId(context, playlist.getPlaylistId());

if (oldChannelId != -1) {
Log.d(TAG, "Oops: channel already published. Doing update instead... oldChannelId: " + oldChannelId);
if (publishedId != -1) {
Log.d(TAG, "Oops: channel already published. Doing update instead... publishedId: " + publishedId);
updateChannel(context, playlist);
addClipsToChannel(context, oldChannelId, Helpers.isGoogleTVLauncher(context) || channel.isBrowsable() ? playlist.getClips() : Collections.emptyList());
//addClipsToChannel(context, publishedId, Helpers.isGoogleTVLauncher(context) || channel.isBrowsable() ? playlist.getClips() : Collections.emptyList());
addClipsToChannel(context, publishedId, playlist.getClips());
return;
//return oldChannelId;
}

Channel channel = findChannelByProviderId(context, playlist.getPlaylistId());

if (channel != null) {
Log.d(TAG, "Oops: channel already published but not memorized by the app. Doing update instead... foundId: " + channel.getId());
playlist.setPublishedId(channel.getId());
updateChannel(context, playlist);
addClipsToChannel(context, channel.getId(), Helpers.isGoogleTVLauncher(context) || channel.isBrowsable() ? playlist.getClips() : Collections.emptyList());
//addClipsToChannel(context, channel.getId(), Helpers.isGoogleTVLauncher(context) || channel.isBrowsable() ? playlist.getClips() : Collections.emptyList());
addClipsToChannel(context, channel.getId(), playlist.getClips());
return;
//return channel.getId();
}

Log.d(TAG, "Creating channel: " + playlist.getName());
Expand All @@ -252,8 +252,6 @@ public static void createOrUpdateChannel(Context context, Playlist playlist) {
// The channels are disabled by default (don't populate to save resources)
//addClipsToChannel(context, channelId, Collections.emptyList());
addClipsToChannel(context, channelId, playlist.getClips());

//return channelId;
}

private static long createChannel(Context context, Playlist playlist) {
Expand Down
4 changes: 2 additions & 2 deletions smarttubetv/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ android {
applicationId "com.liskovsoft.smarttubetv"
minSdkVersion project.properties.minSdkVersion
targetSdkVersion project.properties.targetSdkVersion
versionCode 1646
versionName "24.56"
versionCode 1647
versionName "24.57"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"

Expand Down

0 comments on commit b618756

Please sign in to comment.