First POC with podcasts library
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
|
||||
namespace Jellyfin.Plugin.Jellypod.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a podcast episode.
|
||||
/// </summary>
|
||||
public class Episode
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier for this episode.
|
||||
/// </summary>
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ID of the parent podcast.
|
||||
/// </summary>
|
||||
public Guid PodcastId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode title.
|
||||
/// </summary>
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode description.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the URL to the audio file.
|
||||
/// </summary>
|
||||
public string AudioUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the local file path where the episode is stored.
|
||||
/// </summary>
|
||||
public string? LocalFilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the file size in bytes.
|
||||
/// </summary>
|
||||
public long? FileSizeBytes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode duration.
|
||||
/// </summary>
|
||||
public TimeSpan? Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the publish date.
|
||||
/// </summary>
|
||||
public DateTime PublishedDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date the episode was downloaded.
|
||||
/// </summary>
|
||||
public DateTime? DownloadedDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the download status.
|
||||
/// </summary>
|
||||
public EpisodeStatus Status { get; set; } = EpisodeStatus.Available;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RSS GUID for deduplication.
|
||||
/// </summary>
|
||||
public string? EpisodeGuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the season number if applicable.
|
||||
/// </summary>
|
||||
public int? SeasonNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode number if applicable.
|
||||
/// </summary>
|
||||
public int? EpisodeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode-specific image URL.
|
||||
/// </summary>
|
||||
public string? ImageUrl { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Jellyfin.Plugin.Jellypod.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the download status of a podcast episode.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public enum EpisodeStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Episode is known but not downloaded.
|
||||
/// </summary>
|
||||
Available,
|
||||
|
||||
/// <summary>
|
||||
/// Episode is currently being downloaded.
|
||||
/// </summary>
|
||||
Downloading,
|
||||
|
||||
/// <summary>
|
||||
/// Episode has been downloaded and is available locally.
|
||||
/// </summary>
|
||||
Downloaded,
|
||||
|
||||
/// <summary>
|
||||
/// Download failed.
|
||||
/// </summary>
|
||||
Error
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Jellyfin.Plugin.Jellypod.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a podcast subscription.
|
||||
/// </summary>
|
||||
public class Podcast
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier for this podcast.
|
||||
/// </summary>
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the podcast title.
|
||||
/// </summary>
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the podcast description.
|
||||
/// </summary>
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RSS feed URL.
|
||||
/// </summary>
|
||||
public string FeedUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the podcast artwork URL.
|
||||
/// </summary>
|
||||
public string? ImageUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the podcast author/publisher.
|
||||
/// </summary>
|
||||
public string? Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the podcast language.
|
||||
/// </summary>
|
||||
public string? Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the podcast category.
|
||||
/// </summary>
|
||||
public string? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last time the feed was updated.
|
||||
/// </summary>
|
||||
public DateTime LastUpdated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date this podcast was added.
|
||||
/// </summary>
|
||||
public DateTime DateAdded { get; set; } = DateTime.UtcNow;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether auto-download is enabled for this podcast.
|
||||
/// </summary>
|
||||
public bool AutoDownloadEnabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum episodes to keep (0 = unlimited).
|
||||
/// </summary>
|
||||
public int MaxEpisodesToKeep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of episodes.
|
||||
/// </summary>
|
||||
[SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Required for JSON deserialization")]
|
||||
public Collection<Episode> Episodes { get; set; } = new();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Jellyfin.Plugin.Jellypod.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Container for podcast data persistence.
|
||||
/// </summary>
|
||||
public class PodcastDatabase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the list of subscribed podcasts.
|
||||
/// </summary>
|
||||
[SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Required for JSON deserialization")]
|
||||
public Collection<Podcast> Podcasts { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last time the database was saved.
|
||||
/// </summary>
|
||||
public DateTime LastSaved { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user