mirror of
https://github.com/ivabus/lonelyradio
synced 2024-11-22 08:05:10 +03:00
Compare commits
No commits in common. "adf4b7bb1c6f21ea708d9430781408f17fd1fb9d" and "ec55bd2b1e7cae6f5a5a9b4d0509ffa1317323d9" have entirely different histories.
adf4b7bb1c
...
ec55bd2b1e
6 changed files with 20 additions and 21 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -2866,7 +2866,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
|||
|
||||
[[package]]
|
||||
name = "lonelyradio"
|
||||
version = "0.6.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"async-stream",
|
||||
"cc",
|
||||
|
@ -3077,7 +3077,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "monoclient"
|
||||
version = "0.6.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"crossterm",
|
||||
|
|
|
@ -10,7 +10,7 @@ members = [
|
|||
[package]
|
||||
name = "lonelyradio"
|
||||
description = "TCP radio for lonely ones"
|
||||
version = "0.6.1"
|
||||
version = "0.6.0"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]
|
||||
|
|
|
@ -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.1 lonelyradio
|
||||
cargo install --git https://github.com/ivabus/lonelyradio --tag 0.6.0 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.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.
|
||||
|
@ -67,7 +67,7 @@ monoclient <SERVER>:<PORT>
|
|||
##### Install monoclient
|
||||
|
||||
```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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "monoclient"
|
||||
license = "MIT"
|
||||
version = "0.6.1"
|
||||
version = "0.6.0"
|
||||
edition = "2021"
|
||||
authors = ["Ivan Bushchik <ivabus@ivabus.dev>"]
|
||||
repository = "https://github.com/ivabus/lonelyradio"
|
||||
|
|
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
|
@ -15,6 +16,9 @@ struct Args {
|
|||
/// Remote address
|
||||
address: String,
|
||||
|
||||
#[arg(long)]
|
||||
xor_key_file: Option<PathBuf>,
|
||||
|
||||
#[arg(short, long)]
|
||||
verbose: bool,
|
||||
}
|
||||
|
@ -40,6 +44,7 @@ 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,
|
||||
|
@ -63,6 +68,7 @@ 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 {
|
||||
|
@ -132,6 +138,7 @@ 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();
|
||||
}
|
||||
|
|
20
src/main.rs
20
src/main.rs
|
@ -193,23 +193,15 @@ fn is_not_hidden(entry: &DirEntry) -> bool {
|
|||
}
|
||||
|
||||
fn track_valid(track: &Path) -> bool {
|
||||
if let Ok(meta) = track.metadata() {
|
||||
if !meta.is_file() {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if !track.metadata().unwrap().is_file() {
|
||||
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
|
||||
// Skipping "images" (covers)
|
||||
if "jpgjpegpngwebp".contains(&track.extension().unwrap().to_str().unwrap().to_ascii_lowercase())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
async fn stream(mut s: TcpStream, tracklist: Arc<Vec<PathBuf>>, settings: Settings) {
|
||||
|
|
Loading…
Reference in a new issue