feat: cleanup stream on end

fix: audio codecs
fix: hls segmenter
This commit is contained in:
2024-11-21 22:08:47 +00:00
parent f192a915e0
commit 9937f9a6f9
16 changed files with 131 additions and 54 deletions

View File

@ -1274,7 +1274,6 @@ dependencies = [
"tokio-stream",
"tracing",
"url",
"uuid",
]
[[package]]
@ -1356,7 +1355,6 @@ dependencies = [
"stringprep",
"thiserror",
"tracing",
"uuid",
"whoami",
]
@ -1396,7 +1394,6 @@ dependencies = [
"stringprep",
"thiserror",
"tracing",
"uuid",
"whoami",
]
@ -1422,7 +1419,6 @@ dependencies = [
"sqlx-core",
"tracing",
"url",
"uuid",
]
[[package]]

View File

@ -10,6 +10,6 @@ test-pattern = []
[dependencies]
anyhow = "^1.0.70"
chrono = { version = "0.4.38", features = ["serde"] }
sqlx = { version = "0.8.1", features = ["runtime-tokio", "migrate", "mysql", "chrono", "uuid"] }
sqlx = { version = "0.8.1", features = ["runtime-tokio", "migrate", "mysql", "chrono"] }
log = "0.4.22"
uuid = { version = "1.11.0", features = ["v4"] }

View File

@ -14,11 +14,11 @@ create table user
create unique index ix_user_pubkey on user (pubkey);
create table user_stream
(
id UUID not null primary key,
id varchar(50) not null primary key,
user_id integer unsigned not null,
starts timestamp not null,
starts timestamp not null,
ends timestamp,
state smallint not null,
state tinyint unsigned not null,
title text,
summary text,
image text,
@ -28,9 +28,9 @@ create table user_stream
goal text,
pinned text,
-- milli-sats paid for this stream
cost bigint not null default 0,
cost bigint unsigned not null default 0,
-- duration in seconds
duration float not null default 0,
duration float not null default 0,
-- admission fee
fee integer unsigned,
-- current nostr event json

View File

@ -96,7 +96,7 @@ impl ZapStreamDb {
pub async fn get_stream(&self, id: &Uuid) -> Result<UserStream> {
Ok(sqlx::query_as("select * from user_stream where id = ?")
.bind(id)
.bind(id.to_string())
.fetch_one(&self.db)
.await
.map_err(anyhow::Error::new)?)

View File

@ -48,7 +48,7 @@ impl Display for UserStreamState {
#[derive(Debug, Clone, Default, FromRow)]
pub struct UserStream {
pub id: Uuid,
pub id: String,
pub user_id: u64,
pub starts: DateTime<Utc>,
pub ends: Option<DateTime<Utc>>,