Compare commits
3 Commits
4f2d311249
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e48eb8c91 | |||
| 72bf38a7ff | |||
| 97db96b105 |
135
Cargo.lock
generated
135
Cargo.lock
generated
@@ -769,18 +769,6 @@ dependencies = [
|
||||
"core2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
|
||||
dependencies = [
|
||||
"funty",
|
||||
"radium",
|
||||
"tap",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blade-graphics"
|
||||
version = "0.7.0"
|
||||
@@ -900,28 +888,6 @@ version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e79769241dcd44edf79a732545e8b5cec84c247ac060f5252cd51885d093a8fc"
|
||||
|
||||
[[package]]
|
||||
name = "bson"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3f109694c4f45353972af96bf97d8a057f82e2d6e496457f4d135b9867a518c"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"base64",
|
||||
"bitvec",
|
||||
"getrandom 0.3.4",
|
||||
"hex",
|
||||
"indexmap",
|
||||
"js-sys",
|
||||
"rand 0.9.2",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"simdutf8",
|
||||
"thiserror 2.0.18",
|
||||
"time",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "1.12.1"
|
||||
@@ -1791,15 +1757,6 @@ version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26bf8fc351c5ed29b5c2f0cbbac1b209b74f60ecd62e675a998df72c49af5204"
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "0.99.20"
|
||||
@@ -2391,12 +2348,6 @@ version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "futf"
|
||||
version = "0.1.5"
|
||||
@@ -4952,12 +4903,6 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.4.2"
|
||||
@@ -5862,12 +5807,6 @@ dependencies = [
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
@@ -6090,12 +6029,6 @@ version = "5.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
@@ -6272,16 +6205,6 @@ dependencies = [
|
||||
"font-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redb"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae323eb086579a3769daa2c753bb96deb95993c534711e0dbe881b5192906a06"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.16"
|
||||
@@ -6871,16 +6794,6 @@ dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_bytes"
|
||||
version = "0.11.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
@@ -7046,12 +6959,6 @@ dependencies = [
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simdutf8"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
|
||||
|
||||
[[package]]
|
||||
name = "simplecss"
|
||||
version = "0.2.2"
|
||||
@@ -7326,10 +7233,8 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
name = "store"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bson",
|
||||
"futures",
|
||||
"parking_lot",
|
||||
"redb",
|
||||
"secrecy",
|
||||
"serde",
|
||||
"tokio",
|
||||
@@ -7744,37 +7649,6 @@ dependencies = [
|
||||
"zune-jpeg 0.4.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
"num-conv",
|
||||
"powerfmt",
|
||||
"serde_core",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiny-skia"
|
||||
version = "0.11.4"
|
||||
@@ -9718,15 +9592,6 @@ version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
|
||||
dependencies = [
|
||||
"tap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.21.0"
|
||||
|
||||
12
Cargo.toml
12
Cargo.toml
@@ -1,20 +1,20 @@
|
||||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
"api",
|
||||
"typegen",
|
||||
"ui-gpui",
|
||||
"ui-iced",
|
||||
"store",
|
||||
"gst",
|
||||
"crates/api",
|
||||
"crates/gst",
|
||||
"crates/iced-video",
|
||||
"crates/store",
|
||||
"examples/hdr-gstreamer-wgpu",
|
||||
]
|
||||
[workspace.dependencies]
|
||||
iced = { version = "0.14.0" }
|
||||
gst = { version = "0.1.0", path = "gst" }
|
||||
iced_wgpu = { version = "0.14.0" }
|
||||
gst = { version = "0.1.0", path = "crates/gst" }
|
||||
iced-video = { version = "0.1.0", path = "crates/iced-video" }
|
||||
api = { version = "0.1.0", path = "crates/api" }
|
||||
|
||||
[patch.crates-io]
|
||||
iced_wgpu = { git = "https://github.com/uttarayan21/iced", branch = "0.14" }
|
||||
@@ -30,7 +30,7 @@ edition = "2024"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
api = { version = "0.1.0", path = "api" }
|
||||
api = { version = "0.1.0", path = "crates/api" }
|
||||
bytemuck = { version = "1.24.0", features = ["derive"] }
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
clap-verbosity-flag = { version = "3.0.4", features = ["tracing"] }
|
||||
|
||||
0
api/.gitignore → crates/api/.gitignore
vendored
0
api/.gitignore → crates/api/.gitignore
vendored
0
gst/.gitignore → crates/gst/.gitignore
vendored
0
gst/.gitignore → crates/gst/.gitignore
vendored
0
gst/Cargo.lock → crates/gst/Cargo.lock
generated
0
gst/Cargo.lock → crates/gst/Cargo.lock
generated
@@ -19,11 +19,3 @@ wgpu = { version = "27.0.1", features = ["vulkan"] }
|
||||
[dev-dependencies]
|
||||
iced.workspace = true
|
||||
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
|
||||
|
||||
[profile.dev]
|
||||
debug = true
|
||||
[profile.release]
|
||||
debug = true
|
||||
|
||||
# [patch.crates-io]
|
||||
# iced_wgpu = { git = "https://github.com/uttarayan21/iced", branch = "0.14" }
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
use crate::{Error, Result, ResultExt};
|
||||
use gst::{
|
||||
Bus, Gst, MessageType, MessageView, Sink, Source,
|
||||
Bus, Gst, Sink,
|
||||
app::AppSink,
|
||||
caps::{Caps, CapsType},
|
||||
element::ElementExt,
|
||||
pipeline::PipelineExt,
|
||||
playback::{PlayFlags, Playbin3},
|
||||
videoconvertscale::VideoConvert,
|
||||
};
|
||||
use std::sync::{Arc, Mutex, atomic::AtomicBool};
|
||||
|
||||
|
||||
@@ -4,10 +4,8 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
bson = { version = "3.1.0", features = ["serde"] }
|
||||
futures = "0.3.31"
|
||||
parking_lot = "0.12.5"
|
||||
redb = { version = "3.1.0", features = ["uuid"] }
|
||||
secrecy = "0.10.3"
|
||||
serde = "1.0.228"
|
||||
tokio = { version = "1.48.0", features = ["rt"] }
|
||||
@@ -15,6 +15,3 @@ anyhow = "*"
|
||||
pollster = "0.4.0"
|
||||
tracing = { version = "0.1.43", features = ["log"] }
|
||||
tracing-subscriber = "0.3.22"
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
|
||||
62
gst/.github/workflows/build.yaml
vendored
62
gst/.github/workflows/build.yaml
vendored
@@ -1,62 +0,0 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
checks-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- id: set-matrix
|
||||
name: Generate Nix Matrix
|
||||
run: |
|
||||
set -Eeu
|
||||
matrix="$(nix eval --json '.#githubActions.matrix')"
|
||||
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
|
||||
|
||||
checks-build:
|
||||
needs: checks-matrix
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix: ${{fromJSON(needs.checks-matrix.outputs.matrix)}}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- run: nix build -L '.#${{ matrix.attr }}'
|
||||
|
||||
codecov:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: "write"
|
||||
contents: "read"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Run codecov
|
||||
run: nix build .#checks.x86_64-linux.hello-llvm-cov
|
||||
|
||||
- name: Upload coverage reports to Codecov
|
||||
uses: codecov/codecov-action@v4.0.1
|
||||
with:
|
||||
flags: unittests
|
||||
name: codecov-hello
|
||||
fail_ci_if_error: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./result
|
||||
verbose: true
|
||||
|
||||
38
gst/.github/workflows/docs.yaml
vendored
38
gst/.github/workflows/docs.yaml
vendored
@@ -1,38 +0,0 @@
|
||||
name: docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: "write"
|
||||
contents: "read"
|
||||
pages: "write"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- uses: DeterminateSystems/flake-checker-action@main
|
||||
|
||||
- name: Generate docs
|
||||
run: nix build .#checks.x86_64-linux.hello-docs
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: result/share/doc
|
||||
|
||||
- name: Deploy to gh-pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub use error_stack::{Report, ResultExt};
|
||||
pub use error_stack::ResultExt;
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[error("An error occurred")]
|
||||
pub struct Error;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
mod cli;
|
||||
mod errors;
|
||||
use api::JellyfinConfig;
|
||||
use errors::*;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
|
||||
@@ -1,225 +0,0 @@
|
||||
// use std::{
|
||||
// borrow::Borrow,
|
||||
// collections::VecDeque,
|
||||
// marker::PhantomData,
|
||||
// path::Path,
|
||||
// sync::{Arc, RwLock, atomic::AtomicBool},
|
||||
// };
|
||||
//
|
||||
// use futures::task::AtomicWaker;
|
||||
// use redb::{Error, Key, ReadableDatabase, TableDefinition, Value};
|
||||
// use serde::{Serialize, de::DeserializeOwned};
|
||||
//
|
||||
// const USERS: TableDefinition<uuid::Uuid, Vec<u8>> = TableDefinition::new("users");
|
||||
// const SERVERS: TableDefinition<uuid::Uuid, Vec<u8>> = TableDefinition::new("servers");
|
||||
// const SETTINGS: TableDefinition<uuid::Uuid, Vec<u8>> = TableDefinition::new("settings");
|
||||
//
|
||||
// #[derive(Debug)]
|
||||
// pub struct TableInner<T> {
|
||||
// db: Arc<T>,
|
||||
// }
|
||||
//
|
||||
// impl<T> Clone for TableInner<T> {
|
||||
// fn clone(&self) -> Self {
|
||||
// Self {
|
||||
// db: Arc::clone(&self.db),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// impl<T> TableInner<T> {
|
||||
// fn new(db: Arc<T>) -> Self {
|
||||
// Self { db }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// impl TableInner<DatabaseHandle> {
|
||||
// async fn get<'a, K: Key, V: Serialize + DeserializeOwned>(
|
||||
// &self,
|
||||
// table: TableDefinition<'static, K, Vec<u8>>,
|
||||
// key: impl Borrow<K::SelfType<'a>>,
|
||||
// ) -> Result<Option<V>> {
|
||||
// let db: &redb::Database = &self.db.as_ref().database;
|
||||
// let db_reader = db.begin_read()?;
|
||||
// let table = db_reader.open_table(table)?;
|
||||
// table
|
||||
// .get(key)?
|
||||
// .map(|value| bson::deserialize_from_slice(&value.value()))
|
||||
// .transpose()
|
||||
// .map_err(|e| redb::Error::Io(std::io::Error::other(e)))
|
||||
// }
|
||||
//
|
||||
// async fn insert<
|
||||
// 'a,
|
||||
// 'b,
|
||||
// K: Key + Send + Sync,
|
||||
// V: Serialize + DeserializeOwned + Send + Sync + 'a,
|
||||
// >(
|
||||
// &'b self,
|
||||
// table: TableDefinition<'static, K, Vec<u8>>,
|
||||
// key: impl Borrow<K::SelfType<'a>> + Send + 'b,
|
||||
// value: V,
|
||||
// ) -> Result<Option<V>> {
|
||||
// let db: &redb::Database = &self.db.as_ref().database;
|
||||
// // self.db
|
||||
// // .writing
|
||||
// // .store(true, std::sync::atomic::Ordering::SeqCst);
|
||||
//
|
||||
// // let out = tokio::task::spawn_blocking(move || -> Result<Option<V>>
|
||||
//
|
||||
// let out = tokio::task::spawn_blocking(|| -> Result<Option<V>> {
|
||||
// let db_writer = db.begin_write()?;
|
||||
// let out = {
|
||||
// let mut table = db_writer.open_table(table)?;
|
||||
// let serialized_value = bson::serialize_to_vec(&value)
|
||||
// .map_err(|e| redb::Error::Io(std::io::Error::other(e)))?;
|
||||
// let previous = table.insert(key, &serialized_value)?;
|
||||
// let out = previous
|
||||
// .map(|value| bson::deserialize_from_slice(&value.value()))
|
||||
// .transpose()
|
||||
// .map_err(|e| redb::Error::Io(std::io::Error::other(e)));
|
||||
// out
|
||||
// };
|
||||
// db_writer.commit()?;
|
||||
// out
|
||||
// })
|
||||
// .await
|
||||
// .expect("Task panicked");
|
||||
//
|
||||
// out
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // impl<K: Key, V: Serialize + DeserializeOwned> Table<K, V> for TableInner {
|
||||
// // async fn get(&self, key: K) -> Result<Option<Value>> {}
|
||||
// // async fn insert(&self, key: K, value: V) -> Result<Option<Value>> {}
|
||||
// // async fn modify(&self, key: K, v: FnOnce(V) -> V) -> Result<bool> {}
|
||||
// // async fn remove(&self, key: K) -> Result<Option<Value>> {}
|
||||
// // }
|
||||
//
|
||||
// #[derive(Debug)]
|
||||
// pub struct Users<T>(TableInner<T>);
|
||||
//
|
||||
// impl<T> Clone for Users<T> {
|
||||
// fn clone(&self) -> Self {
|
||||
// Self(self.0.clone())
|
||||
// }
|
||||
// }
|
||||
// impl<T> Users<T> {
|
||||
// const TABLE: TableDefinition<'static, uuid::Uuid, Vec<u8>> = USERS;
|
||||
// }
|
||||
//
|
||||
// #[derive(Debug)]
|
||||
// pub struct Servers<T>(TableInner<T>);
|
||||
// impl<T> Clone for Servers<T> {
|
||||
// fn clone(&self) -> Self {
|
||||
// Self(self.0.clone())
|
||||
// }
|
||||
// }
|
||||
// impl<T> Servers<T> {
|
||||
// const TABLE: TableDefinition<'static, uuid::Uuid, Vec<u8>> = SERVERS;
|
||||
// }
|
||||
//
|
||||
// #[derive(Debug)]
|
||||
// pub struct Settings<T>(TableInner<T>);
|
||||
// impl<T> Clone for Settings<T> {
|
||||
// fn clone(&self) -> Self {
|
||||
// Self(self.0.clone())
|
||||
// }
|
||||
// }
|
||||
// impl<T> Settings<T> {
|
||||
// const TABLE: TableDefinition<'static, uuid::Uuid, Vec<u8>> = SETTINGS;
|
||||
// }
|
||||
//
|
||||
// #[derive(Debug, Clone)]
|
||||
// pub struct Database {
|
||||
// users: Users<DatabaseHandle>,
|
||||
// servers: Servers<DatabaseHandle>,
|
||||
// settings: Settings<DatabaseHandle>,
|
||||
// handle: Arc<DatabaseHandle>,
|
||||
// }
|
||||
//
|
||||
// #[derive(Debug)]
|
||||
// pub struct DatabaseHandle {
|
||||
// database: redb::Database,
|
||||
// writing: AtomicBool,
|
||||
// wakers: RwLock<VecDeque<AtomicWaker>>,
|
||||
// }
|
||||
//
|
||||
// #[derive(Debug)]
|
||||
// pub struct DatabaseWriterGuard<'a> {
|
||||
// handle: &'a DatabaseHandle,
|
||||
// dropper: Arc<AtomicBool>,
|
||||
// }
|
||||
//
|
||||
// // impl Drop for DatabaseWriterGuard<'_> {
|
||||
// // fn drop(&mut self) {
|
||||
// // self.handle
|
||||
// // .writing
|
||||
// // .store(false, std::sync::atomic::Ordering::SeqCst);
|
||||
// // let is_panicking = std::thread::panicking();
|
||||
// // let Ok(writer) = self.handle.wakers.write() else {
|
||||
// // if is_panicking {
|
||||
// // return;
|
||||
// // } else {
|
||||
// // panic!("Wakers lock poisoned");
|
||||
// // }
|
||||
// // }
|
||||
// // if let Some(waker) = (self.handle.wakers.write()).pop() {
|
||||
// // waker.wake();
|
||||
// // };
|
||||
// // // let mut wakers = self.handle.wakers.write().expect();
|
||||
// // // if let Some(waker) = self.handle.wakers.write().expect("Wakers lock poisoned").pop_front() {
|
||||
// // // waker.wake();
|
||||
// // // }
|
||||
// // // while let Some(waker) = wakers.pop_front() {
|
||||
// // // waker.wake();
|
||||
// // // }
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// type Result<O, E = redb::Error> = core::result::Result<O, E>;
|
||||
//
|
||||
// pub trait Table<K: Key> {
|
||||
// fn insert<V: Serialize + DeserializeOwned>(
|
||||
// &self,
|
||||
// key: K,
|
||||
// value: V,
|
||||
// ) -> impl Future<Output = Result<Option<V>>> + Send;
|
||||
// fn modify<V: Serialize + DeserializeOwned, O: Serialize + DeserializeOwned>(
|
||||
// &self,
|
||||
// key: K,
|
||||
// v: impl FnOnce(V) -> O,
|
||||
// ) -> impl Future<Output = Result<bool>> + Send;
|
||||
// fn remove<V: Serialize + DeserializeOwned>(
|
||||
// &self,
|
||||
// key: K,
|
||||
// ) -> impl Future<Output = Result<Option<V>>> + Send;
|
||||
// fn get<V: Serialize + DeserializeOwned>(
|
||||
// &self,
|
||||
// key: K,
|
||||
// ) -> impl Future<Output = Result<Option<V>>> + Send;
|
||||
// }
|
||||
//
|
||||
// impl Database {
|
||||
// pub fn create(path: impl AsRef<Path>) -> Result<Self, Error> {
|
||||
// let writing = AtomicBool::new(false);
|
||||
// let wakers = RwLock::new(VecDeque::new());
|
||||
// let db = redb::Database::create(path)?;
|
||||
// let db = Arc::new(DatabaseHandle {
|
||||
// database: db,
|
||||
// writing,
|
||||
// wakers,
|
||||
// });
|
||||
// let table_inner = TableInner::new(Arc::clone(&db));
|
||||
// let users = Users(table_inner.clone());
|
||||
// let servers = Servers(table_inner.clone());
|
||||
// let settings = Settings(table_inner.clone());
|
||||
// Ok(Self {
|
||||
// servers,
|
||||
// users,
|
||||
// settings,
|
||||
// handle: db,
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
@@ -5,7 +5,7 @@ edition = "2024"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
api = { version = "0.1.0", path = "../api" }
|
||||
api = { workspace = true }
|
||||
blurhash = "0.2.3"
|
||||
bytes = "1.11.0"
|
||||
gpui_util = "0.2.2"
|
||||
|
||||
@@ -270,7 +270,6 @@ fn update(state: &mut State, message: Message) -> Task<Message> {
|
||||
}
|
||||
}
|
||||
Message::Video(msg) => video::update(state, msg),
|
||||
_ => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,51 +441,7 @@ fn card(item: &Item) -> Element<'_, Message> {
|
||||
}
|
||||
|
||||
fn init() -> (State, Task<Message>) {
|
||||
// Create a default config for initial state
|
||||
|
||||
// let default_config = api::JellyfinConfig {
|
||||
// server_url: "http://localhost:8096".parse().expect("Valid URL"),
|
||||
// device_id: "jello-iced".to_string(),
|
||||
// device_name: "Jello Iced".to_string(),
|
||||
// client_name: "Jello".to_string(),
|
||||
// version: "0.1.0".to_string(),
|
||||
// };
|
||||
// let default_client = api::JellyfinClient::new_with_config(default_config);
|
||||
|
||||
(
|
||||
State::new(),
|
||||
Task::perform(
|
||||
async move {
|
||||
let config_str = std::fs::read_to_string("config.toml")
|
||||
.map_err(|e| api::JellyfinApiError::IoError(e))?;
|
||||
let config: api::JellyfinConfig = toml::from_str(&config_str).map_err(|e| {
|
||||
api::JellyfinApiError::IoError(std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidData,
|
||||
e,
|
||||
))
|
||||
})?;
|
||||
|
||||
// Try to load cached token and authenticate
|
||||
match std::fs::read_to_string(".session") {
|
||||
Ok(token) => {
|
||||
let client = api::JellyfinClient::pre_authenticated(token.trim(), config)?;
|
||||
Ok((client, true))
|
||||
}
|
||||
Err(_) => {
|
||||
// No cached token, create unauthenticated client
|
||||
let client = api::JellyfinClient::new_with_config(config);
|
||||
Ok((client, false))
|
||||
}
|
||||
}
|
||||
},
|
||||
|result: Result<_, api::JellyfinApiError>| match result {
|
||||
// Ok((client, is_authenticated)) => Message::LoadedClient(client, is_authenticated),
|
||||
Err(e) => Message::Error(format!("Initialization failed: {}", e)),
|
||||
_ => Message::Error("Login Unimplemented".to_string()),
|
||||
},
|
||||
)
|
||||
.chain(Task::done(Message::Refresh)),
|
||||
)
|
||||
(State::new(), Task::done(Message::Refresh))
|
||||
}
|
||||
|
||||
pub fn ui() -> iced::Result {
|
||||
|
||||
Reference in New Issue
Block a user