From 0afbed57587fb61cd54725c5d678e8811a0d02e8 Mon Sep 17 00:00:00 2001 From: Ivan Bushchik Date: Fri, 15 Mar 2024 18:49:17 +0300 Subject: [PATCH] v0.2.2: Add monolib docs and readme Signed-off-by: Ivan Bushchik --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- README.md | 8 +++++++- monoclient/Cargo.toml | 2 +- monolib/Cargo.toml | 2 +- monolib/README.md | 16 ++++++++++++++++ monolib/src/lib.rs | 16 ++++++++++++++++ platform/swiftui/monoclient/ContentView.swift | 4 ++-- 8 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 monolib/README.md diff --git a/Cargo.lock b/Cargo.lock index 0f606d1..acbb622 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -597,7 +597,7 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lonelyradio" -version = "0.2.1" +version = "0.2.2" dependencies = [ "chrono", "clap", @@ -653,7 +653,7 @@ dependencies = [ [[package]] name = "monoclient" -version = "0.2.1" +version = "0.2.2" dependencies = [ "clap", "monolib", @@ -661,7 +661,7 @@ dependencies = [ [[package]] name = "monolib" -version = "0.2.1" +version = "0.2.2" dependencies = [ "byteorder", "rmp-serde", diff --git a/Cargo.toml b/Cargo.toml index 295dee8..0b86411 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = [ "monoclient", "monolib"] [package] name = "lonelyradio" description = "TCP radio for lonely ones" -version = "0.2.1" +version = "0.2.2" edition = "2021" license = "MIT" authors = ["Ivan Bushchik "] diff --git a/README.md b/README.md index ed5019b..fe4e278 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ Radio that uses unencrypted TCP socket for broadcasting tagged audio data. Decodes audio streams using [symphonia](https://github.com/pdeljanov/Symphonia). +## Install + +```shell +cargo install lonelyradio +``` + ## Build ```shell @@ -36,4 +42,4 @@ SwiftUI client is availible in [platform](./platform) directory. ## License -lonelyradio and monoclient are licensed under the terms of the [MIT license](./LICENSE). +lonelyradio, monolib and monoclient are licensed under the terms of the [MIT license](./LICENSE). diff --git a/monoclient/Cargo.toml b/monoclient/Cargo.toml index 7f888a7..fb94397 100644 --- a/monoclient/Cargo.toml +++ b/monoclient/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monoclient" -version = "0.2.1" +version = "0.2.2" edition = "2021" license = "MIT" diff --git a/monolib/Cargo.toml b/monolib/Cargo.toml index be3d8b9..eeae746 100644 --- a/monolib/Cargo.toml +++ b/monolib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monolib" -version = "0.2.1" +version = "0.2.2" edition = "2021" license = "MIT" description = "A library implementing the lonely radio audio streaming protocol" diff --git a/monolib/README.md b/monolib/README.md new file mode 100644 index 0000000..587a53c --- /dev/null +++ b/monolib/README.md @@ -0,0 +1,16 @@ +# Monolib + +A library implementing the lonely radio audio streaming protocol + +## Documentation + +[Docs.rs](https://docs.rs/monolib) + +## Examples + +- [CLI](../monoclient) +- [SwiftUI](../platform/swiftui) + +## License + +monolib is licensed under the terms of the [MIT license](../LICENSE). diff --git a/monolib/src/lib.rs b/monolib/src/lib.rs index 2c16ede..f07b931 100644 --- a/monolib/src/lib.rs +++ b/monolib/src/lib.rs @@ -1,3 +1,19 @@ +//! A library implementing the lonely radio audio streaming protocol +//! +//! Example usage (play for 10 seconds): +//! ```rust +//! extern crate monolib; +//! use std::thread::{sleep, spawn}; +//! use std::time::Duration; +//! +//! spawn(|| monolib::run("someserver:someport")); +//! while monolib::get_metadata().is_none() {} +//! let seconds = md.length / md.sample_rate as u64 / 2; +//! println!("Playing: {} - {} - {} ({}:{:02})", md.artist, md.album, md.title, seconds / 60, seconds % 60); +//! sleep(Duration::from_secs(10)); +//! monolib::stop(); +//!``` + /// Functions, providing C-like API pub mod c; diff --git a/platform/swiftui/monoclient/ContentView.swift b/platform/swiftui/monoclient/ContentView.swift index d3849ee..234fdf6 100644 --- a/platform/swiftui/monoclient/ContentView.swift +++ b/platform/swiftui/monoclient/ContentView.swift @@ -26,8 +26,8 @@ class MonoLib { struct ContentView: View { let timer = Timer.publish(every: 0.25, on: .main, in: .common).autoconnect() - @State private var server: String = "ivabus.dev" - @State private var port: String = "5894" + @State private var server: String = "" + @State private var port: String = "" @State private var playing: Bool = true @State private var running: Bool = false