mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
commit
b634117fbf
12 changed files with 11403 additions and 14 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -886,6 +886,7 @@ dependencies = [
|
|||
"librespot-core 0.1.0",
|
||||
"librespot-protocol 0.1.0",
|
||||
"linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
|
49
examples/playlist_tracks.rs
Normal file
49
examples/playlist_tracks.rs
Normal file
|
@ -0,0 +1,49 @@
|
|||
extern crate log;
|
||||
extern crate env_logger;
|
||||
|
||||
extern crate librespot;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio_io;
|
||||
extern crate futures;
|
||||
|
||||
use std::env;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
use librespot::core::authentication::Credentials;
|
||||
use librespot::core::config::SessionConfig;
|
||||
use librespot::core::session::Session;
|
||||
use librespot::core::spotify_id::SpotifyId;
|
||||
use librespot::metadata::{Metadata, Track, Playlist};
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
let mut core = Core::new().unwrap();
|
||||
let handle = core.handle();
|
||||
|
||||
let session_config = SessionConfig::default();
|
||||
|
||||
let args: Vec<_> = env::args().collect();
|
||||
if args.len() != 4 {
|
||||
println!("Usage: {} USERNAME PASSWORD PLAYLIST", args[0]);
|
||||
}
|
||||
let username = args[1].to_owned();
|
||||
let password = args[2].to_owned();
|
||||
let credentials = Credentials::with_password(username, password);
|
||||
|
||||
let uri_split = args[3].split(":");
|
||||
let uri_parts: Vec<&str> = uri_split.collect();
|
||||
println!("{}, {}, {}",uri_parts[0], uri_parts[1], uri_parts[2]);
|
||||
|
||||
let plist_uri = SpotifyId::from_base62(uri_parts[2]).unwrap();
|
||||
|
||||
let session = core
|
||||
.run(Session::connect(session_config, credentials, None, handle))
|
||||
.unwrap();
|
||||
|
||||
let plist = core.run(Playlist::get(&session, plist_uri)).unwrap();
|
||||
println!("{:?}",plist);
|
||||
for track_id in plist.tracks {
|
||||
let plist_track = core.run(Track::get(&session, track_id)).unwrap();
|
||||
println!("track: {} ", plist_track.name);
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ byteorder = "1.3"
|
|||
futures = "0.1"
|
||||
linear-map = "1.2"
|
||||
protobuf = "2.8.1"
|
||||
log = "0.4"
|
||||
|
||||
[dependencies.librespot-core]
|
||||
path = "../core"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
extern crate byteorder;
|
||||
extern crate futures;
|
||||
extern crate linear_map;
|
||||
|
@ -124,11 +127,11 @@ impl AudioFiles for Episode {
|
|||
pub trait Metadata: Send + Sized + 'static {
|
||||
type Message: protobuf::Message;
|
||||
|
||||
fn base_url() -> &'static str;
|
||||
fn request_url(id: SpotifyId) -> String;
|
||||
fn parse(msg: &Self::Message, session: &Session) -> Self;
|
||||
|
||||
fn get(session: &Session, id: SpotifyId) -> Box<dyn Future<Item = Self, Error = MercuryError>> {
|
||||
let uri = format!("{}/{}", Self::base_url(), id.to_base16());
|
||||
let uri = Self::request_url(id);
|
||||
let request = session.mercury().get(uri);
|
||||
|
||||
let session = session.clone();
|
||||
|
@ -185,6 +188,14 @@ pub struct Show {
|
|||
pub covers: Vec<FileId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Playlist {
|
||||
pub revision: Vec<u8>,
|
||||
pub user: String,
|
||||
pub name: String,
|
||||
pub tracks: Vec<SpotifyId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Artist {
|
||||
pub id: SpotifyId,
|
||||
|
@ -195,8 +206,8 @@ pub struct Artist {
|
|||
impl Metadata for Track {
|
||||
type Message = protocol::metadata::Track;
|
||||
|
||||
fn base_url() -> &'static str {
|
||||
"hm://metadata/3/track"
|
||||
fn request_url(id: SpotifyId) -> String {
|
||||
format!("hm://metadata/3/track/{}", id.to_base16())
|
||||
}
|
||||
|
||||
fn parse(msg: &Self::Message, session: &Session) -> Self {
|
||||
|
@ -240,8 +251,8 @@ impl Metadata for Track {
|
|||
impl Metadata for Album {
|
||||
type Message = protocol::metadata::Album;
|
||||
|
||||
fn base_url() -> &'static str {
|
||||
"hm://metadata/3/album"
|
||||
fn request_url(id: SpotifyId) -> String {
|
||||
format!("hm://metadata/3/album/{}", id.to_base16())
|
||||
}
|
||||
|
||||
fn parse(msg: &Self::Message, _: &Session) -> Self {
|
||||
|
@ -282,11 +293,44 @@ impl Metadata for Album {
|
|||
}
|
||||
}
|
||||
|
||||
impl Metadata for Playlist {
|
||||
type Message = protocol::playlist4changes::SelectedListContent;
|
||||
|
||||
fn request_url(id: SpotifyId) -> String {
|
||||
format!("hm://playlist/v2/playlist/{}", id.to_base62())
|
||||
}
|
||||
|
||||
fn parse(msg: &Self::Message, _: &Session) -> Self {
|
||||
|
||||
let tracks = msg
|
||||
.get_contents()
|
||||
.get_items()
|
||||
.iter()
|
||||
.map(|item| {
|
||||
let uri_split = item.get_uri().split(":");
|
||||
let uri_parts: Vec<&str> = uri_split.collect();
|
||||
SpotifyId::from_base62(uri_parts[2]).unwrap()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if tracks.len() != msg.get_length() as usize {
|
||||
warn!("Got {} tracks, but the playlist should contain {} tracks.", tracks.len(), msg.get_length());
|
||||
}
|
||||
|
||||
Playlist {
|
||||
revision: msg.get_revision().to_vec(),
|
||||
name: msg.get_attributes().get_name().to_owned(),
|
||||
tracks: tracks,
|
||||
user: msg.get_owner_username().to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Metadata for Artist {
|
||||
type Message = protocol::metadata::Artist;
|
||||
|
||||
fn base_url() -> &'static str {
|
||||
"hm://metadata/3/artist"
|
||||
fn request_url(id: SpotifyId) -> String {
|
||||
format!("hm://metadata/3/artist/{}", id.to_base16())
|
||||
}
|
||||
|
||||
fn parse(msg: &Self::Message, session: &Session) -> Self {
|
||||
|
@ -318,8 +362,8 @@ impl Metadata for Artist {
|
|||
impl Metadata for Episode {
|
||||
type Message = protocol::metadata::Episode;
|
||||
|
||||
fn base_url() -> &'static str {
|
||||
"hm://metadata/3/episode"
|
||||
fn request_url(id: SpotifyId) -> String {
|
||||
format!("hm://metadata/3/episode/{}", id.to_base16())
|
||||
}
|
||||
|
||||
fn parse(msg: &Self::Message, session: &Session) -> Self {
|
||||
|
@ -366,8 +410,8 @@ impl Metadata for Episode {
|
|||
impl Metadata for Show {
|
||||
type Message = protocol::metadata::Show;
|
||||
|
||||
fn base_url() -> &'static str {
|
||||
"hm://metadata/3/show"
|
||||
fn request_url(id: SpotifyId) -> String {
|
||||
format!("hm://metadata/3/show/{}", id.to_base16())
|
||||
}
|
||||
|
||||
fn parse(msg: &Self::Message, _: &Session) -> Self {
|
||||
|
|
|
@ -14,11 +14,18 @@ fn main() {
|
|||
|
||||
// Iterate over the desired module names.
|
||||
for line in lib_str.lines() {
|
||||
if !line.starts_with("pub mod ") {
|
||||
if !line.starts_with("pub mod ") && !line.starts_with("mod ") {
|
||||
continue;
|
||||
}
|
||||
let len = line.len();
|
||||
let name = &line[8..len-1]; // Remove keywords and semi-colon
|
||||
|
||||
let name;
|
||||
if line.starts_with("pub mod ") {
|
||||
name = &line[8..len-1]; // Remove keywords and semi-colon
|
||||
}
|
||||
else {
|
||||
name = &line[4..len-1]; // Remove keywords and semi-colon
|
||||
}
|
||||
|
||||
// Build the paths to relevant files.
|
||||
let src = &format!("proto/{}.proto", name);
|
||||
|
|
|
@ -82,5 +82,6 @@ message SelectedListContent {
|
|||
repeated ClientResolveAction resolveAction = 0xc;
|
||||
repeated ClientIssue issues = 0xd;
|
||||
repeated int32 nonces = 0xe;
|
||||
optional string owner_username =0x10;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,5 +5,10 @@ pub mod authentication;
|
|||
pub mod keyexchange;
|
||||
pub mod mercury;
|
||||
pub mod metadata;
|
||||
pub mod playlist4changes;
|
||||
mod playlist4content;
|
||||
mod playlist4issues;
|
||||
mod playlist4meta;
|
||||
mod playlist4ops;
|
||||
pub mod pubsub;
|
||||
pub mod spirc;
|
||||
|
|
3618
protocol/src/playlist4changes.rs
Normal file
3618
protocol/src/playlist4changes.rs
Normal file
File diff suppressed because it is too large
Load diff
1457
protocol/src/playlist4content.rs
Normal file
1457
protocol/src/playlist4content.rs
Normal file
File diff suppressed because it is too large
Load diff
761
protocol/src/playlist4issues.rs
Normal file
761
protocol/src/playlist4issues.rs
Normal file
|
@ -0,0 +1,761 @@
|
|||
// This file is generated by rust-protobuf 2.8.1. Do not edit
|
||||
// @generated
|
||||
|
||||
// https://github.com/Manishearth/rust-clippy/issues/702
|
||||
#![allow(unknown_lints)]
|
||||
#![allow(clippy::all)]
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
|
||||
#![allow(box_pointers)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(missing_docs)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(unsafe_code)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_results)]
|
||||
//! Generated file from `playlist4issues.proto`
|
||||
|
||||
use protobuf::Message as Message_imported_for_functions;
|
||||
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
|
||||
|
||||
/// Generated files are compatible only with the same version
|
||||
/// of protobuf runtime.
|
||||
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
|
||||
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct ClientIssue {
|
||||
// message fields
|
||||
level: ::std::option::Option<ClientIssue_Level>,
|
||||
code: ::std::option::Option<ClientIssue_Code>,
|
||||
repeatCount: ::std::option::Option<i32>,
|
||||
// special fields
|
||||
pub unknown_fields: ::protobuf::UnknownFields,
|
||||
pub cached_size: ::protobuf::CachedSize,
|
||||
}
|
||||
|
||||
impl<'a> ::std::default::Default for &'a ClientIssue {
|
||||
fn default() -> &'a ClientIssue {
|
||||
<ClientIssue as ::protobuf::Message>::default_instance()
|
||||
}
|
||||
}
|
||||
|
||||
impl ClientIssue {
|
||||
pub fn new() -> ClientIssue {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// optional .ClientIssue.Level level = 1;
|
||||
|
||||
|
||||
pub fn get_level(&self) -> ClientIssue_Level {
|
||||
self.level.unwrap_or(ClientIssue_Level::LEVEL_UNKNOWN)
|
||||
}
|
||||
pub fn clear_level(&mut self) {
|
||||
self.level = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_level(&self) -> bool {
|
||||
self.level.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_level(&mut self, v: ClientIssue_Level) {
|
||||
self.level = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
// optional .ClientIssue.Code code = 2;
|
||||
|
||||
|
||||
pub fn get_code(&self) -> ClientIssue_Code {
|
||||
self.code.unwrap_or(ClientIssue_Code::CODE_UNKNOWN)
|
||||
}
|
||||
pub fn clear_code(&mut self) {
|
||||
self.code = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_code(&self) -> bool {
|
||||
self.code.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_code(&mut self, v: ClientIssue_Code) {
|
||||
self.code = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
// optional int32 repeatCount = 3;
|
||||
|
||||
|
||||
pub fn get_repeatCount(&self) -> i32 {
|
||||
self.repeatCount.unwrap_or(0)
|
||||
}
|
||||
pub fn clear_repeatCount(&mut self) {
|
||||
self.repeatCount = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_repeatCount(&self) -> bool {
|
||||
self.repeatCount.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_repeatCount(&mut self, v: i32) {
|
||||
self.repeatCount = ::std::option::Option::Some(v);
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Message for ClientIssue {
|
||||
fn is_initialized(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||
while !is.eof()? {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.level, 1, &mut self.unknown_fields)?
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.code, 2, &mut self.unknown_fields)?
|
||||
},
|
||||
3 => {
|
||||
if wire_type != ::protobuf::wire_format::WireTypeVarint {
|
||||
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
|
||||
}
|
||||
let tmp = is.read_int32()?;
|
||||
self.repeatCount = ::std::option::Option::Some(tmp);
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if let Some(v) = self.level {
|
||||
my_size += ::protobuf::rt::enum_size(1, v);
|
||||
}
|
||||
if let Some(v) = self.code {
|
||||
my_size += ::protobuf::rt::enum_size(2, v);
|
||||
}
|
||||
if let Some(v) = self.repeatCount {
|
||||
my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||
if let Some(v) = self.level {
|
||||
os.write_enum(1, v.value())?;
|
||||
}
|
||||
if let Some(v) = self.code {
|
||||
os.write_enum(2, v.value())?;
|
||||
}
|
||||
if let Some(v) = self.repeatCount {
|
||||
os.write_int32(3, v)?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn get_cached_size(&self) -> u32 {
|
||||
self.cached_size.get()
|
||||
}
|
||||
|
||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||
&self.unknown_fields
|
||||
}
|
||||
|
||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||
&mut self.unknown_fields
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||
self as &dyn (::std::any::Any)
|
||||
}
|
||||
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||
self as &mut dyn (::std::any::Any)
|
||||
}
|
||||
fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||
self
|
||||
}
|
||||
|
||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
Self::descriptor_static()
|
||||
}
|
||||
|
||||
fn new() -> ClientIssue {
|
||||
ClientIssue::new()
|
||||
}
|
||||
|
||||
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<ClientIssue_Level>>(
|
||||
"level",
|
||||
|m: &ClientIssue| { &m.level },
|
||||
|m: &mut ClientIssue| { &mut m.level },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<ClientIssue_Code>>(
|
||||
"code",
|
||||
|m: &ClientIssue| { &m.code },
|
||||
|m: &mut ClientIssue| { &mut m.code },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
|
||||
"repeatCount",
|
||||
|m: &ClientIssue| { &m.repeatCount },
|
||||
|m: &mut ClientIssue| { &mut m.repeatCount },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new::<ClientIssue>(
|
||||
"ClientIssue",
|
||||
fields,
|
||||
file_descriptor_proto()
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static ClientIssue {
|
||||
static mut instance: ::protobuf::lazy::Lazy<ClientIssue> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ClientIssue,
|
||||
};
|
||||
unsafe {
|
||||
instance.get(ClientIssue::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Clear for ClientIssue {
|
||||
fn clear(&mut self) {
|
||||
self.level = ::std::option::Option::None;
|
||||
self.code = ::std::option::Option::None;
|
||||
self.repeatCount = ::std::option::Option::None;
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for ClientIssue {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for ClientIssue {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Message(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||
pub enum ClientIssue_Level {
|
||||
LEVEL_UNKNOWN = 0,
|
||||
LEVEL_DEBUG = 1,
|
||||
LEVEL_INFO = 2,
|
||||
LEVEL_NOTICE = 3,
|
||||
LEVEL_WARNING = 4,
|
||||
LEVEL_ERROR = 5,
|
||||
}
|
||||
|
||||
impl ::protobuf::ProtobufEnum for ClientIssue_Level {
|
||||
fn value(&self) -> i32 {
|
||||
*self as i32
|
||||
}
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<ClientIssue_Level> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_UNKNOWN),
|
||||
1 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_DEBUG),
|
||||
2 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_INFO),
|
||||
3 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_NOTICE),
|
||||
4 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_WARNING),
|
||||
5 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_ERROR),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn values() -> &'static [Self] {
|
||||
static values: &'static [ClientIssue_Level] = &[
|
||||
ClientIssue_Level::LEVEL_UNKNOWN,
|
||||
ClientIssue_Level::LEVEL_DEBUG,
|
||||
ClientIssue_Level::LEVEL_INFO,
|
||||
ClientIssue_Level::LEVEL_NOTICE,
|
||||
ClientIssue_Level::LEVEL_WARNING,
|
||||
ClientIssue_Level::LEVEL_ERROR,
|
||||
];
|
||||
values
|
||||
}
|
||||
|
||||
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
|
||||
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::reflect::EnumDescriptor,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
::protobuf::reflect::EnumDescriptor::new("ClientIssue_Level", file_descriptor_proto())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::marker::Copy for ClientIssue_Level {
|
||||
}
|
||||
|
||||
impl ::std::default::Default for ClientIssue_Level {
|
||||
fn default() -> Self {
|
||||
ClientIssue_Level::LEVEL_UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for ClientIssue_Level {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||
pub enum ClientIssue_Code {
|
||||
CODE_UNKNOWN = 0,
|
||||
CODE_INDEX_OUT_OF_BOUNDS = 1,
|
||||
CODE_VERSION_MISMATCH = 2,
|
||||
CODE_CACHED_CHANGE = 3,
|
||||
CODE_OFFLINE_CHANGE = 4,
|
||||
CODE_CONCURRENT_CHANGE = 5,
|
||||
}
|
||||
|
||||
impl ::protobuf::ProtobufEnum for ClientIssue_Code {
|
||||
fn value(&self) -> i32 {
|
||||
*self as i32
|
||||
}
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<ClientIssue_Code> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(ClientIssue_Code::CODE_UNKNOWN),
|
||||
1 => ::std::option::Option::Some(ClientIssue_Code::CODE_INDEX_OUT_OF_BOUNDS),
|
||||
2 => ::std::option::Option::Some(ClientIssue_Code::CODE_VERSION_MISMATCH),
|
||||
3 => ::std::option::Option::Some(ClientIssue_Code::CODE_CACHED_CHANGE),
|
||||
4 => ::std::option::Option::Some(ClientIssue_Code::CODE_OFFLINE_CHANGE),
|
||||
5 => ::std::option::Option::Some(ClientIssue_Code::CODE_CONCURRENT_CHANGE),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn values() -> &'static [Self] {
|
||||
static values: &'static [ClientIssue_Code] = &[
|
||||
ClientIssue_Code::CODE_UNKNOWN,
|
||||
ClientIssue_Code::CODE_INDEX_OUT_OF_BOUNDS,
|
||||
ClientIssue_Code::CODE_VERSION_MISMATCH,
|
||||
ClientIssue_Code::CODE_CACHED_CHANGE,
|
||||
ClientIssue_Code::CODE_OFFLINE_CHANGE,
|
||||
ClientIssue_Code::CODE_CONCURRENT_CHANGE,
|
||||
];
|
||||
values
|
||||
}
|
||||
|
||||
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
|
||||
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::reflect::EnumDescriptor,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
::protobuf::reflect::EnumDescriptor::new("ClientIssue_Code", file_descriptor_proto())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::marker::Copy for ClientIssue_Code {
|
||||
}
|
||||
|
||||
impl ::std::default::Default for ClientIssue_Code {
|
||||
fn default() -> Self {
|
||||
ClientIssue_Code::CODE_UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for ClientIssue_Code {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct ClientResolveAction {
|
||||
// message fields
|
||||
code: ::std::option::Option<ClientResolveAction_Code>,
|
||||
initiator: ::std::option::Option<ClientResolveAction_Initiator>,
|
||||
// special fields
|
||||
pub unknown_fields: ::protobuf::UnknownFields,
|
||||
pub cached_size: ::protobuf::CachedSize,
|
||||
}
|
||||
|
||||
impl<'a> ::std::default::Default for &'a ClientResolveAction {
|
||||
fn default() -> &'a ClientResolveAction {
|
||||
<ClientResolveAction as ::protobuf::Message>::default_instance()
|
||||
}
|
||||
}
|
||||
|
||||
impl ClientResolveAction {
|
||||
pub fn new() -> ClientResolveAction {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// optional .ClientResolveAction.Code code = 1;
|
||||
|
||||
|
||||
pub fn get_code(&self) -> ClientResolveAction_Code {
|
||||
self.code.unwrap_or(ClientResolveAction_Code::CODE_UNKNOWN)
|
||||
}
|
||||
pub fn clear_code(&mut self) {
|
||||
self.code = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_code(&self) -> bool {
|
||||
self.code.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_code(&mut self, v: ClientResolveAction_Code) {
|
||||
self.code = ::std::option::Option::Some(v);
|
||||
}
|
||||
|
||||
// optional .ClientResolveAction.Initiator initiator = 2;
|
||||
|
||||
|
||||
pub fn get_initiator(&self) -> ClientResolveAction_Initiator {
|
||||
self.initiator.unwrap_or(ClientResolveAction_Initiator::INITIATOR_UNKNOWN)
|
||||
}
|
||||
pub fn clear_initiator(&mut self) {
|
||||
self.initiator = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_initiator(&self) -> bool {
|
||||
self.initiator.is_some()
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_initiator(&mut self, v: ClientResolveAction_Initiator) {
|
||||
self.initiator = ::std::option::Option::Some(v);
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Message for ClientResolveAction {
|
||||
fn is_initialized(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||
while !is.eof()? {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.code, 1, &mut self.unknown_fields)?
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.initiator, 2, &mut self.unknown_fields)?
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
};
|
||||
}
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
// Compute sizes of nested messages
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if let Some(v) = self.code {
|
||||
my_size += ::protobuf::rt::enum_size(1, v);
|
||||
}
|
||||
if let Some(v) = self.initiator {
|
||||
my_size += ::protobuf::rt::enum_size(2, v);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
my_size
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||
if let Some(v) = self.code {
|
||||
os.write_enum(1, v.value())?;
|
||||
}
|
||||
if let Some(v) = self.initiator {
|
||||
os.write_enum(2, v.value())?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
}
|
||||
|
||||
fn get_cached_size(&self) -> u32 {
|
||||
self.cached_size.get()
|
||||
}
|
||||
|
||||
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
|
||||
&self.unknown_fields
|
||||
}
|
||||
|
||||
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
|
||||
&mut self.unknown_fields
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn (::std::any::Any) {
|
||||
self as &dyn (::std::any::Any)
|
||||
}
|
||||
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
|
||||
self as &mut dyn (::std::any::Any)
|
||||
}
|
||||
fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
|
||||
self
|
||||
}
|
||||
|
||||
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
Self::descriptor_static()
|
||||
}
|
||||
|
||||
fn new() -> ClientResolveAction {
|
||||
ClientResolveAction::new()
|
||||
}
|
||||
|
||||
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
|
||||
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<ClientResolveAction_Code>>(
|
||||
"code",
|
||||
|m: &ClientResolveAction| { &m.code },
|
||||
|m: &mut ClientResolveAction| { &mut m.code },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<ClientResolveAction_Initiator>>(
|
||||
"initiator",
|
||||
|m: &ClientResolveAction| { &m.initiator },
|
||||
|m: &mut ClientResolveAction| { &mut m.initiator },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new::<ClientResolveAction>(
|
||||
"ClientResolveAction",
|
||||
fields,
|
||||
file_descriptor_proto()
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> &'static ClientResolveAction {
|
||||
static mut instance: ::protobuf::lazy::Lazy<ClientResolveAction> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ClientResolveAction,
|
||||
};
|
||||
unsafe {
|
||||
instance.get(ClientResolveAction::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Clear for ClientResolveAction {
|
||||
fn clear(&mut self) {
|
||||
self.code = ::std::option::Option::None;
|
||||
self.initiator = ::std::option::Option::None;
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Debug for ClientResolveAction {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
::protobuf::text_format::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for ClientResolveAction {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Message(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||
pub enum ClientResolveAction_Code {
|
||||
CODE_UNKNOWN = 0,
|
||||
CODE_NO_ACTION = 1,
|
||||
CODE_RETRY = 2,
|
||||
CODE_RELOAD = 3,
|
||||
CODE_DISCARD_LOCAL_CHANGES = 4,
|
||||
CODE_SEND_DUMP = 5,
|
||||
CODE_DISPLAY_ERROR_MESSAGE = 6,
|
||||
}
|
||||
|
||||
impl ::protobuf::ProtobufEnum for ClientResolveAction_Code {
|
||||
fn value(&self) -> i32 {
|
||||
*self as i32
|
||||
}
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<ClientResolveAction_Code> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_UNKNOWN),
|
||||
1 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_NO_ACTION),
|
||||
2 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_RETRY),
|
||||
3 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_RELOAD),
|
||||
4 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_DISCARD_LOCAL_CHANGES),
|
||||
5 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_SEND_DUMP),
|
||||
6 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_DISPLAY_ERROR_MESSAGE),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn values() -> &'static [Self] {
|
||||
static values: &'static [ClientResolveAction_Code] = &[
|
||||
ClientResolveAction_Code::CODE_UNKNOWN,
|
||||
ClientResolveAction_Code::CODE_NO_ACTION,
|
||||
ClientResolveAction_Code::CODE_RETRY,
|
||||
ClientResolveAction_Code::CODE_RELOAD,
|
||||
ClientResolveAction_Code::CODE_DISCARD_LOCAL_CHANGES,
|
||||
ClientResolveAction_Code::CODE_SEND_DUMP,
|
||||
ClientResolveAction_Code::CODE_DISPLAY_ERROR_MESSAGE,
|
||||
];
|
||||
values
|
||||
}
|
||||
|
||||
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
|
||||
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::reflect::EnumDescriptor,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
::protobuf::reflect::EnumDescriptor::new("ClientResolveAction_Code", file_descriptor_proto())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::marker::Copy for ClientResolveAction_Code {
|
||||
}
|
||||
|
||||
impl ::std::default::Default for ClientResolveAction_Code {
|
||||
fn default() -> Self {
|
||||
ClientResolveAction_Code::CODE_UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for ClientResolveAction_Code {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||
pub enum ClientResolveAction_Initiator {
|
||||
INITIATOR_UNKNOWN = 0,
|
||||
INITIATOR_SERVER = 1,
|
||||
INITIATOR_CLIENT = 2,
|
||||
}
|
||||
|
||||
impl ::protobuf::ProtobufEnum for ClientResolveAction_Initiator {
|
||||
fn value(&self) -> i32 {
|
||||
*self as i32
|
||||
}
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<ClientResolveAction_Initiator> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(ClientResolveAction_Initiator::INITIATOR_UNKNOWN),
|
||||
1 => ::std::option::Option::Some(ClientResolveAction_Initiator::INITIATOR_SERVER),
|
||||
2 => ::std::option::Option::Some(ClientResolveAction_Initiator::INITIATOR_CLIENT),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn values() -> &'static [Self] {
|
||||
static values: &'static [ClientResolveAction_Initiator] = &[
|
||||
ClientResolveAction_Initiator::INITIATOR_UNKNOWN,
|
||||
ClientResolveAction_Initiator::INITIATOR_SERVER,
|
||||
ClientResolveAction_Initiator::INITIATOR_CLIENT,
|
||||
];
|
||||
values
|
||||
}
|
||||
|
||||
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
|
||||
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::reflect::EnumDescriptor,
|
||||
};
|
||||
unsafe {
|
||||
descriptor.get(|| {
|
||||
::protobuf::reflect::EnumDescriptor::new("ClientResolveAction_Initiator", file_descriptor_proto())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::marker::Copy for ClientResolveAction_Initiator {
|
||||
}
|
||||
|
||||
impl ::std::default::Default for ClientResolveAction_Initiator {
|
||||
fn default() -> Self {
|
||||
ClientResolveAction_Initiator::INITIATOR_UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::reflect::ProtobufValue for ClientResolveAction_Initiator {
|
||||
fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
|
||||
::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
|
||||
}
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\x15playlist4issues.proto\x12\0\"\x86\x03\n\x0bClientIssue\x12#\n\x05l\
|
||||
evel\x18\x01\x20\x01(\x0e2\x12.ClientIssue.LevelB\0\x12!\n\x04code\x18\
|
||||
\x02\x20\x01(\x0e2\x11.ClientIssue.CodeB\0\x12\x15\n\x0brepeatCount\x18\
|
||||
\x03\x20\x01(\x05B\0\"s\n\x05Level\x12\x11\n\rLEVEL_UNKNOWN\x10\0\x12\
|
||||
\x0f\n\x0bLEVEL_DEBUG\x10\x01\x12\x0e\n\nLEVEL_INFO\x10\x02\x12\x10\n\
|
||||
\x0cLEVEL_NOTICE\x10\x03\x12\x11\n\rLEVEL_WARNING\x10\x04\x12\x0f\n\x0bL\
|
||||
EVEL_ERROR\x10\x05\x1a\0\"\xa0\x01\n\x04Code\x12\x10\n\x0cCODE_UNKNOWN\
|
||||
\x10\0\x12\x1c\n\x18CODE_INDEX_OUT_OF_BOUNDS\x10\x01\x12\x19\n\x15CODE_V\
|
||||
ERSION_MISMATCH\x10\x02\x12\x16\n\x12CODE_CACHED_CHANGE\x10\x03\x12\x17\
|
||||
\n\x13CODE_OFFLINE_CHANGE\x10\x04\x12\x1a\n\x16CODE_CONCURRENT_CHANGE\
|
||||
\x10\x05\x1a\0:\0\"\xef\x02\n\x13ClientResolveAction\x12)\n\x04code\x18\
|
||||
\x01\x20\x01(\x0e2\x19.ClientResolveAction.CodeB\0\x123\n\tinitiator\x18\
|
||||
\x02\x20\x01(\x0e2\x1e.ClientResolveAction.InitiatorB\0\"\xa3\x01\n\x04C\
|
||||
ode\x12\x10\n\x0cCODE_UNKNOWN\x10\0\x12\x12\n\x0eCODE_NO_ACTION\x10\x01\
|
||||
\x12\x0e\n\nCODE_RETRY\x10\x02\x12\x0f\n\x0bCODE_RELOAD\x10\x03\x12\x1e\
|
||||
\n\x1aCODE_DISCARD_LOCAL_CHANGES\x10\x04\x12\x12\n\x0eCODE_SEND_DUMP\x10\
|
||||
\x05\x12\x1e\n\x1aCODE_DISPLAY_ERROR_MESSAGE\x10\x06\x1a\0\"P\n\tInitiat\
|
||||
or\x12\x15\n\x11INITIATOR_UNKNOWN\x10\0\x12\x14\n\x10INITIATOR_SERVER\
|
||||
\x10\x01\x12\x14\n\x10INITIATOR_CLIENT\x10\x02\x1a\0:\0B\0b\x06proto2\
|
||||
";
|
||||
|
||||
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
|
||||
lock: ::protobuf::lazy::ONCE_INIT,
|
||||
ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
|
||||
};
|
||||
|
||||
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
|
||||
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
|
||||
}
|
||||
|
||||
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
|
||||
unsafe {
|
||||
file_descriptor_proto_lazy.get(|| {
|
||||
parse_descriptor_proto()
|
||||
})
|
||||
}
|
||||
}
|
2074
protocol/src/playlist4meta.rs
Normal file
2074
protocol/src/playlist4meta.rs
Normal file
File diff suppressed because it is too large
Load diff
3371
protocol/src/playlist4ops.rs
Normal file
3371
protocol/src/playlist4ops.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue