Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for wasm addons #182

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1a004fe
setup new plugin development kit (wasm addons)
tsirysndr Aug 23, 2024
1f8424c
expose host functions, add stdout and subprocess audio backend
tsirysndr Aug 24, 2024
c4e472e
expose get_settings host function, update nix flake
tsirysndr Aug 24, 2024
3c76121
try to call functions from the local.wasm plugin
tsirysndr Aug 25, 2024
6f0f47a
[fluentci] update test job
tsirysndr Aug 25, 2024
7452e16
[fluentci] update test job
tsirysndr Aug 25, 2024
6f34767
ci: set DAGGER_CLOUD_TOKEN
tsirysndr Aug 25, 2024
1c3fc68
fix: export `next` and `previous` host functions
tsirysndr Aug 25, 2024
95d24de
update extism host functions
tsirysndr Aug 25, 2024
e3a73ee
remove duplicate load_tracklist definition
tsirysndr Aug 25, 2024
9384b81
exclude addons from coverage
tsirysndr Aug 25, 2024
8d0b5f5
fix cargo llvm cov
tsirysndr Aug 25, 2024
5ee5be1
remove duplicate get_current_track definition
tsirysndr Aug 25, 2024
c9708bc
update tests
tsirysndr Aug 25, 2024
5bb8646
update extism host functions
tsirysndr Aug 25, 2024
ac329c3
[client] update tests
tsirysndr Aug 25, 2024
7ba2ee7
[server] update tests
tsirysndr Aug 25, 2024
78fcd7d
remove unused crate: common
tsirysndr Aug 25, 2024
ec3e539
[graphql] migrate tracklist api into wasm plugin
tsirysndr Aug 25, 2024
d8a9cdd
[graphql/tests] add missing global user_data
tsirysndr Aug 25, 2024
417ff95
[graphql] fix tests
tsirysndr Aug 25, 2024
e831cf4
[storage] fix tests
tsirysndr Aug 25, 2024
f6f2456
[storage] make all tests async fn
tsirysndr Aug 25, 2024
372d3f0
[storage] fix tests
tsirysndr Aug 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,468 changes: 2,175 additions & 293 deletions Cargo.lock

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ members = [
"types",
"webui",
"webui/musicplayer/src-tauri",
"common/",
"addons/chromecast",
"addons/dlna",
"addons/kodi",
"addons/local",
"addons/mopidy",
"addons/mpd",
"addons/mpris",
"addons/squeezebox",
"addons/tunein",
"pdk",
"common",
"host_fn",
]

[[bin]]
Expand Down Expand Up @@ -111,14 +124,17 @@ version = "^0.9.0"

[dependencies]
anyhow = "1.0.67"
clap = "3.2.20"
clap = "4.5.16"
crossterm = {version = "0.25.0", features = ["serde"]}
dirs = "4.0.0"
extism = "1.5.0"
futures = "0.3.24"
futures-channel = "0.3.24"
lofty = "0.9.0"
md5 = "0.7.0"
music-player-host-fn = {path = "host_fn", version = "0.1.0"}
owo-colors = "3.5.0"
reqwest = {version = "0.12.7", features = ["rustls-tls", "blocking"], default-features = false}
sea-orm = {version = "0.9.2", features = ["runtime-tokio-rustls", "sqlx-sqlite"]}
serde_json = "1.0.85"
spinners = "4.1.0"
Expand All @@ -127,3 +143,4 @@ time = "0.3.36"
tokio = {version = "1.21.0", features = ["full"]}
tui = {version = "0.19.0", features = ["crossterm", "serde"]}
tungstenite = "0.17.3"
ureq = "2.10.1"
11 changes: 11 additions & 0 deletions addons/chromecast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
edition = "2021"
name = "chromecast"
version = "0.1.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
extism-pdk = "1.2.1"
music-player-pdk = {version = "0.1.0", path = "../../pdk"}
82 changes: 82 additions & 0 deletions addons/chromecast/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
use extism_pdk::*;
use music_player_pdk::{addon, Capability};

const ADDON_NAME: &str = "chromecast";

#[plugin_fn]
pub fn setup() -> FnResult<()> {
addon()
.register(ADDON_NAME)?
.with_capabilities(vec![Capability::Player])?;
Ok(())
}

#[plugin_fn]
pub fn play() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn pause() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn stop() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn next() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn previous() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn seek() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn load_tracks() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn play_next() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn load() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn get_current_playback() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn get_current_tracklist() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn play_track_at() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn remove_track_at() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn connect_to() -> FnResult<()> {
Ok(())
}
11 changes: 11 additions & 0 deletions addons/dlna/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
edition = "2021"
name = "dlna"
version = "0.1.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
extism-pdk = "1.2.1"
music-player-pdk = {version = "0.1.0", path = "../../pdk"}
82 changes: 82 additions & 0 deletions addons/dlna/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
use extism_pdk::*;
use music_player_pdk::{addon, Capability};

const ADDON_NAME: &str = "dlna";

#[plugin_fn]
pub fn setup() -> FnResult<()> {
addon()
.register(ADDON_NAME)?
.with_capabilities(vec![Capability::Player, Capability::Browse])?;
Ok(())
}

#[plugin_fn]
pub fn play() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn pause() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn stop() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn next() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn previous() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn seek() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn load_tracks() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn play_next() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn load() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn get_current_playback() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn get_current_tracklist() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn play_track_at() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn remove_track_at() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn connect_to() -> FnResult<()> {
Ok(())
}
11 changes: 11 additions & 0 deletions addons/kodi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
edition = "2021"
name = "kodi"
version = "0.1.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
extism-pdk = "1.2.1"
music-player-pdk = {version = "0.1.0", path = "../../pdk"}
81 changes: 81 additions & 0 deletions addons/kodi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
use extism_pdk::*;
use music_player_pdk::{addon, Capability};

const ADDON_NAME: &str = "kodi";
#[plugin_fn]
pub fn setup() -> FnResult<()> {
addon()
.register(ADDON_NAME)?
.with_capabilities(vec![Capability::Player, Capability::Browse])?;
Ok(())
}

#[plugin_fn]
pub fn play() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn pause() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn stop() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn next() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn previous() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn seek() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn load_tracks() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn play_next() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn load() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn get_current_playback() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn get_current_tracklist() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn play_track_at() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn remove_track_at() -> FnResult<()> {
Ok(())
}

#[plugin_fn]
pub fn connect_to() -> FnResult<()> {
Ok(())
}
11 changes: 11 additions & 0 deletions addons/local/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
edition = "2021"
name = "local"
version = "0.1.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
extism-pdk = "1.2.1"
music-player-pdk = {version = "0.1.0", path = "../../pdk"}
Loading
Loading