mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-04 18:29:45 +02:00
Only use syntex on modules that need it.
Also updated dependencies. Fixes #133 and #138
This commit is contained in:
parent
7fd8503f45
commit
8544faf75d
6 changed files with 399 additions and 430 deletions
16
src/main.rs
16
src/main.rs
|
@ -3,7 +3,7 @@ extern crate librespot;
|
|||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate simple_signal;
|
||||
extern crate ctrlc;
|
||||
|
||||
use std::process::exit;
|
||||
use std::thread;
|
||||
|
@ -12,8 +12,6 @@ use std::env;
|
|||
use librespot::spirc::SpircManager;
|
||||
use librespot::main_helper;
|
||||
|
||||
use simple_signal::{Signal, Signals};
|
||||
|
||||
fn usage(program: &str, opts: &getopts::Options) -> String {
|
||||
let brief = format!("Usage: {} [options]", program);
|
||||
format!("{}", opts.usage(&brief))
|
||||
|
@ -50,13 +48,11 @@ fn main() {
|
|||
let spirc = SpircManager::new(session.clone(), player);
|
||||
let spirc_signal = spirc.clone();
|
||||
thread::spawn(move || spirc.run());
|
||||
Signals::set_handler(&[Signal::Int, Signal::Term],
|
||||
move |signals| {
|
||||
println!("Signal received: {:?}. Say goodbye and exit.", signals);
|
||||
spirc_signal.send_goodbye();
|
||||
exit(0);
|
||||
}
|
||||
);
|
||||
|
||||
ctrlc::set_handler(move || {
|
||||
spirc_signal.send_goodbye();
|
||||
exit(0);
|
||||
});
|
||||
|
||||
loop {
|
||||
session.poll();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue