feat: UI progress

This commit is contained in:
2024-10-18 13:10:47 +01:00
parent 5bed3fa86f
commit b4a6991007
22 changed files with 343 additions and 79 deletions

View File

@ -11,6 +11,12 @@ pub trait StreamInfo {
fn stream(&self) -> Option<&str>;
fn starts(&self) -> u64;
fn image(&self) -> Option<&str>;
fn status(&self) -> Option<&str>;
fn viewers(&self) -> Option<u32>;
}
impl<'a> StreamInfo for Note<'a> {
@ -50,6 +56,7 @@ impl<'a> StreamInfo for Note<'a> {
}
}
fn starts(&self) -> u64 {
if let Some(s) = self.get_tag_value("starts") {
s.variant().str()
@ -58,4 +65,29 @@ impl<'a> StreamInfo for Note<'a> {
self.created_at()
}
}
fn image(&self) -> Option<&str> {
if let Some(s) = self.get_tag_value("image") {
s.variant().str()
} else {
None
}
}
fn status(&self) -> Option<&str> {
if let Some(s) = self.get_tag_value("status") {
s.variant().str()
} else {
None
}
}
fn viewers(&self) -> Option<u32> {
if let Some(s) = self.get_tag_value("current_participants") {
s.variant().str()
.map_or(None, |v| Some(v.parse::<u32>().unwrap_or(0)))
} else {
None
}
}
}