Skip to content

Commit

Permalink
0.6.0: artwork support, new SwiftUI client, new protocol iteration
Browse files Browse the repository at this point in the history
Drop of the "XOR encryption"

Signed-off-by: Ivan Bushchik <[email protected]>
  • Loading branch information
ivabus committed Jul 12, 2024
1 parent ff52e14 commit ec55bd2
Show file tree
Hide file tree
Showing 75 changed files with 2,578 additions and 1,003 deletions.
1,109 changes: 786 additions & 323 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ members = [
"monoclient-s",
"monolib",
"monoloader",
"microserve",
]

[package]
name = "lonelyradio"
description = "TCP radio for lonely ones"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
license = "MIT"
authors = ["Ivan Bushchik <[email protected]>"]
repository = "https://github.com/ivabus/lonelyradio"

[dependencies]
lonelyradio_types = { version = "0.6.0", path = "./lonelyradio_types" }
rand = "0.8.5"
clap = { version = "4.4.18", features = ["derive"] }
tokio = { version = "1.35.1", features = [
Expand All @@ -43,9 +43,12 @@ async-stream = "0.3.5"
tokio-stream = { version = "0.1.15", features = ["sync"] }
futures-util = "0.3.30"
samplerate = "0.2.4"
lonelyradio_types = { version = "0.5.0", path = "./lonelyradio_types" }
once_cell = "1.19.0"
flacenc = { version = "0.4.0", default-features = false }
image = "0.25.1"

[build-dependencies]
cc = "1.0.98"

[profile.release]
opt-level = 3
Expand Down
72 changes: 43 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,90 @@
# lonelyradio

Broadcast audio over the internet.
Broadcast lossless audio over the internet.

Decodes audio streams using [symphonia](https://github.com/pdeljanov/Symphonia).

Optionally transcodes audio into and from FLAC using [flacenc-rs](https://github.com/yotarok/flacenc-rs/) and [claxon](https://github.com/ruuda/claxon).

## Installation

### Install music server
## Install server

```shell
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.5.0 lonelyradio
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 lonelyradio
```

### Install CLI client
## Run

```shell
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.5.0 monoclient
```
lonelyradio <MUSIC_FOLDER>
```

### Install GUI (Slint) client
All files (recursively) will be shuffled and played back. Public log will be displayed to stdout, private to stderr.

```shell
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.5.0 monoclient-s
```
Look into `--help` for detailed info

## Run
### Clients

```
lonelyradio [-a <ADDRESS:PORT>] [-p|--public-log] [-w|--war] [-m|--max-samplerate M] [--xor-key-file FILE] [--no-resampling] [-f|--flac] <MUSIC_FOLDER>
```
#### monoclient-x

All files (recursively) will be shuffled and played back. Public log will be displayed to stdout, private to stderr.
[monoclient-x](./monoclient-x) is a SwiftUI player for lonelyradio for iOS/iPadOS/macOS

`-m|--max-samplerate M` will resample tracks which samplerate exceeds M to M
##### Build

`--xor-key-file FILE` will XOR all outgoing bytes looping through FILE
1. Build monolib with [xcframework](https://github.com/Binlogo/cargo-xcframework)
2. Build monoclient-x using Xcode or `xcodebuild`

`-f|--flac` will enable (experimental) FLAC compression
#### monoclient-s

[monoclient-s](./monoclient-s) is a GUI player for lonelyradio built with [Slint](https://slint.dev)

### Clients

[monoclient](./monoclient) is a recommended CLI player for lonelyradio that uses [monolib](./monolib)
##### Install

```shell
monoclient <SERVER>:<PORT>
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 monoclient-s
```

[monoclient-s](./monoclient-s) is a experimental GUI player for lonelyradio built with [Slint](https://slint.dev)
You may need to install some dependencies for Slint.

Desktop integration will be added later.

##### Build

```
cargo build -p monoclient-s
```

You may need to install some dependencies for Slint.

#### monoclient

[monoclient](./monoclient) is a CLI player for lonelyradio that uses [monolib](./monolib)

```shell
monoclient-s
monoclient <SERVER>:<PORT>
```

Desktop integration will be added later.
##### Install monoclient

### Other clients
```shell
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 monoclient
```

SwiftUI client is availible in [platform](./platform) directory.
# Other things

[monoloader](./monoloader) is a tool, that allows you to download individual audio tracks from lonelyradio-compatible servers.

[monolib](./monolib) provides a C API compatible with lonelyradio for creating custom clients.

The full protocol specification will be available later. If you would like to learn more about it now, please refer to the monolib.

#### monolib API stability

As lonelyradio has not yet reached its first major release, the API may (and will) break at any point.

### Microphone server

Experimental server (lonelyradio-compatible) for streaming audio from your microphone is available in the [microserve](./microserve) crate.
Experimental (and uncompatible with versions 0.6+) server (lonelyradio-compatible) for streaming audio from your microphone is available in the [microserve](./microserve) crate.

## License

Expand Down
3 changes: 2 additions & 1 deletion lonelyradio_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
name = "lonelyradio_types"
description = "Shared types for lonelyradio"
license = "MIT"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = ["Ivan Bushchik <[email protected]>"]
repository = "https://github.com/ivabus/lonelyradio"

[dependencies]
serde = { version = "1.0.197", features = ["derive"] }
serde_bytes = "0.11.15"
42 changes: 40 additions & 2 deletions lonelyradio_types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,63 @@
use serde::{Deserialize, Serialize};

pub const HELLO_MAGIC: u64 = 0x104e1374d10;

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
pub enum Message {
T(TrackMetadata),
F(FragmentMetadata),
}

#[repr(C)]
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
pub struct Settings {
#[serde(rename = "e")]
pub encoder: Encoder,

#[serde(rename = "co")]
pub cover: i32,
}

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
pub struct ServerCapabilities {
#[serde(rename = "e")]
pub encoders: Vec<Encoder>,
}

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
pub struct TrackMetadata {
#[serde(rename = "tls")]
pub track_length_secs: u64,
#[serde(rename = "tlf")]
pub track_length_frac: f32,
#[serde(rename = "c")]
pub channels: u16,
#[serde(rename = "sr")]
pub sample_rate: u32,
pub flac: bool,
#[serde(rename = "e")]
pub encoder: Encoder,
#[serde(rename = "mt")]
pub title: String,
#[serde(rename = "mal")]
pub album: String,
#[serde(rename = "mar")]
pub artist: String,
#[serde(rename = "co")]
#[serde(with = "serde_bytes")]
pub cover: Option<Vec<u8>>,
}

#[repr(u8)]
#[derive(Deserialize, Serialize, Clone, Copy, Debug, PartialEq)]
pub enum Encoder {
Pcm16 = 0,
PcmFloat = 1,
Flac = 2,
}

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
pub struct FragmentMetadata {
// In samples or bytes (if FLAC)
// In bytes
#[serde(rename = "l")]
pub length: u64,
}
3 changes: 2 additions & 1 deletion microserve/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ async fn update_start() {
async fn stream(mut s: std::net::TcpStream) {
println!("Playing for {}", s.peer_addr().unwrap());
let md = lonelyradio_types::Message::T(TrackMetadata {
flac: false,
cover: None,
encoder: lonelyradio_types::Encoder::Pcm,
track_length_secs: 0,
track_length_frac: 0.0,
channels: 1,
Expand Down
25 changes: 14 additions & 11 deletions monoclient-s/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
[package]
name = "monoclient-s"
description = "Client for lonelyradio built with Slint"
version = "0.5.0"
version = "0.6.0"
edition = "2021"

[dependencies]
slint = { version = "1.6.0", features = ["backend-android-activity-06"] }
monolib = { path = "../monolib" }
slint = { version = "1.6", features = ["backend-android-activity-06"] }
monolib = { path = "../monolib", version = "0.6.0" }
lonelyradio_types = { version = "0.6.0", path = "../lonelyradio_types" }
zune-jpeg = "0.4.11"

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

# TODO: Set up cargo-bundle
#[package.metadata.bundle]
#name = "monoclient-s"
#identifier = "dev.ivabus.monoclient-s"
#icon = ["lonelyradio.png", "lonelyradio.icns"]
#version = "0.5.0"
#copyright = "Copyright (c) 2024 Ivan Bushchik."
#category = "Music"
[package.metadata.bundle]
name = "monoclient-s"
identifier = "dev.ivabus.monoclient-s"
icon = ["lonelyradio.png", "lonelyradio.icns"]
version = "0.5.0"
copyright = "Copyright (c) 2024 Ivan Bushchik."
category = "Music"
Binary file added monoclient-s/lonelyradio.icns
Binary file not shown.
Binary file added monoclient-s/lonelyradio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ec55bd2

Please sign in to comment.