Compare commits

...

3 commits

Author SHA1 Message Date
adf4b7bb1c
Bump lonelyradio and monoclient to 0.6.1
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
2024-07-13 22:23:43 +03:00
eaa7262d37
monoclient: fix clippy issues
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
2024-07-13 22:20:57 +03:00
7e8f797533
lonelyradio: Fix extension validation
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
2024-07-13 22:19:26 +03:00
6 changed files with 21 additions and 20 deletions

4
Cargo.lock generated
View file

@ -2866,7 +2866,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "lonelyradio"
version = "0.6.0"
version = "0.6.1"
dependencies = [
"async-stream",
"cc",
@ -3077,7 +3077,7 @@ dependencies = [
[[package]]
name = "monoclient"
version = "0.6.0"
version = "0.6.1"
dependencies = [
"clap",
"crossterm",

View file

@ -10,7 +10,7 @@ members = [
[package]
name = "lonelyradio"
description = "TCP radio for lonely ones"
version = "0.6.0"
version = "0.6.1"
edition = "2021"
license = "MIT"
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]

View file

@ -9,7 +9,7 @@ Optionally transcodes audio into and from FLAC using [flacenc-rs](https://github
## Install server
```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
@ -41,7 +41,7 @@ Look into `--help` for detailed info
##### Install
```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.
@ -67,7 +67,7 @@ monoclient <SERVER>:<PORT>
##### Install monoclient
```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

View file

@ -1,7 +1,7 @@
[package]
name = "monoclient"
license = "MIT"
version = "0.6.0"
version = "0.6.1"
edition = "2021"
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]
repository = "https://github.com/ivabus/lonelyradio"

View file

@ -5,7 +5,6 @@ use crossterm::style::Print;
use crossterm::terminal::{Clear, ClearType};
use lonelyradio_types::{Encoder, Settings};
use std::io::stdout;
use std::path::PathBuf;
use std::sync::OnceLock;
use std::time::Instant;
@ -16,9 +15,6 @@ struct Args {
/// Remote address
address: String,
#[arg(long)]
xor_key_file: Option<PathBuf>,
#[arg(short, long)]
verbose: bool,
}
@ -44,7 +40,6 @@ fn main() {
std::thread::spawn(move || {
monolib::run(
&args.address,
args.xor_key_file.map(|key| std::fs::read(key).expect("Failed to read preshared key")),
Settings {
encoder: Encoder::PcmFloat,
cover: -1,
@ -68,7 +63,6 @@ fn main() {
))
)
.unwrap();
let mut track_length = md.track_length_secs as f64 + md.track_length_frac as f64;
let mut next_md = md.clone();
crossterm::terminal::enable_raw_mode().unwrap();
loop {
@ -138,7 +132,6 @@ fn main() {
);
track_start = Instant::now();
seconds_past = 0;
track_length = md.track_length_secs as f64 + md.track_length_frac as f64
} else if next_md == md {
next_md = monolib::get_metadata().unwrap();
}

View file

@ -193,15 +193,23 @@ fn is_not_hidden(entry: &DirEntry) -> 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;
}
// Skipping "images" (covers)
if "jpgjpegpngwebp".contains(&track.extension().unwrap().to_str().unwrap().to_ascii_lowercase())
{
return false;
if let Some(ext) = track.extension() {
[
"aac", "mp1", "mp2", "mp3", "wav", "wave", "webm", "mkv", "mp4", "m4a", "m4p", "m4b",
"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) {