diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Playlist/Playlist.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Playlist/Playlist.cs new file mode 100644 index 0000000..91e0a16 --- /dev/null +++ b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Playlist/Playlist.cs @@ -0,0 +1,116 @@ +using System.Collections.ObjectModel; +using Newtonsoft.Json; + +namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist +{ + /// + /// Enum representing whether the playlist on TubeArchivist belongs from YouTube or is created by the user. + /// + public enum PlaylistType + { + /// + /// Playlist belongs from YouTube. + /// + Regular, + + /// + /// Playlist created by the user. + /// + Custom + } + + /// + /// A class representing TubeArchivist API playlist data. + /// + public class Playlist + { + /// + /// Initializes a new instance of the class. + /// + /// URL of the channel banner image. + /// Playlist channel name. + /// Playlist channel YouTube id. + /// Playlist description. + /// Playlist videos. + /// Playlist YouTube id. + /// Playlist name. + /// URL of the playlist thumbnail. + /// Type of the playlist. See . + public Playlist( + bool isActive, + string channel, + string channelId, + string description, + Collection entries, + string id, + string name, + string thumbnailUrl, // TODO: Check if settable on Jellyfin + PlaylistType type) + { + this.IsActive = isActive; + this.Channel = channel; + this.ChannelId = channelId; + this.Description = description; + this.Entries = entries; + this.Id = id; + this.Name = name; + this.ThumbnailUrl = thumbnailUrl; + this.Type = type; + } + + /// + /// Gets or sets a value indicating whether the playlist is active or not. + /// + [JsonProperty(PropertyName = "playlist_active")] + public bool IsActive { get; set; } + + /// + /// Gets or sets the playlist channel name. + /// + [JsonProperty(PropertyName = "playlist_channel")] + public string Channel { get; set; } + + /// + /// Gets or sets the playlist channel YouTube id. + /// + [JsonProperty(PropertyName = "playlist_channel_id")] + public string ChannelId { get; set; } + + /// + /// Gets or sets the playlist description. + /// + [JsonProperty(PropertyName = "playlist_description")] + public string Description { get; set; } + + /// + /// Gets the playlist videos. + /// + [JsonProperty(PropertyName = "playlist_entries")] + public Collection Entries { get; } + + /// + /// Gets or sets the playlist YouTube id. + /// + [JsonProperty(PropertyName = "playlist_id")] + public string Id { get; set; } + + /// + /// Gets or sets the playlist name. + /// + [JsonProperty(PropertyName = "playlist_name")] + public string Name { get; set; } + + /// + /// Gets or sets the playlist thumbnail URL. + /// + [JsonProperty(PropertyName = "playlist_thumbnail")] + public string ThumbnailUrl { get; set; } + + /// + /// Gets or sets the playlist type. + /// + /// One of the values indicating the playlist's type. + [JsonProperty(PropertyName = "playlist_type")] + public PlaylistType Type { get; set; } + } +} diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Playlist/PlaylistEntry.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Playlist/PlaylistEntry.cs new file mode 100644 index 0000000..5e9120d --- /dev/null +++ b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Playlist/PlaylistEntry.cs @@ -0,0 +1,63 @@ +using ICU4N.Text; +using Newtonsoft.Json; + +namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist +{ + /// + /// A class representing TubeArchivist API playlist entries data. + /// + public class PlaylistEntry + { + /// + /// Initializes a new instance of the class. + /// + /// Video YouTube id. + /// Video title. + /// Video uploader. + /// Video index in the playlist. + /// A value indicating whether the video has been already downloaded or not. + public PlaylistEntry( + string youtubeId, + string title, + string uploader, + int index, + bool isDownloaded) + { + this.YoutubeId = youtubeId; + this.Title = title; + this.Uploader = uploader; + this.Index = index; + this.IsDownloaded = isDownloaded; + } + + /// + /// Gets or sets the video YouTube id. + /// + [JsonProperty(PropertyName = "youtube_id")] + public string YoutubeId { get; set; } + + /// + /// Gets or sets the video title. + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Gets or sets the video uploader. + /// + [JsonProperty(PropertyName = "uploader")] + public string Uploader { get; set; } + + /// + /// Gets or sets the video index in the playlist. + /// + [JsonProperty(PropertyName = "idx")] + public int Index { get; set; } + + /// + /// Gets or sets a value indicating whether the video has been already downloaded or not. + /// + [JsonProperty(PropertyName = "downloaded")] + public bool IsDownloaded { get; set; } + } +}