All checks were successful
Create Release PR / Create Release PR (push) Successful in 17s
172 lines
4.2 KiB
C#
172 lines
4.2 KiB
C#
using LiteDB;
|
|
|
|
namespace Jellyfin.Plugin.SmartNotify.Services;
|
|
|
|
/// <summary>
|
|
/// Represents a known media item in the database.
|
|
/// Used to detect if an "added" item is actually a quality upgrade.
|
|
/// </summary>
|
|
public class KnownMediaItem
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the database ID.
|
|
/// </summary>
|
|
[BsonId]
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the Jellyfin Item ID (GUID as string).
|
|
/// </summary>
|
|
public string JellyfinItemId { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the unique content identifier.
|
|
/// For episodes: "{SeriesProviderIds}|S{Season}E{Episode}"
|
|
/// For movies: "{ProviderIds}"
|
|
/// </summary>
|
|
public string ContentKey { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the item type (Episode, Movie, etc.).
|
|
/// </summary>
|
|
public string ItemType { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the series name (for episodes).
|
|
/// </summary>
|
|
public string? SeriesName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the season number (for episodes).
|
|
/// </summary>
|
|
public int? SeasonNumber { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the episode number (for episodes).
|
|
/// </summary>
|
|
public int? EpisodeNumber { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the item name.
|
|
/// </summary>
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the year.
|
|
/// </summary>
|
|
public int? Year { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets when this item was first seen.
|
|
/// </summary>
|
|
public DateTime FirstSeen { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the file path (for detecting file changes).
|
|
/// </summary>
|
|
public string? FilePath { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the file size in bytes.
|
|
/// </summary>
|
|
public long? FileSize { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the provider IDs as JSON string.
|
|
/// </summary>
|
|
public string ProviderIdsJson { get; set; } = "{}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a pending notification in the queue.
|
|
/// </summary>
|
|
public class PendingNotification
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the database ID.
|
|
/// </summary>
|
|
[BsonId]
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the Jellyfin Item ID.
|
|
/// </summary>
|
|
public string JellyfinItemId { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the item type.
|
|
/// </summary>
|
|
public string ItemType { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the series name (for grouping episodes).
|
|
/// </summary>
|
|
public string? SeriesName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the series ID (for grouping).
|
|
/// </summary>
|
|
public string? SeriesId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the season number.
|
|
/// </summary>
|
|
public int? SeasonNumber { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the episode number.
|
|
/// </summary>
|
|
public int? EpisodeNumber { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the item name.
|
|
/// </summary>
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the year.
|
|
/// </summary>
|
|
public int? Year { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets when the notification was queued.
|
|
/// </summary>
|
|
public DateTime QueuedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the notification type.
|
|
/// </summary>
|
|
public NotificationType Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the image URL.
|
|
/// </summary>
|
|
public string? ImageUrl { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the provider IDs JSON.
|
|
/// </summary>
|
|
public string ProviderIdsJson { get; set; } = "{}";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the overview/description.
|
|
/// </summary>
|
|
public string? Overview { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Type of notification.
|
|
/// </summary>
|
|
public enum NotificationType
|
|
{
|
|
/// <summary>
|
|
/// Truly new content.
|
|
/// </summary>
|
|
NewContent,
|
|
|
|
/// <summary>
|
|
/// Quality upgrade of existing content.
|
|
/// </summary>
|
|
QualityUpgrade
|
|
}
|