Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.liskovsoft.sharedutils.prefs.GlobalPreferences;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.service.VideoStateService;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.service.VideoStateService.State;
import com.liskovsoft.smartyoutubetv2.common.filter.KeywordFilterManager;
import com.liskovsoft.smartyoutubetv2.common.prefs.BlockedChannelData;

import java.util.ArrayList;
Expand Down Expand Up @@ -454,7 +455,7 @@ public void add(Video video) {
}

public void add(int idx, Video video) {
if (video == null || video.isEmpty() || isChannelBlocked(video) || isWatchedAndRecommended(video)) {
if (video == null || video.isEmpty() || isChannelBlocked(video) || isKeywordBlocked(video) || isWatchedAndRecommended(video)) {
return;
}

Expand Down Expand Up @@ -493,6 +494,14 @@ private boolean isChannelBlocked(Video video) {
return blockedChannelData.containsChannel(channelId, channelName);
}

private boolean isKeywordBlocked(Video video) {
if (video == null || video.isChapter) {
return false;
}

return KeywordFilterManager.instance(GlobalPreferences.context()).isBlocked(video.getTitle());
}

private boolean isWatchedAndRecommended(Video video) {
if (video == null) {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.liskovsoft.smartyoutubetv2.common.app.presenters;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.Pair;

Expand Down Expand Up @@ -744,11 +744,19 @@ private void updateVideoRows(BrowseSection section, Observable<List<MediaGroup>>

VideoGroup videoGroup = VideoGroup.from(mediaGroup, section);

// SKIP EMPTY GROUPS
if (videoGroup == null ||
videoGroup.getVideos() == null ||
videoGroup.getVideos().isEmpty()) {
continue;
}

if (TextUtils.isEmpty(videoGroup.getTitle())) {
videoGroup.setTitle(getContext().getString(R.string.suggestions));
}

getView().updateSection(videoGroup);

mBrowseProcessor.process(videoGroup);

continueGroupIfNeeded(videoGroup, false);
Expand Down Expand Up @@ -798,8 +806,20 @@ private void updateVideoGrid(BrowseSection section, Observable<MediaGroup> group
}

VideoGroup videoGroup = VideoGroup.from(baseGroup, mediaGroup);

appendLocalHistory(videoGroup);

// SKIP EMPTY GROUPS
if (videoGroup == null ||
videoGroup.getVideos() == null ||
videoGroup.getVideos().isEmpty()) {

getView().showProgressBar(false);
return;
}

getView().updateSection(videoGroup);

mBrowseProcessor.process(videoGroup);

continueGroupIfNeeded(videoGroup);
Expand Down Expand Up @@ -857,7 +877,18 @@ private void continueGroup(VideoGroup group, boolean showLoading) {
getView().showProgressBar(false);

VideoGroup videoGroup = VideoGroup.from(group, continueGroup);

// SKIP EMPTY CONTINUATIONS
if (videoGroup == null ||
videoGroup.getVideos() == null ||
videoGroup.getVideos().isEmpty()) {

getView().showProgressBar(false);
return;
}

getView().updateSection(videoGroup);

mBrowseProcessor.process(videoGroup);

continueGroupIfNeeded(videoGroup, showLoading);
Expand Down
Loading