Skip to content

Commit ba7399c

Browse files
committed
fix last line
1 parent c4e548c commit ba7399c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src-tauri/src/m3u.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ pub fn read_m3u8(mut source: Source, wipe: bool) -> Result<()> {
6464
}
6565
};
6666
let l1_upper = l1.to_uppercase();
67-
if l1_upper.starts_with("#EXTINF") || lines.peek().is_none() {
67+
let reached_eof = lines.peek().is_none();
68+
if l1_upper.starts_with("#EXTINF") || reached_eof {
69+
if reached_eof && last_non_empty_line.is_none() && !l1.trim().is_empty() {
70+
last_non_empty_line = Some(l1.clone());
71+
}
6872
if let Some(channel) = channel_line {
6973
if !channel_headers_set {
7074
channel_headers = None;
@@ -98,7 +102,6 @@ pub fn read_m3u8(mut source: Source, wipe: bool) -> Result<()> {
98102
last_non_empty_line = Some(l1);
99103
}
100104
}
101-
102105
tx.commit()?;
103106
Ok(())
104107
}

src-tauri/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55

66
use serde::{Deserialize, Serialize};
77

8-
#[derive(Clone, PartialEq, Debug, Deserialize, Serialize, Default)]
8+
#[derive(Clone, PartialEq, Debug, Deserialize, Serialize)]
99
pub struct Channel {
1010
#[serde(skip_serializing_if = "Option::is_none")]
1111
pub id: Option<i64>,

0 commit comments

Comments
 (0)