1232b76fff
The API returns download.state='completed' but convert_album only
matched 'downloaded', causing monitored+downloaded albums to display
as Wanted with 0 tracks. Also prefer download.format ('FLAC') over
download.quality (empty) for the quality display.
422 lines
15 KiB
Rust
422 lines
15 KiB
Rust
// This file is @generated by prost-build.
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct MonitorAlbumRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub album_id: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub indexer_options: ::core::option::Option<IndexerOptions>,
|
|
#[prost(enumeration = "QualityType", tag = "3")]
|
|
pub quality: i32,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct IndexerOptions {
|
|
#[prost(string, tag = "1")]
|
|
pub tracker: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct MonitorAlbumResponse {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub album: ::core::option::Option<AlbumDetail>,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub artist: ::core::option::Option<ArtistSummary>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub release: ::core::option::Option<MonitoredRelease>,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct GetArtistsRequest {}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetArtistsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub artists: ::prost::alloc::vec::Vec<ArtistSummary>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ArtistSummary {
|
|
#[prost(string, tag = "1")]
|
|
pub id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub external_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub artist_type: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "5")]
|
|
pub country: ::prost::alloc::string::String,
|
|
#[prost(string, repeated, tag = "6")]
|
|
pub genres: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
|
#[prost(string, tag = "7")]
|
|
pub image_url: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "MonitorState", tag = "8")]
|
|
pub monitor_state: i32,
|
|
#[prost(message, repeated, tag = "9")]
|
|
pub albums: ::prost::alloc::vec::Vec<AlbumDetail>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct AlbumDetail {
|
|
#[prost(string, tag = "1")]
|
|
pub id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub external_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub title: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub album_type: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "5")]
|
|
pub release_date: ::prost::alloc::string::String,
|
|
#[prost(int32, tag = "6")]
|
|
pub total_tracks: i32,
|
|
#[prost(int32, tag = "7")]
|
|
pub total_discs: i32,
|
|
#[prost(string, tag = "8")]
|
|
pub cover_url: ::prost::alloc::string::String,
|
|
#[prost(string, repeated, tag = "9")]
|
|
pub genres: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
|
#[prost(string, tag = "10")]
|
|
pub label: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "MonitorState", tag = "11")]
|
|
pub monitor_state: i32,
|
|
#[prost(message, optional, tag = "12")]
|
|
pub download: ::core::option::Option<DownloadInfo>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct DownloadInfo {
|
|
#[prost(string, tag = "1")]
|
|
pub state: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub format: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub quality: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub save_path: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetAlbumRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub album_id: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetAlbumResponse {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub album: ::core::option::Option<AlbumDetail>,
|
|
#[prost(message, repeated, tag = "2")]
|
|
pub tracks: ::prost::alloc::vec::Vec<TrackDetail>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct TrackDetail {
|
|
#[prost(string, tag = "1")]
|
|
pub id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub external_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub title: ::prost::alloc::string::String,
|
|
#[prost(int32, tag = "4")]
|
|
pub duration_ms: i32,
|
|
#[prost(int32, tag = "5")]
|
|
pub disc_number: i32,
|
|
#[prost(int32, tag = "6")]
|
|
pub track_number: i32,
|
|
#[prost(string, tag = "7")]
|
|
pub isrc: ::prost::alloc::string::String,
|
|
#[prost(bool, tag = "8")]
|
|
pub explicit: bool,
|
|
#[prost(message, repeated, tag = "9")]
|
|
pub artists: ::prost::alloc::vec::Vec<ArtistCredit>,
|
|
#[prost(message, optional, tag = "10")]
|
|
pub file: ::core::option::Option<TrackFile>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ArtistCredit {
|
|
#[prost(string, tag = "1")]
|
|
pub id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub name: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct TrackFile {
|
|
#[prost(string, tag = "1")]
|
|
pub path: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub format: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "3")]
|
|
pub size: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct MonitoredRelease {
|
|
#[prost(string, tag = "1")]
|
|
pub info_hash: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub artist: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub album: ::prost::alloc::string::String,
|
|
#[prost(int32, tag = "4")]
|
|
pub year: i32,
|
|
#[prost(string, tag = "5")]
|
|
pub format: ::prost::alloc::string::String,
|
|
#[prost(bool, tag = "6")]
|
|
pub lossless: bool,
|
|
#[prost(int32, tag = "7")]
|
|
pub bit_depth: i32,
|
|
#[prost(int32, tag = "8")]
|
|
pub sample_rate: i32,
|
|
#[prost(string, tag = "9")]
|
|
pub source: ::prost::alloc::string::String,
|
|
#[prost(int32, tag = "10")]
|
|
pub track_count: i32,
|
|
#[prost(string, repeated, tag = "11")]
|
|
pub track_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
|
#[prost(bool, tag = "12")]
|
|
pub has_cover_art: bool,
|
|
#[prost(bool, tag = "13")]
|
|
pub has_cue_sheet: bool,
|
|
#[prost(bool, tag = "14")]
|
|
pub has_rip_log: bool,
|
|
#[prost(int64, tag = "15")]
|
|
pub total_audio_size: i64,
|
|
#[prost(string, tag = "16")]
|
|
pub download_link: ::prost::alloc::string::String,
|
|
#[prost(int32, tag = "17")]
|
|
pub seeders: i32,
|
|
#[prost(string, tag = "18")]
|
|
pub tracker: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum QualityType {
|
|
QualityUnspecified = 0,
|
|
QualityLossless = 1,
|
|
QualityLossy = 2,
|
|
}
|
|
impl QualityType {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::QualityUnspecified => "QUALITY_UNSPECIFIED",
|
|
Self::QualityLossless => "QUALITY_LOSSLESS",
|
|
Self::QualityLossy => "QUALITY_LOSSY",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"QUALITY_UNSPECIFIED" => Some(Self::QualityUnspecified),
|
|
"QUALITY_LOSSLESS" => Some(Self::QualityLossless),
|
|
"QUALITY_LOSSY" => Some(Self::QualityLossy),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum MonitorState {
|
|
Unspecified = 0,
|
|
Monitored = 1,
|
|
Unmonitored = 2,
|
|
Excluded = 3,
|
|
}
|
|
impl MonitorState {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "MONITOR_STATE_UNSPECIFIED",
|
|
Self::Monitored => "MONITOR_STATE_MONITORED",
|
|
Self::Unmonitored => "MONITOR_STATE_UNMONITORED",
|
|
Self::Excluded => "MONITOR_STATE_EXCLUDED",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"MONITOR_STATE_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"MONITOR_STATE_MONITORED" => Some(Self::Monitored),
|
|
"MONITOR_STATE_UNMONITORED" => Some(Self::Unmonitored),
|
|
"MONITOR_STATE_EXCLUDED" => Some(Self::Excluded),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
pub mod music_agregator_service_client {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
use tonic::codegen::http::Uri;
|
|
#[derive(Debug, Clone)]
|
|
pub struct MusicAgregatorServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl MusicAgregatorServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> MusicAgregatorServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
|
|
{
|
|
pub fn new(inner: T) -> Self {
|
|
let inner = tonic::client::Grpc::new(inner);
|
|
Self { inner }
|
|
}
|
|
pub fn with_origin(inner: T, origin: Uri) -> Self {
|
|
let inner = tonic::client::Grpc::with_origin(inner, origin);
|
|
Self { inner }
|
|
}
|
|
pub fn with_interceptor<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> MusicAgregatorServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
|
|
{
|
|
MusicAgregatorServiceClient::new(InterceptedService::new(inner, interceptor))
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[must_use]
|
|
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_encoding_message_size(limit);
|
|
self
|
|
}
|
|
pub async fn monitor_album(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::MonitorAlbumRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::MonitorAlbumResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/music_agregator.v1.MusicAgregatorService/MonitorAlbum",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"music_agregator.v1.MusicAgregatorService",
|
|
"MonitorAlbum",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn get_artists(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetArtistsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetArtistsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/music_agregator.v1.MusicAgregatorService/GetArtists",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"music_agregator.v1.MusicAgregatorService",
|
|
"GetArtists",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn get_album(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetAlbumRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetAlbumResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/music_agregator.v1.MusicAgregatorService/GetAlbum",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"music_agregator.v1.MusicAgregatorService",
|
|
"GetAlbum",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|