do not continue to specials from main series for next_video
@@ -10,6 +10,7 @@ use crate::types::addon::{AggrRequest, ResourcePath, ResourceRequest};
use crate::types::library::{LibraryBucket, LibraryItem};
use crate::types::profile::Settings as ProfileSettings;
use crate::types::resource::{MetaItem, SeriesInfo, Stream, Subtitles, Video};
+use itertools::Itertools;
use serde::{Deserialize, Serialize};
use std::cmp;
use std::marker::PhantomData;
@@ -230,8 +231,27 @@ fn next_video_update(
) if settings.binge_watching => meta_item
.videos
.iter()
- .position(|video| video.id == *video_id)
- .and_then(|position| meta_item.videos.get(position + 1))
+ .find_position(|video| video.id == *video_id)
+ .and_then(|(position, current_video)| {
+ meta_item
+ .videos
+ .get(position + 1)
+ .map(|next_video| (current_video, next_video))
+ })
+ .filter(|(current_video, next_video)| {
+ let current_season = current_video
+ .series_info
+ .as_ref()
+ .map(|info| info.season)
+ .unwrap_or_default();
+ let next_season = next_video
+ .series_info
+ .as_ref()
+ .map(|info| info.season)
+ .unwrap_or_default();
+ next_season != 0 || current_season == next_season
+ })
+ .map(|(_, next_video)| next_video)
.cloned(),
_ => None,
};
