2022-08-02 10:45:37 +00:00
|
|
|
use std::{
|
|
|
|
fmt::Debug,
|
|
|
|
ops::{Deref, DerefMut},
|
|
|
|
};
|
2021-12-07 22:22:24 +00:00
|
|
|
|
2022-08-02 10:45:37 +00:00
|
|
|
use crate::util::{from_repeated_message, impl_deref_wrapped};
|
2021-12-07 22:22:24 +00:00
|
|
|
|
2021-12-26 20:18:42 +00:00
|
|
|
use librespot_protocol as protocol;
|
2021-12-07 22:22:24 +00:00
|
|
|
use protocol::metadata::Copyright as CopyrightMessage;
|
|
|
|
pub use protocol::metadata::Copyright_Type as CopyrightType;
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct Copyright {
|
|
|
|
pub copyright_type: CopyrightType,
|
|
|
|
pub text: String,
|
|
|
|
}
|
|
|
|
|
2022-07-31 22:44:43 +00:00
|
|
|
#[derive(Debug, Clone, Default)]
|
2021-12-07 22:22:24 +00:00
|
|
|
pub struct Copyrights(pub Vec<Copyright>);
|
|
|
|
|
2022-08-02 10:45:37 +00:00
|
|
|
impl_deref_wrapped!(Copyrights, Vec<Copyright>);
|
2021-12-07 22:22:24 +00:00
|
|
|
|
|
|
|
impl From<&CopyrightMessage> for Copyright {
|
|
|
|
fn from(copyright: &CopyrightMessage) -> Self {
|
|
|
|
Self {
|
|
|
|
copyright_type: copyright.get_field_type(),
|
|
|
|
text: copyright.get_text().to_owned(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
from_repeated_message!(CopyrightMessage, Copyrights);
|