Init commit

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2025-08-20 19:54:27 +02:00
commit 90d7e8f0cc
24 changed files with 2928 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/target
/*/target

1666
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

4
Cargo.toml Normal file
View File

@@ -0,0 +1,4 @@
[workspace]
resolver = "3"
members = ["plux", "pluxtl"]

6
gui/Cargo.toml Normal file
View File

@@ -0,0 +1,6 @@
[package]
name = "plugin-manager-gui"
version = "0.1.0"
edition = "2024"
[dependencies]

3
gui/src/main.rs Normal file
View File

@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View File

@@ -0,0 +1,27 @@
name = "Hamburger"
description = "Nice distortion"
developer = "Aviary Audio"
link = "https://somelink"
[[versions]]
version = "0.5"
[[versions.platforms]]
platform = "macos"
[[versions.platforms.formats]]
format = "vst3"
url = "https://somelink"
sha256 = "somesha"
[versions.platforms.formats.handler.unzip]
path = "./Manual Install/hamburger.vst"
[[versions.platforms.formats]]
format = "clap"
url = "https://somelink"
sha256 = "somesha"
[versions.platforms.formats.handler.unzip]
path = "./Manual Install/hamburger.clap"

View File

@@ -0,0 +1,10 @@
name = "Test"
description = "Test"
[[maintainers]]
name = "allanger"
email = "allanger@badhouseplants.net"
[[files]]
path = "./aviary/hamburger.toml"
sha256 = "482bfc9615b127239fbf356b7636f593f5c522d85e0966e74cc5cef08f9d8966"

326
plux/Cargo.lock generated Normal file
View File

@@ -0,0 +1,326 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "bitflags"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]]
name = "cfg-if"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "dirs"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys",
]
[[package]]
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "getrandom"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "hashbrown"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
[[package]]
name = "indexmap"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "libc"
version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]]
name = "libredox"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3"
dependencies = [
"bitflags",
"libc",
]
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "plux"
version = "0.1.0"
dependencies = [
"dirs",
"serde",
"toml",
]
[[package]]
name = "proc-macro2"
version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_users"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [
"getrandom",
"libredox",
"thiserror",
]
[[package]]
name = "serde"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_spanned"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
dependencies = [
"serde",
]
[[package]]
name = "syn"
version = "2.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc3fcb250e53458e712715cf74285c1f889686520d79294a9ef3bd7aa1fc619"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "thiserror"
version = "2.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b0949c3a6c842cbde3f1686d6eea5a010516deb7085f79db747562d4102f41e"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "2.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc5b44b4ab9c2fdd0e0512e6bece8388e214c0749f5862b114cc5b7a25daf227"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "toml"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"toml_parser",
"toml_writer",
"winnow",
]
[[package]]
name = "toml_datetime"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
dependencies = [
"serde",
]
[[package]]
name = "toml_parser"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10"
dependencies = [
"winnow",
]
[[package]]
name = "toml_writer"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64"
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "windows-link"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
[[package]]
name = "windows-sys"
version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.53.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
dependencies = [
"windows-link",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
[[package]]
name = "windows_aarch64_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
[[package]]
name = "windows_i686_gnu"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
[[package]]
name = "windows_i686_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
[[package]]
name = "windows_i686_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
[[package]]
name = "windows_x86_64_gnu"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
[[package]]
name = "windows_x86_64_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]]
name = "winnow"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"

15
plux/Cargo.toml Normal file
View File

@@ -0,0 +1,15 @@
[package]
name = "plux"
version = "0.1.0"
edition = "2024"
[dependencies]
checksums = "0.9.1"
dirs = "6.0.0"
env_logger = "0.11.8"
git2 = "0.20.2"
hex = "0.4.3"
log = { version = "0.4.27", features = ["kv"] }
serde = { version = "1.0.219", features = ["serde_derive"] }
sha2 = "0.10.9"
toml = "0.9.5"

7
plux/config.yaml Normal file
View File

@@ -0,0 +1,7 @@
dirs:
cache_path: ~/.cache
collections_path: ~/.cache
paths:
vst3: ~/.vst3
clap: ~/.clap

22
plux/repo.yaml Normal file
View File

@@ -0,0 +1,22 @@
---
# collection
name: Test collection
description: |
This collection is supposed to be used only for testing purposes
files:
- ./aviary_plugins/hamburger.yaml
---
# aviary_plugins/hamburger.yaml
name: Hamburger
developer: Aviary Plugins
description: |
Hamburger is a distortion plugin with inbuilt dynamics controls and equalisation that can deliver both subtle tangy harmonics and absolute annilhilation and noise-wall-ification to any sound.
versions:
- version: "0.5"
format: vst3
downloads:
- os: macos
url: https://github.com/Davit-G/Hamburger/releases/download/v{{ .version }}/Hamburger.v{{ .version }}.MacOS.Universal.zip
handler:
zip:
path: ./test.vst

171
plux/src/collection.rs Normal file
View File

@@ -0,0 +1,171 @@
use std::{error::Error, fs::{self, read_to_string, remove_dir_all}, os, path::Path};
use checksums::hash_file;
use git2::{build::RepoBuilder, Config, IndexEntry, Repository};
use log::{error, info};
use serde::{Deserialize, Serialize};
use crate::{config, index::Index, plugin::Plugin};
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Collection {
name: String,
description: String,
maintainers: Vec<Maintainer>,
files: Vec<File>,
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct CollectionList {
pub name: String,
pub local_name: String,
}
impl Collection {
/*
* Public nethods
*/
// Add a collection to the collections folder
pub fn add_collection(url: &str, name: Option<&str>) -> Result<String, Box<dyn std::error::Error>> {
info!("Adding collection");
let cfg = config::read_config()?;
let name = match name {
Some(name) => name,
None => url.trim_end_matches('/').split('/').last().unwrap().trim_end_matches(".git"),
};
let dir = format!("{}/{}", cfg.paths.collections_path, name);
info!("Checking if the repo already exists");
let path = Path::new(&dir);
if path.exists() {
return Err(Box::from(std::io::Error::new(std::io::ErrorKind::AlreadyExists, "repo already exists")));
}
info!("Cloning the repo");
// Set up the RepoBuilder with our config
let mut builder = RepoBuilder::new();
builder.clone(url, path)?;
info!("Verifying collections");
// Verify the collection.toml
let collection_toml = read_to_string(format!("{}/collection.toml", dir))?;
let collection = match Collection::from_toml(&collection_toml) {
Ok(collection) => collection,
Err(err) => {
error!("Collection file can't be read");
remove_dir_all(path)?;
return Err(err);
},
};
if let Some(err) = collection.verify_collection(&dir).err() {
error!("Couldn't verify collection");
remove_dir_all(path)?;
return Err(err);
}
info!("Collection is added");
match path.to_str() {
Some(res) => Ok(res.to_owned()),
None => Ok("Path not found, but collection is added".to_string()),
}
}
pub fn remove_collection(name: &str) -> Result<(), Box<dyn Error>> {
let cfg = config::read_config()?;
let dir = format!("{}/{}", cfg.paths.collections_path, name);
info!("Checking if the repo already exists");
let path = Path::new(&dir);
if ! path.exists() {
return Err(Box::from(std::io::Error::new(std::io::ErrorKind::NotFound, "repo doesn't exist")));
};
let collection_toml = read_to_string(format!("{}/collection.toml", dir))?;
let collection = match Collection::from_toml(&collection_toml) {
Ok(collection) => collection,
Err(err) => {
error!("Collection file can't be read");
remove_dir_all(path)?;
return Err(err);
},
};
fs::remove_dir_all(dir)?;
let index = Index::read_index_file()?;
index.remove_collection(collection.name).save_index()?;
Ok(())
}
pub fn list_collections() -> Result<Vec<CollectionList>, Box <dyn Error>> {
let cfg = config::read_config()?;
let index = Index::read_index_file()?;
let mut result: Vec<CollectionList> = vec![];
for collection in index.collections {
let list_entry = CollectionList{
name: collection.name,
local_name: collection.path,
};
result.push(list_entry);
}
return Ok(result);
}
fn from_toml(toml_data: &str) -> Result<Collection, Box<dyn Error>> {
let result = toml::from_str(toml_data)?;
Ok(result)
}
fn verify_collection(&self, path: &str) -> Result<(), Box<dyn Error>> {
info!(a = 1; "getting current index");
let mut index = Index::read_index_file()?;
for file in self.clone().files {
let full_path = format!("{}/{}", path, file.path);
info!(a = 1; "Verifying a file");
let absolute_path = Path::new(&full_path);
if ! absolute_path.exists() {
return Err(Box::from(std::io::Error::new(std::io::ErrorKind::NotFound ,"file not found")));
}
let checksum = hash_file(absolute_path, checksums::Algorithm::SHA2256);
// TODO: Might be a bad idea to do uppercaes
if checksum != file.sha256.to_uppercase() {
info!("-{}-", checksum);
info!("-{}-", file.sha256);
//TODO: I need to implement my errors
return Err(Box::from(std::io::Error::new(std::io::ErrorKind::NotFound, "Boah, something with checksums")));
}
let plugin = Plugin::from_toml(read_to_string(absolute_path)?.as_str())?;
index = index.append_plugin_to_index(plugin, &full_path, self.name());
}
index = index.append_collection_to_index(self.clone(), self.name(), path);
index.save_index()?;
info!("{:?}", index);
Ok(())
}
pub fn name(&self) -> &str {
&self.name
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct File {
path: String,
sha256: String,
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Maintainer {
name: String,
email: String,
}

75
plux/src/config.rs Normal file
View File

@@ -0,0 +1,75 @@
use std::fs::{self, create_dir_all, read_to_string};
use log::info;
use serde::{Deserialize, Serialize};
use toml::{self, to_string};
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct Config {
pub paths: Paths,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct Paths {
pub cache_path: String,
pub collections_path: String,
vst3: String,
clap: String,
}
impl Default for Paths {
fn default() -> Self {
let collections_path = match dirs::data_dir() {
// TODO: I'm pretty sure it can't be so bad
Some(path) => {
match path.as_path().to_str() {
Some(res) => format!("{}/plux", res).to_string(),
None => panic!("I don't know what to do with the path"),
}
},
None => panic!("I don't know what to do with the path"),
};
let cache_path = match dirs::cache_dir() {
Some(path) => {
match path.as_path().to_str() {
Some(res) => format!("{}/plux", res).to_string(),
None => panic!("I don't know what to do with the path"),
}
},
None => panic!("I don't know what to do with the path"),
};
let vst3 = "~/.vst3".to_string();
let clap = "~/.clap".to_string();
Self { cache_path, collections_path, vst3, clap }
}
}
pub fn read_config() -> Result<Config, std::io::Error> {
let config_path = match dirs::config_dir() {
Some(path) => {
match path.as_path().to_str() {
Some(res) => res.to_string(),
None => panic!("I don't know what to do with the path"),
}
},
None => panic!("I don't know what to do with the path"),
};
let config_dir = format!("{}/plux", config_path);
let config_file = format!("{}/config.toml", config_dir);
//
let config_data: Config = match read_to_string(config_file.clone()) {
Ok(res) => toml::from_str(res.as_str()).unwrap(),
Err(_err) => {
info!("Config is not found, creating a default one");
create_dir_all(config_dir).unwrap();
let config_data = Config::default();
let config_toml = to_string(&config_data).unwrap();
fs::write(config_file, config_toml).unwrap();
config_data
},
};
Ok(config_data)
}
// If config doesn't exist, create a default one

4
plux/src/handlers.rs Normal file
View File

@@ -0,0 +1,4 @@
mod zip;
pub trait Handler {}

10
plux/src/handlers/zip.rs Normal file
View File

@@ -0,0 +1,10 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Zip {
path: String,
}
impl super::Handler for Zip {}

87
plux/src/index.rs Normal file
View File

@@ -0,0 +1,87 @@
use std::{error::Error, fs::{self, create_dir_all, read_to_string}};
use log::info;
use serde::{Deserialize, Serialize};
use toml::to_string;
use crate::{collection::Collection, config::read_config, plugin::Plugin};
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
pub(crate) struct Index {
pub(crate) collections: Vec<CollectionIndex>,
pub(crate) plugins: Vec<PluginIndex>,
}
impl Index {
pub(crate) fn read_index_file() -> Result<Self, Box<dyn Error>> {
let cfg = read_config()?;
let path = cfg.paths.collections_path;
let index_file = format!("{}/index.toml", path);
let data: Self = match read_to_string(index_file.clone()) {
Ok(res) => toml::from_str(res.as_str()).unwrap(),
Err(_err) => {
info!("Config is not found, creating a default one");
create_dir_all(path).unwrap();
let index_data = Index::default();
let index_toml = to_string(&index_data).unwrap();
fs::write(index_file, index_toml).unwrap();
index_data
},
};
Ok(data)
}
pub(crate) fn remove_collection(&self, collection: String) -> Self {
let mut clone = self.clone();
clone.collections.retain(| val | val.name != collection);
clone.plugins.retain(| val | val.collection != collection);
return clone;
}
pub(crate) fn save_index(&self) -> Result<(), Box<dyn Error>> {
let cfg = read_config()?;
let path = cfg.paths.collections_path;
let index_file = format!("{}/index.toml", path);
let data_toml = toml::to_string(self)?;
fs::write(index_file, data_toml)?;
Ok(())
}
pub(crate) fn append_collection_to_index(&self, collection: Collection, url: &str, path: &str) -> Index {
let mut clone = self.clone();
clone.collections.push(CollectionIndex::from_collection(collection, url, path));
clone
}
pub(crate) fn append_plugin_to_index(&self, plugin: Plugin, path: &str, collection: &str) -> Index {
let mut clone = self.clone();
clone.plugins.push(PluginIndex::from_plugin(plugin, path, collection));
clone
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub(crate) struct CollectionIndex {
pub(crate) name: String,
pub(crate) url: String,
pub(crate) path: String,
}
impl CollectionIndex {
fn from_collection(collection: Collection, url: &str, path: &str) -> Self {
Self { name: collection.name().to_string(), url: url.to_string(), path: path.to_string() }
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub(crate) struct PluginIndex {
name: String,
collection: String,
path: String,
}
impl PluginIndex {
fn from_plugin(plugin: Plugin, path: &str, collection: &str) -> Self {
Self { name: plugin.name().to_string(), collection: collection.to_string(), path: path.to_string() }
}
}

20
plux/src/lib.rs Normal file
View File

@@ -0,0 +1,20 @@
pub mod handlers;
pub mod collection;
pub mod config;
pub mod index;
pub mod plugin;
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

43
plux/src/plugin.rs Normal file
View File

@@ -0,0 +1,43 @@
use std::error::Error;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Plugin {
name: String,
description: String,
developer: String,
source: Option<String>,
versions: Vec<Version>,
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Version {
version: String,
platforms: Vec<Platform>,
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Platform {
platform: String,
formats: Vec<Format>,
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Format {
format: String,
url: String,
sha256: String,
}
impl Plugin {
pub(crate) fn from_toml(toml_data: &str) -> Result<Plugin, Box<dyn Error>> {
let result = toml::from_str(toml_data)?;
Ok(result)
}
pub fn name(&self) -> &str {
&self.name
}
}

251
pluxtl/Cargo.lock generated Normal file
View File

@@ -0,0 +1,251 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "anstream"
version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
[[package]]
name = "anstyle-parse"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
dependencies = [
"anstyle",
"once_cell_polyfill",
"windows-sys",
]
[[package]]
name = "clap"
version = "4.5.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318"
dependencies = [
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap_builder"
version = "4.5.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.5.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "colorchoice"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "once_cell_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]]
name = "pluxctl"
version = "0.1.0"
dependencies = [
"clap",
]
[[package]]
name = "proc-macro2"
version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "2.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc3fcb250e53458e712715cf74285c1f889686520d79294a9ef3bd7aa1fc619"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "windows-link"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
[[package]]
name = "windows-sys"
version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.53.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
dependencies = [
"windows-link",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
[[package]]
name = "windows_aarch64_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
[[package]]
name = "windows_i686_gnu"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
[[package]]
name = "windows_i686_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
[[package]]
name = "windows_i686_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
[[package]]
name = "windows_x86_64_gnu"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
[[package]]
name = "windows_x86_64_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"

10
pluxtl/Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "pluxctl"
version = "0.1.0"
edition = "2024"
[dependencies]
clap = { version = "4.5.45", features = ["derive"] }
env_logger = "0.11.8"
plux = { path = "../plux" }
toml = "0.9.5"

129
pluxtl/src/main.rs Normal file
View File

@@ -0,0 +1,129 @@
use std::{path::PathBuf};
use clap::{Parser, Subcommand};
use plux::{collection, config};
#[derive(Parser)]
#[command(version, about, long_about = None)]
struct Cli {
/// Optional name to operate on
name: Option<String>,
/// Sets a custom config file
#[arg(short, long, value_name = "FILE")]
config: Option<PathBuf>,
/// Turn debugging information on
#[arg(short, long, action = clap::ArgAction::Count)]
debug: u8,
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
/// does testing things
Collection {
#[command(subcommand)]
subcommands: CollectionCommands,
},
Plugin,
Config {
#[command(subcommand)]
subcommands: ConfigCommands,
}
}
#[derive(Subcommand)]
enum CollectionCommands {
Add {
#[arg(short, long, value_name = "URL")]
url: String
},
Delete {
#[arg(short, long, value_name = "NAME")]
name: String
},
List
}
#[derive(Subcommand)]
enum ConfigCommands {
Show
}
fn add_collection(url: &str) {
match collection::Collection::add_collection(url, None) {
Ok(_) => println!("done"),
Err(e) => eprintln!("{}", e),
};
}
fn remove_collection(name: &str) {
match collection::Collection::remove_collection(name) {
Ok(_) => println!("done"),
Err(e) => eprintln!("{}", e),
}
}
fn list_collections() {
match collection::Collection::list_collections() {
Ok(res) => println!("{:?}", res),
Err(e) => eprintln!("{}", e),
}
}
fn main() {
env_logger::init();
let config = match plux::config::read_config() {
Ok(res) => res,
Err(err) => panic!("Something didn't work",),
};
let cli = Cli::parse();
// You can check the value provided by positional arguments, or option arguments
if let Some(name) = cli.name.as_deref() {
println!("Value for name: {name}");
}
if let Some(config_path) = cli.config.as_deref() {
println!("Value for config: {}", config_path.display());
}
// You can see how many times a particular flag or argument occurred
// Note, only flags can have multiple occurrences
match cli.debug {
0 => println!("Debug mode is off"),
1 => println!("Debug mode is kind of on"),
2 => println!("Debug mode is on"),
_ => println!("Don't be crazy"),
}
// You can check for the existence of subcommands, and if found use their
// matches just as you would the top level cmd
match &cli.command {
Commands::Collection { subcommands } => match subcommands {
CollectionCommands::Add { url } => add_collection(&url),
CollectionCommands::Delete { name } => remove_collection(&name),
CollectionCommands::List => list_collections(),
},
Commands::Plugin => todo!(),
Commands::Config { subcommands } => match subcommands {
ConfigCommands::Show => show_config(),
},
}
// Continued program logic goes here...
}
fn show_config() {
let cfg = match config::read_config() {
Ok(res) => res,
Err(e) => todo!(),
};
let cfg_toml = toml::to_string(&cfg).unwrap();
println!("{}", cfg_toml)
}

3
src/main.rs Normal file
View File

@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View File

@@ -0,0 +1,27 @@
name = "Hamburger"
description = "Nice distortion"
developer = "Aviary Audio"
link = "https://somelink"
[[versions]]
version = 0.5
[[versions.platforms]]
platform = "macos"
[[versions.platforms.formats]]
format = "vst3"
url = "https://somelink"
sha256 = "somesha"
[versions.platforms.formats.handler.unzip]
path = "./Manual Install/hamburger.vst"
[[versions.platforms.formats]]
format = "clap"
url = "https://somelink"
sha256 = "somesha"
[versions.platforms.formats.handler.unzip]
path = "./Manual Install/hamburger.clap"

View File

@@ -0,0 +1,10 @@
name = "Test"
description = "Test"
[[maintainers]]
name = "allanger"
email = "allanger@badhouseplants.net"
[[files]]
path = "./aviary/hamburger.toml"
sha256 = "something"