Ver código fonte

Move librespot into lib.rs and let main.rs be the test binary

Tor Arne Vestbø 9 anos atrás
pai
commit
cbd414853f
4 arquivos alterados com 56 adições e 25 exclusões
  1. 8 0
      Cargo.toml
  2. 1 1
      src/audio_file.rs
  3. 37 0
      src/lib.rs
  4. 10 24
      src/main.rs

+ 8 - 0
Cargo.toml

@@ -4,6 +4,14 @@ version = "0.1.0"
 authors = ["Paul Liétar <paul@lietar.net>"]
 build = "build.rs"
 
+[lib]
+name = "librespot"
+path = "src/lib.rs"
+
+[[bin]]
+name = "main"
+path = "src/main.rs"
+
 [dependencies.librespot-protocol]
 path = "protocol"
 

+ 1 - 1
src/audio_file.rs

@@ -20,7 +20,7 @@ pub enum AudioFile<'s> {
     Loading(AudioFileLoading<'s>)
 }
 
-struct AudioFileLoading<'s> {
+pub struct AudioFileLoading<'s> {
     read_file: TempFile,
 
     position: u64,

+ 37 - 0
src/lib.rs

@@ -0,0 +1,37 @@
+#![crate_name = "librespot"]
+
+#![feature(plugin,scoped,zero_one,iter_arith,slice_position_elem,slice_bytes,bitset,arc_weak,append,future)]
+#![allow(deprecated)]
+#![allow(unused_imports,dead_code)]
+
+#![plugin(protobuf_macros)]
+#[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;
+extern crate time;
+extern crate tempfile;
+
+extern crate librespot_protocol;
+
+#[macro_use] pub mod util;
+pub mod audio_decrypt;
+pub mod audio_file;
+pub mod audio_key;
+pub mod connection;
+pub mod keys;
+pub mod mercury;
+pub mod metadata;
+pub mod player;
+pub mod session;
+pub mod stream;
+pub mod subsystem;

+ 10 - 24
src/main.rs

@@ -1,6 +1,4 @@
-#![crate_name = "librespot"]
-
-#![feature(plugin,scoped,zero_one,iter_arith,slice_position_elem,slice_bytes,bitset,arc_weak,append,future)]
+#![feature(plugin,scoped)]
 #![allow(deprecated)]
 //#![allow(unused_imports,dead_code)]
 
@@ -18,23 +16,9 @@ extern crate shannon;
 extern crate rand;
 extern crate readall;
 extern crate vorbis;
-extern crate time;
-extern crate tempfile;
 
 extern crate librespot_protocol;
-
-#[macro_use] mod util;
-mod audio_decrypt;
-mod audio_file;
-mod audio_key;
-mod connection;
-mod keys;
-mod mercury;
-mod metadata;
-mod player;
-mod session;
-mod stream;
-mod subsystem;
+#[macro_use] extern crate librespot;
 
 use std::clone::Clone;
 use std::fs::File;
@@ -44,12 +28,14 @@ use protobuf::core::Message;
 use std::thread;
 use std::path::PathBuf;
 
-use metadata::{AlbumRef, ArtistRef, TrackRef};
-use session::{Config, Session};
-use util::SpotifyId;
-use util::version::version_string;
-use player::{Player, PlayerCommand};
-use mercury::{MercuryRequest, MercuryMethod};
+use librespot::util;
+use librespot::metadata::{AlbumRef, ArtistRef, TrackRef};
+use librespot::session::{Config, Session};
+use librespot::util::SpotifyId;
+use librespot::util::version::version_string;
+use librespot::player::{Player, PlayerCommand};
+use librespot::mercury::{MercuryRequest, MercuryMethod};
+
 use librespot_protocol as protocol;
 use librespot_protocol::spirc::PlayStatus;