aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 4e0367a..edf7851 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3610,17 +3610,35 @@ namespace QuickMedia {
};
auto play_next_video = [&]() -> bool {
- if(parent_body->select_next_item(false, true)) {
- play_video(parent_body->get_selected()->url);
+ while(true) {
+ if(!parent_body->select_next_item(false, true)) {
+ if(load_next_page() == 0) {
+ return false;
+ } else {
+ continue;
+ }
+ }
+
+ BodyItem *selected = parent_body->get_selected();
+ if(selected->url.empty() || video_page->video_should_be_skipped(selected->url))
+ continue;
+
+ play_video(selected->url);
return true;
- } else {
- if(load_next_page() == 0) {
+ }
+ };
+
+ auto play_previous_video = [&]() -> bool {
+ while(true) {
+ if(!parent_body->select_previous_item(false, true))
return false;
- } else {
- parent_body->select_next_item(false, true);
- play_video(parent_body->get_selected()->url);
- return true;
- }
+
+ BodyItem *selected = parent_body->get_selected();
+ if(selected->url.empty() || video_page->video_should_be_skipped(selected->url))
+ continue;
+
+ play_video(selected->url);
+ return true;
}
};
@@ -3713,9 +3731,7 @@ namespace QuickMedia {
if(!play_next_video())
show_notification("QuickMedia", "You have reached the last video in the playlist", Urgency::LOW);
} else {
- if(parent_body->select_previous_item(false, true)) {
- play_video(parent_body->get_selected()->url);
- } else {
+ if(!play_previous_video()) {
show_notification("QuickMedia", "You have reached the first video in the playlist", Urgency::LOW);
}
}