cover.rs 585 B

12345678910111213141516171819
  1. use byteorder::{BigEndian, WriteBytesExt};
  2. use std::io::Write;
  3. use librespot_core::channel::ChannelData;
  4. use librespot_core::session::Session;
  5. use librespot_core::spotify_id::FileId;
  6. pub fn get(session: &Session, file: FileId) -> ChannelData {
  7. let (channel_id, channel) = session.channel().allocate();
  8. let (_headers, data) = channel.split();
  9. let mut packet: Vec<u8> = Vec::new();
  10. packet.write_u16::<BigEndian>(channel_id).unwrap();
  11. packet.write_u16::<BigEndian>(0).unwrap();
  12. packet.write(&file.0).unwrap();
  13. session.send_packet(0x19, packet);
  14. data
  15. }