fix!: parse full video info from playlist items, remove PlaylistVideo model

This commit is contained in:
ThetaDev 2023-05-13 21:14:18 +02:00
parent 54f42bcb54
commit bf80db8a9a
21 changed files with 105688 additions and 42159 deletions

View file

@ -1,7 +1,7 @@
use super::{
AlbumItem, ArtistId, ArtistItem, Channel, ChannelId, ChannelItem, ChannelRssVideo, ChannelTag,
MusicArtist, MusicItem, MusicPlaylistItem, PlaylistItem, PlaylistVideo, TrackItem, VideoId,
VideoItem, YouTubeItem,
MusicArtist, MusicItem, MusicPlaylistItem, PlaylistItem, TrackItem, VideoId, VideoItem,
YouTubeItem,
};
/// Trait for casting generic YouTube/YouTube music items to a specific kind.
@ -159,15 +159,6 @@ impl From<VideoItem> for VideoId {
}
}
impl From<PlaylistVideo> for VideoId {
fn from(video: PlaylistVideo) -> Self {
Self {
id: video.id,
name: video.name,
}
}
}
impl From<ChannelRssVideo> for VideoId {
fn from(video: ChannelRssVideo) -> Self {
Self {

View file

@ -510,7 +510,7 @@ pub struct Playlist {
/// Playlist name
pub name: String,
/// Playlist videos
pub videos: Paginator<PlaylistVideo>,
pub videos: Paginator<VideoItem>,
/// Number of videos in the playlist
pub video_count: u64,
/// Playlist thumbnail
@ -528,22 +528,6 @@ pub struct Playlist {
pub visitor_data: Option<String>,
}
/// YouTube video extracted from a playlist
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[non_exhaustive]
pub struct PlaylistVideo {
/// Unique YouTube video ID
pub id: String,
/// Video title
pub name: String,
/// Video length in seconds
pub length: u32,
/// Video thumbnail
pub thumbnail: Vec<Thumbnail>,
/// Channel of the video
pub channel: ChannelId,
}
/// Channel identifier
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[non_exhaustive]