Skip to content
Merged
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
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default-members = ["crates/*"]

[workspace.package]
edition = "2024"
version = "0.19.0"
version = "0.20.0"
license = "MIT"

[profile.release]
Expand Down
6 changes: 3 additions & 3 deletions crates/flex-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ anyhow = "1.0.104"
chrono = { version = "0.4.45", default-features = false, features = ["clock"] }
eframe = { version = "0.36", default-features = false, features = ["glow", "default_fonts"] }
env_logger = "0.11.11"
flex-core = { version = "0.19.0", path = "../flex-core" }
flex-plugin = { version = "0.19.0", path = "../flex-plugin" }
flex-web = { version = "0.19.0", path = "../flex-web" }
flex-core = { version = "0.20.0", path = "../flex-core" }
flex-plugin = { version = "0.20.0", path = "../flex-plugin" }
flex-web = { version = "0.20.0", path = "../flex-web" }
image = { version = "0.25", default-features = false, features = ["jpeg", "png", "webp"] }
libloading = "0.9"
log = "0.4.34"
Expand Down
7 changes: 6 additions & 1 deletion crates/flex-app/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::mpv::{self, GetProcAddress, Mpv, Renderer};
use crate::picture::Picture;
use crate::shared::TrackMemory;
use flex_core::language;
use crate::screens::{Nav, Screen, up_next::UpNext};
use crate::screens::{Nav, Screen, up_next::UpNext, youtube::RelatedVideos};
use crate::shared::{PlayRequest, Shared, SkipMode};
use crate::theme;

Expand Down Expand Up @@ -475,6 +475,8 @@ impl Player {
return Some(Nav::Pop);
}
yt.loaded = true;
// Ready for the page shown when it finishes.
sh.youtube.start_related(&yt.id);
// Where playback starts, so a segment right there (e.g. a sponsor read
// at 0:00) counts as played into.
yt.last_pos = Some(self.req.start.unwrap_or(0.0));
Expand Down Expand Up @@ -530,6 +532,9 @@ impl Player {
}
self.log_session(sh);
self.finished = true;
if let Some(id) = self.req.youtube_id() {
return Nav::replace(RelatedVideos::after(sh, id, &self.req.title));
}
return match sh.next_after(&self.req) {
Some(next) => Nav::replace(UpNext::new(self.req.title.clone(), next)),
None => Nav::Pop,
Expand Down
23 changes: 18 additions & 5 deletions crates/flex-app/src/screens/youtube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,28 +604,41 @@ impl Screen for SearchResults {
}
}

/// The videos YouTube suggests after one (from its options).
/// The videos YouTube suggests after one (from its options, or when it finishes playing).
pub struct RelatedVideos {
title: String,
results: VideoResults,
/// Shown after the video finished: a video picked here replaces this page, so Back
/// still returns to wherever playback was started from.
finished: bool,
}

impl RelatedVideos {
fn new(sh: &mut Shared, item: &VideoItem) -> Self {
Self { title: item.title.clone(), results: VideoResults::related(sh, &item.id) }
Self { title: item.title.clone(), results: VideoResults::related(sh, &item.id), finished: false }
}

/// For the video that just finished playing.
pub fn after(sh: &mut Shared, id: &str, title: &str) -> Self {
Self { title: title.to_owned(), results: VideoResults::related(sh, id), finished: true }
}
}

impl Screen for RelatedVideos {
fn handle(&mut self, sh: &mut Shared, press: Press) -> Nav {
if press.is(Action::Back) {
if press.is(Action::Back) || (self.finished && press.is(Action::Stop)) {
return Nav::Pop;
}
self.results.handle(sh, press)
let nav = self.results.handle(sh, press);
match nav {
Nav::Play { req, .. } if self.finished => Nav::Play { req, replace: true },
nav => nav,
}
}

fn ui(&mut self, ui: &mut Ui, sh: &mut Shared, rect: Rect, focused: bool) -> Nav {
let body = widgets::header(ui.painter(), rect, &self.title, "Related videos", ui.style());
let subtitle = if self.finished { "Finished · related videos" } else { "Related videos" };
let body = widgets::header(ui.painter(), rect, &self.title, subtitle, ui.style());
self.results.ui(ui, sh, body, &[], focused);
Nav::None
}
Expand Down
2 changes: 1 addition & 1 deletion crates/flex-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
[dependencies]
anyhow = "1.0.104"
directories = "6.0.0"
flex-plugin = { version = "0.19.0", path = "../flex-plugin" }
flex-plugin = { version = "0.20.0", path = "../flex-plugin" }
hunch = "2"
lofty = "0.25.4"
log = "0.4.34"
Expand Down
2 changes: 1 addition & 1 deletion crates/flex-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
[dependencies]
anyhow = "1.0.104"
axum = "0.8.9"
flex-core = { version = "0.19.0", path = "../flex-core" }
flex-core = { version = "0.20.0", path = "../flex-core" }
log = "0.4.34"
serde = { version = "1.0.229", features = ["derive", "rc"] }
serde_json = "1.0.151"
Expand Down
2 changes: 1 addition & 1 deletion plugins/anilist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ license.workspace = true
publish = false

[dependencies]
flex-plugin = { version = "0.19.0", path = "../../crates/flex-plugin" }
flex-plugin = { version = "0.20.0", path = "../../crates/flex-plugin" }
ureq = { version = "3", features = ["json"] }
2 changes: 1 addition & 1 deletion plugins/anilist/plugin.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AniList"
description = "Updates your AniList progress as you watch anime in Flex"
version = "0.19.0"
version = "0.20.0"
command = "flex-anilist"
subscribe = ["playback"]

Expand Down
2 changes: 1 addition & 1 deletion plugins/lotus-lamp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ license.workspace = true
publish = false

[dependencies]
flex-plugin = { version = "0.19.0", path = "../../crates/flex-plugin" }
flex-plugin = { version = "0.20.0", path = "../../crates/flex-plugin" }
lotus-lamp = { git = "https://github.com/bombpersons/lotus-lamp-rs", rev = "59cf5ccaa0007f006f1812fd02cc5991aff11e72" }
tokio = { version = "1.53.2", features = ["rt", "time", "sync", "macros"] }
2 changes: 1 addition & 1 deletion plugins/lotus-lamp/plugin.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LED strip (Lotus Lamp)"
description = "Lights a Bluetooth LED strip behind the TV with the colours on screen"
version = "0.19.0"
version = "0.20.0"
command = "flex-lotus-lamp"
subscribe = ["light"]

Expand Down
2 changes: 1 addition & 1 deletion plugins/trakt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ license.workspace = true
publish = false

[dependencies]
flex-plugin = { version = "0.19.0", path = "../../crates/flex-plugin" }
flex-plugin = { version = "0.20.0", path = "../../crates/flex-plugin" }
ureq = { version = "3", features = ["json"] }
2 changes: 1 addition & 1 deletion plugins/trakt/plugin.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Trakt"
description = "Keeps your Trakt history up to date with what you watch in Flex"
version = "0.19.0"
version = "0.20.0"
command = "flex-trakt"
subscribe = ["playback"]

Expand Down
Loading