set last_index

TODO: change check_for_next_playlist position/logic, #140
This commit is contained in:
jb-alvarado 2022-06-25 23:14:21 +02:00
parent da1799e704
commit 77358fb140
3 changed files with 5 additions and 5 deletions

2
Cargo.lock generated
View File

@ -1009,7 +1009,7 @@ dependencies = [
[[package]]
name = "ffplayout"
version = "0.10.0"
version = "0.10.1"
dependencies = [
"clap",
"crossbeam-channel 0.5.5",

View File

@ -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]

View File

@ -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