From 77358fb1407200ff8f6cebc998d766a5ce69d234 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Sat, 25 Jun 2022 23:14:21 +0200 Subject: [PATCH] set last_index TODO: change check_for_next_playlist position/logic, #140 --- Cargo.lock | 2 +- ffplayout-engine/Cargo.toml | 2 +- ffplayout-engine/src/input/playlist.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f86aef7b..ca959803 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1009,7 +1009,7 @@ dependencies = [ [[package]] name = "ffplayout" -version = "0.10.0" +version = "0.10.1" dependencies = [ "clap", "crossbeam-channel 0.5.5", diff --git a/ffplayout-engine/Cargo.toml b/ffplayout-engine/Cargo.toml index 49678bd4..4c4ddcc1 100644 --- a/ffplayout-engine/Cargo.toml +++ b/ffplayout-engine/Cargo.toml @@ -4,7 +4,7 @@ description = "24/7 playout based on rust and ffmpeg" license = "GPL-3.0" authors = ["Jonathan Baecker jonbae77@gmail.com"] readme = "README.md" -version = "0.10.0" +version = "0.10.1" edition = "2021" [dependencies] diff --git a/ffplayout-engine/src/input/playlist.rs b/ffplayout-engine/src/input/playlist.rs index ab8da117..3b382056 100644 --- a/ffplayout-engine/src/input/playlist.rs +++ b/ffplayout-engine/src/input/playlist.rs @@ -275,11 +275,11 @@ impl Iterator for CurrentProgram { // On init load, playlist could be not long enough, // so we check if we can take the next playlist already, // or we fill the gap with a dummy. - let list_length = self.nodes.lock().unwrap().len(); - self.current_node = self.nodes.lock().unwrap()[list_length - 1].clone(); + let last_index = self.nodes.lock().unwrap().len() - 1; + self.current_node = self.nodes.lock().unwrap()[last_index].clone(); self.check_for_next_playlist(); - let new_node = self.nodes.lock().unwrap()[list_length - 1].clone(); + let new_node = self.nodes.lock().unwrap()[last_index].clone(); let new_length = new_node.begin.unwrap() + new_node.duration; if new_length