diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel/Channel.cs similarity index 100% rename from Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel.cs rename to Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel/Channel.cs diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Player.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Player.cs new file mode 100644 index 0000000..3689c7c --- /dev/null +++ b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Player.cs @@ -0,0 +1,51 @@ +using System; +using Newtonsoft.Json; + +namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist +{ + /// + /// A class representing TubeArchivist API video player data. + /// + public class Player + { + /// + /// Initializes a new instance of the class. + /// + /// Duration of the video. + /// Whether the video is marked as watched. + /// Unix time of when the video has been marked watched. + public Player(long duration, bool isWatched, long watchedUnixTime) + { + Duration = duration; + IsWatched = isWatched; + WatchedUnixTime = watchedUnixTime; + } + + /// + /// Gets the duration of the video. + /// + [JsonProperty(PropertyName = "duration")] + public long Duration { get; } + + /// + /// Gets a value indicating whether the video is marked as watched. + /// + [JsonProperty(PropertyName = "watched")] + public bool IsWatched { get; } + + /// + /// Gets the Unix date and time when the video has been marked as watched. + /// + [JsonProperty(PropertyName = "watched_date")] + public long WatchedUnixTime { get; } + + /// + /// Gets the date and time when the video has been marked as watched. + /// + [JsonIgnore] + public DateTime WatchedTime + { + get => DateTimeOffset.FromUnixTimeSeconds(WatchedUnixTime).DateTime; + } + } +} diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Progress.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Progress.cs similarity index 100% rename from Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Progress.cs rename to Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Progress.cs diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Video.cs similarity index 94% rename from Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video.cs rename to Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Video.cs index 97ea596..dec2ec0 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Video/Video.cs @@ -27,6 +27,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist /// Video published date. /// Video thuumb image URL. /// Video YouTube id. + /// Player info. public Video( Channel channel, Collection tags, @@ -34,7 +35,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist string description, DateTime published, string vidThumbUrl, - string youtubeId) + string youtubeId, + Player player) { this.Channel = channel; this.Tags = tags; @@ -43,6 +45,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist this.Published = published; this.VidThumbUrl = vidThumbUrl; this.YoutubeId = youtubeId; + Player = player; } /// @@ -88,6 +91,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist [JsonProperty(PropertyName = "youtube_id")] public string YoutubeId { get; set; } + /// + /// Getsthe player related info. + /// + [JsonProperty(PropertyName = "player")] + public Player Player { get; } + /// /// Converts the TubeArchivist API video to a Jellyfin object. ///