setup routes

This commit is contained in:
2024-10-10 20:40:25 +01:00
parent abfcbc8954
commit 67d6381123
20 changed files with 1194 additions and 490 deletions

38
src/stream_info.rs Normal file
View File

@ -0,0 +1,38 @@
use crate::note_util::NoteUtil;
use nostrdb::Note;
pub trait StreamInfo {
fn title(&self) -> Option<String>;
fn summary(&self) -> Option<String>;
fn host(&self) -> [u8; 32];
fn stream(&self) -> Option<String>;
}
impl<'a> StreamInfo for Note<'a> {
fn title(&self) -> Option<String> {
if let Some(s) = self.get_tag_value("title") {
s.variant().str().map(ToString::to_string)
} else {
None
}
}
fn summary(&self) -> Option<String> {
todo!()
}
fn host(&self) -> [u8; 32] {
todo!()
}
fn stream(&self) -> Option<String> {
if let Some(s) = self.get_tag_value("streaming") {
s.variant().str().map(ToString::to_string)
} else {
None
}
}
}