Compare commits

..

No commits in common. "adf4b7bb1c6f21ea708d9430781408f17fd1fb9d" and "ec55bd2b1e7cae6f5a5a9b4d0509ffa1317323d9" have entirely different histories.

6 changed files with 20 additions and 21 deletions

4
Cargo.lock generated
View file

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

View file

@ -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.1" version = "0.6.0"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"] 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 ## Install server
```shell ```shell
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.1 lonelyradio cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 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.1 monoclient-s cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 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.1 monoclient cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 monoclient
``` ```
# Other things # Other things

View file

@ -1,7 +1,7 @@
[package] [package]
name = "monoclient" name = "monoclient"
license = "MIT" license = "MIT"
version = "0.6.1" version = "0.6.0"
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"

View file

@ -5,6 +5,7 @@ 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;
@ -15,6 +16,9 @@ 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,
} }
@ -40,6 +44,7 @@ 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,
@ -63,6 +68,7 @@ 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 {
@ -132,6 +138,7 @@ 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();
} }

View file

@ -193,23 +193,15 @@ fn is_not_hidden(entry: &DirEntry) -> bool {
} }
fn track_valid(track: &Path) -> bool { fn track_valid(track: &Path) -> bool {
if let Ok(meta) = track.metadata() { if !track.metadata().unwrap().is_file() {
if !meta.is_file() {
return false;
}
} else {
return false; return false;
} }
if let Some(ext) = track.extension() { // Skipping "images" (covers)
[ if "jpgjpegpngwebp".contains(&track.extension().unwrap().to_str().unwrap().to_ascii_lowercase())
"aac", "mp1", "mp2", "mp3", "wav", "wave", "webm", "mkv", "mp4", "m4a", "m4p", "m4b", {
"m4r", "m4v", "mov", "aiff", "aif", "aifc", "ogg", "ogv", "oga", "ogx", "ogm", "spx", return false;
"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) {