Don't explicitly store the video count in the channel object anymore
This commit is contained in:
parent
fa4fec5f81
commit
00d0e6946b
3
main.cpp
3
main.cpp
|
@ -147,7 +147,6 @@ void fetch_videos_for_channel(Channel &channel, bool name_in_title=false)
|
|||
if(channel.is_virtual) {
|
||||
std::vector<Video> &channelVideos = videos[channel.id];
|
||||
channelVideos = Video::get_all_with_flag_value(channel.virtual_flag, channel.virtual_flag_value);
|
||||
channel.video_count = channelVideos.size();
|
||||
for(Video &video: channelVideos) {
|
||||
video.tui_title_width = string_width(video.title);
|
||||
}
|
||||
|
@ -191,8 +190,8 @@ void select_channel_by_index(const int index) {
|
|||
selected_channel = index;
|
||||
const Channel &channel = channels.at(selected_channel);
|
||||
selected_video = 0;
|
||||
current_video_count = channel.video_count;
|
||||
load_videos_for_channel(channel, clear_channels_on_change);
|
||||
current_video_count = videos[channel.id].size();
|
||||
clear_channels_on_change = channel.is_virtual;
|
||||
}
|
||||
|
||||
|
|
2
yt.cpp
2
yt.cpp
|
@ -239,7 +239,6 @@ void Channel::fetch_new_videos(sqlite3 *db, progress_info *info, std::optional<s
|
|||
|
||||
void Channel::load_info(sqlite3 *db)
|
||||
{
|
||||
video_count = 0;
|
||||
unwatched = 0;
|
||||
|
||||
if(is_virtual) {
|
||||
|
@ -253,7 +252,6 @@ void Channel::load_info(sqlite3 *db)
|
|||
const int flags = sqlite3_column_int(query, 0);
|
||||
const int count = sqlite3_column_int(query, 1);
|
||||
|
||||
video_count += count;
|
||||
if((flags & kWatched) == 0)
|
||||
unwatched += count;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue