Ignore virtual channels for notifications

This commit is contained in:
Daniel Schulte 2020-12-04 18:05:59 +01:00
parent b272f64b2d
commit c3bb1156b5
1 changed files with 4 additions and 2 deletions

View File

@ -152,7 +152,7 @@ int fetch_videos_for_channel(Channel &channel, bool name_in_title=false)
for(Video &video: channelVideos) { for(Video &video: channelVideos) {
video.tui_title_width = string_width(video.title); video.tui_title_width = string_width(video.title);
} }
return channelVideos.size(); return 0;
} }
std::string title("Refreshing"); std::string title("Refreshing");
@ -337,7 +337,7 @@ std::vector<std::string> notify_channels_new_videos_command;
void action_refresh_channel() { void action_refresh_channel() {
Channel &ch = channels.at(selected_channel); Channel &ch = channels.at(selected_channel);
const int new_videos = fetch_videos_for_channel(channels.at(selected_channel)); const int new_videos = fetch_videos_for_channel(channels.at(selected_channel));
if(new_videos == 0) if(new_videos == 0 || ch.is_virtual)
return; return;
if(new_videos == 1 && !notify_channel_new_video_command.empty()) { if(new_videos == 1 && !notify_channel_new_video_command.empty()) {
run_command(notify_channel_new_video_command, { run_command(notify_channel_new_video_command, {
@ -360,6 +360,8 @@ void action_refresh_all_channels(bool ask=true) {
int new_videos = 0; int new_videos = 0;
for(Channel &channel: channels) { for(Channel &channel: channels) {
const int count = fetch_videos_for_channel(channel, true); const int count = fetch_videos_for_channel(channel, true);
if(channel.is_virtual)
continue;
new_videos += count; new_videos += count;
if(count) if(count)
updated_channels++; updated_channels++;