feat: UI progress
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user