mirror of
https://github.com/ivabus/lonelyradio
synced 2024-11-22 08:05:10 +03:00
Compare commits
3 commits
ec55bd2b1e
...
adf4b7bb1c
Author | SHA1 | Date | |
---|---|---|---|
adf4b7bb1c | |||
eaa7262d37 | |||
7e8f797533 |
6 changed files with 21 additions and 20 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -2866,7 +2866,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lonelyradio"
|
name = "lonelyradio"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"cc",
|
"cc",
|
||||||
|
@ -3077,7 +3077,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "monoclient"
|
name = "monoclient"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"crossterm",
|
"crossterm",
|
||||||
|
|
|
@ -10,7 +10,7 @@ members = [
|
||||||
[package]
|
[package]
|
||||||
name = "lonelyradio"
|
name = "lonelyradio"
|
||||||
description = "TCP radio for lonely ones"
|
description = "TCP radio for lonely ones"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]
|
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]
|
||||||
|
|
|
@ -9,7 +9,7 @@ Optionally transcodes audio into and from FLAC using [flacenc-rs](https://github
|
||||||
## Install server
|
## Install server
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 lonelyradio
|
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.1 lonelyradio
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
@ -41,7 +41,7 @@ Look into `--help` for detailed info
|
||||||
##### Install
|
##### Install
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 monoclient-s
|
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.1 monoclient-s
|
||||||
```
|
```
|
||||||
|
|
||||||
You may need to install some dependencies for Slint.
|
You may need to install some dependencies for Slint.
|
||||||
|
@ -67,7 +67,7 @@ monoclient <SERVER>:<PORT>
|
||||||
##### Install monoclient
|
##### Install monoclient
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 monoclient
|
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.1 monoclient
|
||||||
```
|
```
|
||||||
|
|
||||||
# Other things
|
# Other things
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "monoclient"
|
name = "monoclient"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]
|
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]
|
||||||
repository = "https://github.com/ivabus/lonelyradio"
|
repository = "https://github.com/ivabus/lonelyradio"
|
||||||
|
|
|
@ -5,7 +5,6 @@ use crossterm::style::Print;
|
||||||
use crossterm::terminal::{Clear, ClearType};
|
use crossterm::terminal::{Clear, ClearType};
|
||||||
use lonelyradio_types::{Encoder, Settings};
|
use lonelyradio_types::{Encoder, Settings};
|
||||||
use std::io::stdout;
|
use std::io::stdout;
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
@ -16,9 +15,6 @@ struct Args {
|
||||||
/// Remote address
|
/// Remote address
|
||||||
address: String,
|
address: String,
|
||||||
|
|
||||||
#[arg(long)]
|
|
||||||
xor_key_file: Option<PathBuf>,
|
|
||||||
|
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
}
|
}
|
||||||
|
@ -44,7 +40,6 @@ fn main() {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
monolib::run(
|
monolib::run(
|
||||||
&args.address,
|
&args.address,
|
||||||
args.xor_key_file.map(|key| std::fs::read(key).expect("Failed to read preshared key")),
|
|
||||||
Settings {
|
Settings {
|
||||||
encoder: Encoder::PcmFloat,
|
encoder: Encoder::PcmFloat,
|
||||||
cover: -1,
|
cover: -1,
|
||||||
|
@ -68,7 +63,6 @@ fn main() {
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut track_length = md.track_length_secs as f64 + md.track_length_frac as f64;
|
|
||||||
let mut next_md = md.clone();
|
let mut next_md = md.clone();
|
||||||
crossterm::terminal::enable_raw_mode().unwrap();
|
crossterm::terminal::enable_raw_mode().unwrap();
|
||||||
loop {
|
loop {
|
||||||
|
@ -138,7 +132,6 @@ fn main() {
|
||||||
);
|
);
|
||||||
track_start = Instant::now();
|
track_start = Instant::now();
|
||||||
seconds_past = 0;
|
seconds_past = 0;
|
||||||
track_length = md.track_length_secs as f64 + md.track_length_frac as f64
|
|
||||||
} else if next_md == md {
|
} else if next_md == md {
|
||||||
next_md = monolib::get_metadata().unwrap();
|
next_md = monolib::get_metadata().unwrap();
|
||||||
}
|
}
|
||||||
|
|
20
src/main.rs
20
src/main.rs
|
@ -193,15 +193,23 @@ fn is_not_hidden(entry: &DirEntry) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn track_valid(track: &Path) -> bool {
|
fn track_valid(track: &Path) -> bool {
|
||||||
if !track.metadata().unwrap().is_file() {
|
if let Ok(meta) = track.metadata() {
|
||||||
|
if !meta.is_file() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Skipping "images" (covers)
|
if let Some(ext) = track.extension() {
|
||||||
if "jpgjpegpngwebp".contains(&track.extension().unwrap().to_str().unwrap().to_ascii_lowercase())
|
[
|
||||||
{
|
"aac", "mp1", "mp2", "mp3", "wav", "wave", "webm", "mkv", "mp4", "m4a", "m4p", "m4b",
|
||||||
return false;
|
"m4r", "m4v", "mov", "aiff", "aif", "aifc", "ogg", "ogv", "oga", "ogx", "ogm", "spx",
|
||||||
|
"opus", "caf", "flac",
|
||||||
|
]
|
||||||
|
.contains(&ext.to_str().unwrap())
|
||||||
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn stream(mut s: TcpStream, tracklist: Arc<Vec<PathBuf>>, settings: Settings) {
|
async fn stream(mut s: TcpStream, tracklist: Arc<Vec<PathBuf>>, settings: Settings) {
|
||||||
|
|
Loading…
Reference in a new issue