| 
					
				 | 
			
			
				@@ -6,6 +6,7 @@ extern crate librespot; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 extern crate tokio_core; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 extern crate tokio_io; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 extern crate tokio_signal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+extern crate crypto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use env_logger::LogBuilder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use futures::{Future, Async, Poll, Stream}; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -17,6 +18,8 @@ use std::str::FromStr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use tokio_core::reactor::{Handle, Core}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use tokio_io::IoStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use std::mem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use crypto::digest::Digest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use crypto::sha1::Sha1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use librespot::core::authentication::{get_credentials, Credentials}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use librespot::core::cache::Cache; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,6 +34,12 @@ use librespot::playback::mixer::{self, Mixer}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use librespot::playback::player::Player; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use librespot::connect::spirc::{Spirc, SpircTask}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+fn device_id(name: &str) -> String { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let mut h = Sha1::new(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    h.input_str(name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    h.result_str() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 fn usage(program: &str, opts: &getopts::Options) -> String { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let brief = format!("Usage: {} [options]", program); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     opts.usage(&brief) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -170,7 +179,7 @@ fn setup(args: &[String]) -> Setup { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let session_config = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let device_id = librespot::core::session::device_id(&name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let device_id = device_id(&name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SessionConfig { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             user_agent: version::version_string(), 
			 |