main.rs 986 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #![crate_name = "librespot"]
  2. #![feature(plugin)]
  3. #![plugin(protobuf_macros)]
  4. #[macro_use] extern crate lazy_static;
  5. extern crate byteorder;
  6. extern crate crypto;
  7. extern crate gmp;
  8. extern crate num;
  9. extern crate protobuf;
  10. extern crate shannon;
  11. extern crate rand;
  12. extern crate readall;
  13. extern crate librespot_protocol;
  14. mod connection;
  15. mod keys;
  16. mod session;
  17. mod util;
  18. use std::fs::File;
  19. use std::io::Read;
  20. use std::path::Path;
  21. use session::{Session,Config};
  22. fn main() {
  23. let mut args = std::env::args().skip(1);
  24. let mut appkey_file = File::open(Path::new(&args.next().unwrap())).unwrap();
  25. let username = args.next().unwrap();
  26. let password = args.next().unwrap();
  27. let mut appkey = Vec::new();
  28. appkey_file.read_to_end(&mut appkey).unwrap();
  29. let config = Config {
  30. application_key: appkey,
  31. user_agent: "ABC".to_string(),
  32. device_id: "ABC".to_string()
  33. };
  34. let mut s = Session::new(config);
  35. s.login(username, password);
  36. }