Clean up main.rs

This commit is contained in:
Paul Lietar 2015-07-09 20:08:56 +01:00
parent 0b6351df8d
commit cdd939e88e

View file

@ -1,34 +1,16 @@
#![feature(plugin,scoped)] #![feature(scoped)]
#![allow(deprecated)] #![allow(deprecated)]
//#![allow(unused_imports,dead_code)]
#![plugin(protobuf_macros)] extern crate librespot;
#[macro_use] extern crate lazy_static;
extern crate byteorder;
extern crate crypto;
extern crate gmp;
extern crate num;
extern crate portaudio;
extern crate protobuf;
extern crate shannon;
extern crate rand;
extern crate readall;
extern crate vorbis;
#[macro_use] extern crate librespot;
use std::clone::Clone; use std::clone::Clone;
use std::fs::File; use std::fs::File;
use std::io::{Read, Write}; use std::io::Read;
use std::path::Path; use std::path::Path;
use std::thread; use std::thread;
use std::path::PathBuf; use std::path::PathBuf;
use librespot::metadata::{AlbumRef, ArtistRef, TrackRef};
use librespot::session::{Config, Session}; use librespot::session::{Config, Session};
use librespot::util::SpotifyId;
use librespot::util::version::version_string; use librespot::util::version::version_string;
use librespot::player::Player; use librespot::player::Player;
use librespot::spirc::SpircManager; use librespot::spirc::SpircManager;
@ -68,28 +50,3 @@ fn main() {
poll_thread.join(); poll_thread.join();
} }
fn print_track(session: &Session, track_id: SpotifyId) {
let track : TrackRef = session.metadata(track_id);
let album : AlbumRef = {
let handle = track.wait();
let data = handle.unwrap();
eprintln!("{}", data.name);
session.metadata(data.album)
};
let artists : Vec<ArtistRef> = {
let handle = album.wait();
let data = handle.unwrap();
eprintln!("{}", data.name);
data.artists.iter().map(|id| {
session.metadata(*id)
}).collect()
};
for artist in artists {
let handle = artist.wait();
let data = handle.unwrap();
eprintln!("{}", data.name);
}
}