commit
b7c07f6821
@ -1,590 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Controller.Subtitles;
|
||||
using MediaBrowser.Model.Activity;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using MediaBrowser.Model.Notifications;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
/// <summary>
|
||||
/// Entry point for the activity logger.
|
||||
/// </summary>
|
||||
public sealed class ActivityLogEntryPoint : IServerEntryPoint
|
||||
{
|
||||
private readonly ILogger<ActivityLogEntryPoint> _logger;
|
||||
private readonly IInstallationManager _installationManager;
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IActivityManager _activityManager;
|
||||
private readonly ILocalizationManager _localization;
|
||||
private readonly ISubtitleManager _subManager;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ActivityLogEntryPoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="sessionManager">The session manager.</param>
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="activityManager">The activity manager.</param>
|
||||
/// <param name="localization">The localization manager.</param>
|
||||
/// <param name="installationManager">The installation manager.</param>
|
||||
/// <param name="subManager">The subtitle manager.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
public ActivityLogEntryPoint(
|
||||
ILogger<ActivityLogEntryPoint> logger,
|
||||
ISessionManager sessionManager,
|
||||
ITaskManager taskManager,
|
||||
IActivityManager activityManager,
|
||||
ILocalizationManager localization,
|
||||
IInstallationManager installationManager,
|
||||
ISubtitleManager subManager,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_sessionManager = sessionManager;
|
||||
_taskManager = taskManager;
|
||||
_activityManager = activityManager;
|
||||
_localization = localization;
|
||||
_installationManager = installationManager;
|
||||
_subManager = subManager;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task RunAsync()
|
||||
{
|
||||
_taskManager.TaskCompleted += OnTaskCompleted;
|
||||
|
||||
_installationManager.PluginInstalled += OnPluginInstalled;
|
||||
_installationManager.PluginUninstalled += OnPluginUninstalled;
|
||||
_installationManager.PluginUpdated += OnPluginUpdated;
|
||||
_installationManager.PackageInstallationFailed += OnPackageInstallationFailed;
|
||||
|
||||
_sessionManager.SessionStarted += OnSessionStarted;
|
||||
_sessionManager.AuthenticationFailed += OnAuthenticationFailed;
|
||||
_sessionManager.AuthenticationSucceeded += OnAuthenticationSucceeded;
|
||||
_sessionManager.SessionEnded += OnSessionEnded;
|
||||
_sessionManager.PlaybackStart += OnPlaybackStart;
|
||||
_sessionManager.PlaybackStopped += OnPlaybackStopped;
|
||||
|
||||
_subManager.SubtitleDownloadFailure += OnSubtitleDownloadFailure;
|
||||
|
||||
_userManager.OnUserCreated += OnUserCreated;
|
||||
_userManager.OnUserPasswordChanged += OnUserPasswordChanged;
|
||||
_userManager.OnUserDeleted += OnUserDeleted;
|
||||
_userManager.OnUserLockedOut += OnUserLockedOut;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async void OnUserLockedOut(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserLockedOutWithName"),
|
||||
e.Argument.Username),
|
||||
NotificationType.UserLockedOut.ToString(),
|
||||
e.Argument.Id)
|
||||
{
|
||||
LogSeverity = LogLevel.Error
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnSubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"),
|
||||
e.Provider,
|
||||
Notifications.NotificationEntryPoint.GetItemName(e.Item)),
|
||||
"SubtitleDownloadFailure",
|
||||
Guid.Empty)
|
||||
{
|
||||
ItemId = e.Item.Id.ToString("N", CultureInfo.InvariantCulture),
|
||||
ShortOverview = e.Exception.Message
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPlaybackStopped(object sender, PlaybackStopEventArgs e)
|
||||
{
|
||||
var item = e.MediaInfo;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
_logger.LogWarning("PlaybackStopped reported with null media info.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Item != null && e.Item.IsThemeMedia)
|
||||
{
|
||||
// Don't report theme song or local trailer playback
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Users.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var user = e.Users[0];
|
||||
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserStoppedPlayingItemWithValues"),
|
||||
user.Username,
|
||||
GetItemName(item),
|
||||
e.DeviceName),
|
||||
GetPlaybackStoppedNotificationType(item.MediaType),
|
||||
user.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPlaybackStart(object sender, PlaybackProgressEventArgs e)
|
||||
{
|
||||
var item = e.MediaInfo;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
_logger.LogWarning("PlaybackStart reported with null media info.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Item != null && e.Item.IsThemeMedia)
|
||||
{
|
||||
// Don't report theme song or local trailer playback
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Users.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var user = e.Users.First();
|
||||
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserStartedPlayingItemWithValues"),
|
||||
user.Username,
|
||||
GetItemName(item),
|
||||
e.DeviceName),
|
||||
GetPlaybackNotificationType(item.MediaType),
|
||||
user.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static string GetItemName(BaseItemDto item)
|
||||
{
|
||||
var name = item.Name;
|
||||
|
||||
if (!string.IsNullOrEmpty(item.SeriesName))
|
||||
{
|
||||
name = item.SeriesName + " - " + name;
|
||||
}
|
||||
|
||||
if (item.Artists != null && item.Artists.Count > 0)
|
||||
{
|
||||
name = item.Artists[0] + " - " + name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private static string GetPlaybackNotificationType(string mediaType)
|
||||
{
|
||||
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return NotificationType.AudioPlayback.ToString();
|
||||
}
|
||||
|
||||
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return NotificationType.VideoPlayback.ToString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string GetPlaybackStoppedNotificationType(string mediaType)
|
||||
{
|
||||
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return NotificationType.AudioPlaybackStopped.ToString();
|
||||
}
|
||||
|
||||
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return NotificationType.VideoPlaybackStopped.ToString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private async void OnSessionEnded(object sender, SessionEventArgs e)
|
||||
{
|
||||
var session = e.SessionInfo;
|
||||
|
||||
if (string.IsNullOrEmpty(session.UserName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserOfflineFromDevice"),
|
||||
session.UserName,
|
||||
session.DeviceName),
|
||||
"SessionEnded",
|
||||
session.UserId)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("LabelIpAddressValue"),
|
||||
session.RemoteEndPoint),
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnAuthenticationSucceeded(object sender, GenericEventArgs<AuthenticationResult> e)
|
||||
{
|
||||
var user = e.Argument.User;
|
||||
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("AuthenticationSucceededWithUserName"),
|
||||
user.Name),
|
||||
"AuthenticationSucceeded",
|
||||
user.Id)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("LabelIpAddressValue"),
|
||||
e.Argument.SessionInfo.RemoteEndPoint),
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnAuthenticationFailed(object sender, GenericEventArgs<AuthenticationRequest> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("FailedLoginAttemptWithUserName"),
|
||||
e.Argument.Username),
|
||||
"AuthenticationFailed",
|
||||
Guid.Empty)
|
||||
{
|
||||
LogSeverity = LogLevel.Error,
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("LabelIpAddressValue"),
|
||||
e.Argument.RemoteEndPoint),
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserDeleted(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserDeletedWithName"),
|
||||
e.Argument.Username),
|
||||
"UserDeleted",
|
||||
Guid.Empty))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserPasswordChanged(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserPasswordChangedWithName"),
|
||||
e.Argument.Username),
|
||||
"UserPasswordChanged",
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserCreated(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserCreatedWithName"),
|
||||
e.Argument.Username),
|
||||
"UserCreated",
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnSessionStarted(object sender, SessionEventArgs e)
|
||||
{
|
||||
var session = e.SessionInfo;
|
||||
|
||||
if (string.IsNullOrEmpty(session.UserName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserOnlineFromDevice"),
|
||||
session.UserName,
|
||||
session.DeviceName),
|
||||
"SessionStarted",
|
||||
session.UserId)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("LabelIpAddressValue"),
|
||||
session.RemoteEndPoint)
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPluginUpdated(object sender, InstallationInfo e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("PluginUpdatedWithName"),
|
||||
e.Name),
|
||||
NotificationType.PluginUpdateInstalled.ToString(),
|
||||
Guid.Empty)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("VersionNumber"),
|
||||
e.Version),
|
||||
Overview = e.Changelog
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPluginUninstalled(object sender, IPlugin e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("PluginUninstalledWithName"),
|
||||
e.Name),
|
||||
NotificationType.PluginUninstalled.ToString(),
|
||||
Guid.Empty))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPluginInstalled(object sender, InstallationInfo e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("PluginInstalledWithName"),
|
||||
e.Name),
|
||||
NotificationType.PluginInstalled.ToString(),
|
||||
Guid.Empty)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("VersionNumber"),
|
||||
e.Version)
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPackageInstallationFailed(object sender, InstallationFailedEventArgs e)
|
||||
{
|
||||
var installationInfo = e.InstallationInfo;
|
||||
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("NameInstallFailed"),
|
||||
installationInfo.Name),
|
||||
NotificationType.InstallationFailed.ToString(),
|
||||
Guid.Empty)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("VersionNumber"),
|
||||
installationInfo.Version),
|
||||
Overview = e.Exception.Message
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnTaskCompleted(object sender, TaskCompletionEventArgs e)
|
||||
{
|
||||
var result = e.Result;
|
||||
var task = e.Task;
|
||||
|
||||
if (task.ScheduledTask is IConfigurableScheduledTask activityTask
|
||||
&& !activityTask.IsLogged)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var time = result.EndTimeUtc - result.StartTimeUtc;
|
||||
var runningTime = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("LabelRunningTimeValue"),
|
||||
ToUserFriendlyString(time));
|
||||
|
||||
if (result.Status == TaskCompletionStatus.Failed)
|
||||
{
|
||||
var vals = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(e.Result.ErrorMessage))
|
||||
{
|
||||
vals.Add(e.Result.ErrorMessage);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(e.Result.LongErrorMessage))
|
||||
{
|
||||
vals.Add(e.Result.LongErrorMessage);
|
||||
}
|
||||
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(CultureInfo.InvariantCulture, _localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
|
||||
NotificationType.TaskFailed.ToString(),
|
||||
Guid.Empty)
|
||||
{
|
||||
LogSeverity = LogLevel.Error,
|
||||
Overview = string.Join(Environment.NewLine, vals),
|
||||
ShortOverview = runningTime
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CreateLogEntry(ActivityLog entry)
|
||||
=> await _activityManager.CreateAsync(entry).ConfigureAwait(false);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
_taskManager.TaskCompleted -= OnTaskCompleted;
|
||||
|
||||
_installationManager.PluginInstalled -= OnPluginInstalled;
|
||||
_installationManager.PluginUninstalled -= OnPluginUninstalled;
|
||||
_installationManager.PluginUpdated -= OnPluginUpdated;
|
||||
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
|
||||
|
||||
_sessionManager.SessionStarted -= OnSessionStarted;
|
||||
_sessionManager.AuthenticationFailed -= OnAuthenticationFailed;
|
||||
_sessionManager.AuthenticationSucceeded -= OnAuthenticationSucceeded;
|
||||
_sessionManager.SessionEnded -= OnSessionEnded;
|
||||
|
||||
_sessionManager.PlaybackStart -= OnPlaybackStart;
|
||||
_sessionManager.PlaybackStopped -= OnPlaybackStopped;
|
||||
|
||||
_subManager.SubtitleDownloadFailure -= OnSubtitleDownloadFailure;
|
||||
|
||||
_userManager.OnUserCreated -= OnUserCreated;
|
||||
_userManager.OnUserPasswordChanged -= OnUserPasswordChanged;
|
||||
_userManager.OnUserDeleted -= OnUserDeleted;
|
||||
_userManager.OnUserLockedOut -= OnUserLockedOut;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a user-friendly string for this TimeSpan instance.
|
||||
/// </summary>
|
||||
private static string ToUserFriendlyString(TimeSpan span)
|
||||
{
|
||||
const int DaysInYear = 365;
|
||||
const int DaysInMonth = 30;
|
||||
|
||||
// Get each non-zero value from TimeSpan component
|
||||
var values = new List<string>();
|
||||
|
||||
// Number of years
|
||||
int days = span.Days;
|
||||
if (days >= DaysInYear)
|
||||
{
|
||||
int years = days / DaysInYear;
|
||||
values.Add(CreateValueString(years, "year"));
|
||||
days %= DaysInYear;
|
||||
}
|
||||
|
||||
// Number of months
|
||||
if (days >= DaysInMonth)
|
||||
{
|
||||
int months = days / DaysInMonth;
|
||||
values.Add(CreateValueString(months, "month"));
|
||||
days = days % DaysInMonth;
|
||||
}
|
||||
|
||||
// Number of days
|
||||
if (days >= 1)
|
||||
{
|
||||
values.Add(CreateValueString(days, "day"));
|
||||
}
|
||||
|
||||
// Number of hours
|
||||
if (span.Hours >= 1)
|
||||
{
|
||||
values.Add(CreateValueString(span.Hours, "hour"));
|
||||
}
|
||||
|
||||
// Number of minutes
|
||||
if (span.Minutes >= 1)
|
||||
{
|
||||
values.Add(CreateValueString(span.Minutes, "minute"));
|
||||
}
|
||||
|
||||
// Number of seconds (include when 0 if no other components included)
|
||||
if (span.Seconds >= 1 || values.Count == 0)
|
||||
{
|
||||
values.Add(CreateValueString(span.Seconds, "second"));
|
||||
}
|
||||
|
||||
// Combine values into string
|
||||
var builder = new StringBuilder();
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
if (builder.Length > 0)
|
||||
{
|
||||
builder.Append(i == values.Count - 1 ? " and " : ", ");
|
||||
}
|
||||
|
||||
builder.Append(values[i]);
|
||||
}
|
||||
|
||||
// Return result
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a string description of a time-span value.
|
||||
/// </summary>
|
||||
/// <param name="value">The value of this item.</param>
|
||||
/// <param name="description">The name of this item (singular form).</param>
|
||||
private static string CreateValueString(int value, string description)
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0:#,##0} {1}",
|
||||
value,
|
||||
value == 1 ? description : string.Format(CultureInfo.InvariantCulture, "{0}s", description));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,210 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Updates;
|
||||
|
||||
namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
/// <summary>
|
||||
/// Class WebSocketEvents.
|
||||
/// </summary>
|
||||
public class ServerEventNotifier : IServerEntryPoint
|
||||
{
|
||||
/// <summary>
|
||||
/// The user manager.
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
/// <summary>
|
||||
/// The installation manager.
|
||||
/// </summary>
|
||||
private readonly IInstallationManager _installationManager;
|
||||
|
||||
/// <summary>
|
||||
/// The kernel.
|
||||
/// </summary>
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
|
||||
/// <summary>
|
||||
/// The task manager.
|
||||
/// </summary>
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
private readonly ISessionManager _sessionManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ServerEventNotifier"/> class.
|
||||
/// </summary>
|
||||
/// <param name="appHost">The application host.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
/// <param name="installationManager">The installation manager.</param>
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="sessionManager">The session manager.</param>
|
||||
public ServerEventNotifier(
|
||||
IServerApplicationHost appHost,
|
||||
IUserManager userManager,
|
||||
IInstallationManager installationManager,
|
||||
ITaskManager taskManager,
|
||||
ISessionManager sessionManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_installationManager = installationManager;
|
||||
_appHost = appHost;
|
||||
_taskManager = taskManager;
|
||||
_sessionManager = sessionManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task RunAsync()
|
||||
{
|
||||
_userManager.OnUserDeleted += OnUserDeleted;
|
||||
_userManager.OnUserUpdated += OnUserUpdated;
|
||||
|
||||
_appHost.HasPendingRestartChanged += OnHasPendingRestartChanged;
|
||||
|
||||
_installationManager.PluginUninstalled += OnPluginUninstalled;
|
||||
_installationManager.PackageInstalling += OnPackageInstalling;
|
||||
_installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled;
|
||||
_installationManager.PackageInstallationCompleted += OnPackageInstallationCompleted;
|
||||
_installationManager.PackageInstallationFailed += OnPackageInstallationFailed;
|
||||
|
||||
_taskManager.TaskCompleted += OnTaskCompleted;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async void OnPackageInstalling(object sender, InstallationInfo e)
|
||||
{
|
||||
await SendMessageToAdminSessions("PackageInstalling", e).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPackageInstallationCancelled(object sender, InstallationInfo e)
|
||||
{
|
||||
await SendMessageToAdminSessions("PackageInstallationCancelled", e).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPackageInstallationCompleted(object sender, InstallationInfo e)
|
||||
{
|
||||
await SendMessageToAdminSessions("PackageInstallationCompleted", e).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnPackageInstallationFailed(object sender, InstallationFailedEventArgs e)
|
||||
{
|
||||
await SendMessageToAdminSessions("PackageInstallationFailed", e.InstallationInfo).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnTaskCompleted(object sender, TaskCompletionEventArgs e)
|
||||
{
|
||||
await SendMessageToAdminSessions("ScheduledTaskEnded", e.Result).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Installations the manager_ plugin uninstalled.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
private async void OnPluginUninstalled(object sender, IPlugin e)
|
||||
{
|
||||
await SendMessageToAdminSessions("PluginUninstalled", e).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the HasPendingRestartChanged event of the kernel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private async void OnHasPendingRestartChanged(object sender, EventArgs e)
|
||||
{
|
||||
await _sessionManager.SendRestartRequiredNotification(CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Users the manager_ user updated.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
private async void OnUserUpdated(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
var dto = _userManager.GetUserDto(e.Argument);
|
||||
|
||||
await SendMessageToUserSession(e.Argument, "UserUpdated", dto).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Users the manager_ user deleted.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
private async void OnUserDeleted(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N", CultureInfo.InvariantCulture)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task SendMessageToAdminSessions<T>(string name, T data)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _sessionManager.SendMessageToAdminSessions(name, data, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SendMessageToUserSession<T>(User user, string name, T data)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _sessionManager.SendMessageToUserSessions(
|
||||
new List<Guid> { user.Id },
|
||||
name,
|
||||
data,
|
||||
CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases unmanaged and - optionally - managed resources.
|
||||
/// </summary>
|
||||
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||
protected virtual void Dispose(bool dispose)
|
||||
{
|
||||
if (dispose)
|
||||
{
|
||||
_userManager.OnUserDeleted -= OnUserDeleted;
|
||||
_userManager.OnUserUpdated -= OnUserUpdated;
|
||||
|
||||
_installationManager.PluginUninstalled -= OnPluginUninstalled;
|
||||
_installationManager.PackageInstalling -= OnPackageInstalling;
|
||||
_installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled;
|
||||
_installationManager.PackageInstallationCompleted -= OnPackageInstallationCompleted;
|
||||
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
|
||||
|
||||
_appHost.HasPendingRestartChanged -= OnHasPendingRestartChanged;
|
||||
|
||||
_taskManager.TaskCompleted -= OnTaskCompleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,208 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class Artwork
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected Artwork()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static Artwork CreateArtworkUnsafe()
|
||||
{
|
||||
return new Artwork();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="kind"></param>
|
||||
/// <param name="_metadata0"></param>
|
||||
/// <param name="_personrole1"></param>
|
||||
public Artwork(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
this.Path = path;
|
||||
|
||||
this.Kind = kind;
|
||||
|
||||
if (_metadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_metadata0));
|
||||
}
|
||||
|
||||
_metadata0.Artwork.Add(this);
|
||||
|
||||
if (_personrole1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_personrole1));
|
||||
}
|
||||
|
||||
_personrole1.Artwork = this;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="kind"></param>
|
||||
/// <param name="_metadata0"></param>
|
||||
/// <param name="_personrole1"></param>
|
||||
public static Artwork Create(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
|
||||
{
|
||||
return new Artwork(path, kind, _metadata0, _personrole1);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Id.
|
||||
/// </summary>
|
||||
internal int _Id;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetId(int oldValue, ref int newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetId(ref int result);
|
||||
|
||||
/// <summary>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </summary>
|
||||
[Key]
|
||||
[Required]
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
int oldValue = _Id;
|
||||
SetId(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Path.
|
||||
/// </summary>
|
||||
protected string _Path;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Path to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetPath(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Path to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetPath(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Required, Max length = 65535
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Path
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Path;
|
||||
GetPath(ref value);
|
||||
return _Path = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Path;
|
||||
SetPath(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Path = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Kind.
|
||||
/// </summary>
|
||||
internal Enums.ArtKind _Kind;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Kind to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetKind(Enums.ArtKind oldValue, ref Enums.ArtKind newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Kind to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetKind(ref Enums.ArtKind result);
|
||||
|
||||
/// <summary>
|
||||
/// Indexed, Required.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Enums.ArtKind Kind
|
||||
{
|
||||
get
|
||||
{
|
||||
Enums.ArtKind value = _Kind;
|
||||
GetKind(ref value);
|
||||
return _Kind = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Enums.ArtKind oldValue = _Kind;
|
||||
SetKind(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Kind = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required, ConcurrenyToken.
|
||||
/// </summary>
|
||||
[ConcurrencyCheck]
|
||||
[Required]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
}
|
||||
}
|
||||
|
@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class Book : LibraryItem
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected Book()
|
||||
{
|
||||
BookMetadata = new HashSet<BookMetadata>();
|
||||
Releases = new HashSet<Release>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static Book CreateBookUnsafe()
|
||||
{
|
||||
return new Book();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
|
||||
public Book(Guid urlid, DateTime dateadded)
|
||||
{
|
||||
this.UrlId = urlid;
|
||||
|
||||
this.BookMetadata = new HashSet<BookMetadata>();
|
||||
this.Releases = new HashSet<Release>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
|
||||
public static Book Create(Guid urlid, DateTime dateadded)
|
||||
{
|
||||
return new Book(urlid, dateadded);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
|
||||
[ForeignKey("BookMetadata_BookMetadata_Id")]
|
||||
public virtual ICollection<BookMetadata> BookMetadata { get; protected set; }
|
||||
|
||||
[ForeignKey("Release_Releases_Id")]
|
||||
public virtual ICollection<Release> Releases { get; protected set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,119 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class BookMetadata : Metadata
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected BookMetadata()
|
||||
{
|
||||
Publishers = new HashSet<Company>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static BookMetadata CreateBookMetadataUnsafe()
|
||||
{
|
||||
return new BookMetadata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_book0"></param>
|
||||
public BookMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_book0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_book0));
|
||||
}
|
||||
|
||||
_book0.BookMetadata.Add(this);
|
||||
|
||||
this.Publishers = new HashSet<Company>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_book0"></param>
|
||||
public static BookMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
|
||||
{
|
||||
return new BookMetadata(title, language, dateadded, datemodified, _book0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for ISBN.
|
||||
/// </summary>
|
||||
protected long? _ISBN;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of ISBN to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetISBN(long? oldValue, ref long? newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of ISBN to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetISBN(ref long? result);
|
||||
|
||||
public long? ISBN
|
||||
{
|
||||
get
|
||||
{
|
||||
long? value = _ISBN;
|
||||
GetISBN(ref value);
|
||||
return _ISBN = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
long? oldValue = _ISBN;
|
||||
SetISBN(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_ISBN = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
|
||||
[ForeignKey("Company_Publishers_Id")]
|
||||
public virtual ICollection<Company> Publishers { get; protected set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,275 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class Chapter
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected Chapter()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static Chapter CreateChapterUnsafe()
|
||||
{
|
||||
return new Chapter();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="timestart"></param>
|
||||
/// <param name="_release0"></param>
|
||||
public Chapter(string language, long timestart, Release _release0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
this.TimeStart = timestart;
|
||||
|
||||
if (_release0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_release0));
|
||||
}
|
||||
|
||||
_release0.Chapters.Add(this);
|
||||
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="timestart"></param>
|
||||
/// <param name="_release0"></param>
|
||||
public static Chapter Create(string language, long timestart, Release _release0)
|
||||
{
|
||||
return new Chapter(language, timestart, _release0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Id.
|
||||
/// </summary>
|
||||
internal int _Id;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetId(int oldValue, ref int newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetId(ref int result);
|
||||
|
||||
/// <summary>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </summary>
|
||||
[Key]
|
||||
[Required]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
int oldValue = _Id;
|
||||
SetId(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Name.
|
||||
/// </summary>
|
||||
protected string _Name;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Name to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetName(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Name to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetName(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 1024
|
||||
/// </summary>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Name;
|
||||
SetName(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Name = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Language.
|
||||
/// </summary>
|
||||
protected string _Language;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Language to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetLanguage(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Language to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetLanguage(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Required, Min length = 3, Max length = 3
|
||||
/// ISO-639-3 3-character language codes.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MinLength(3)]
|
||||
[MaxLength(3)]
|
||||
[StringLength(3)]
|
||||
public string Language
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Language;
|
||||
GetLanguage(ref value);
|
||||
return _Language = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Language;
|
||||
SetLanguage(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Language = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for TimeStart.
|
||||
/// </summary>
|
||||
protected long _TimeStart;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of TimeStart to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetTimeStart(long oldValue, ref long newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of TimeStart to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetTimeStart(ref long result);
|
||||
|
||||
/// <summary>
|
||||
/// Required.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public long TimeStart
|
||||
{
|
||||
get
|
||||
{
|
||||
long value = _TimeStart;
|
||||
GetTimeStart(ref value);
|
||||
return _TimeStart = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
long oldValue = _TimeStart;
|
||||
SetTimeStart(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_TimeStart = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for TimeEnd.
|
||||
/// </summary>
|
||||
protected long? _TimeEnd;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of TimeEnd to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetTimeEnd(long? oldValue, ref long? newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of TimeEnd to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetTimeEnd(ref long? result);
|
||||
|
||||
public long? TimeEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
long? value = _TimeEnd;
|
||||
GetTimeEnd(ref value);
|
||||
return _TimeEnd = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
long? oldValue = _TimeEnd;
|
||||
SetTimeEnd(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_TimeEnd = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required, ConcurrenyToken.
|
||||
/// </summary>
|
||||
[ConcurrencyCheck]
|
||||
[Required]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
}
|
||||
}
|
||||
|
@ -1,121 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class Collection
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public Collection()
|
||||
{
|
||||
CollectionItem = new LinkedList<CollectionItem>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Id.
|
||||
/// </summary>
|
||||
internal int _Id;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetId(int oldValue, ref int newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetId(ref int result);
|
||||
|
||||
/// <summary>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </summary>
|
||||
[Key]
|
||||
[Required]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
int oldValue = _Id;
|
||||
SetId(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Name.
|
||||
/// </summary>
|
||||
protected string _Name;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Name to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetName(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Name to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetName(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 1024
|
||||
/// </summary>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Name;
|
||||
SetName(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Name = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required, ConcurrenyToken.
|
||||
/// </summary>
|
||||
[ConcurrencyCheck]
|
||||
[Required]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
[ForeignKey("CollectionItem_CollectionItem_Id")]
|
||||
public virtual ICollection<CollectionItem> CollectionItem { get; protected set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,154 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class CollectionItem
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected CollectionItem()
|
||||
{
|
||||
// NOTE: This class has one-to-one associations with CollectionItem.
|
||||
// One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static CollectionItem CreateCollectionItemUnsafe()
|
||||
{
|
||||
return new CollectionItem();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="_collection0"></param>
|
||||
/// <param name="_collectionitem1"></param>
|
||||
/// <param name="_collectionitem2"></param>
|
||||
public CollectionItem(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
|
||||
{
|
||||
// NOTE: This class has one-to-one associations with CollectionItem.
|
||||
// One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
|
||||
|
||||
if (_collection0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_collection0));
|
||||
}
|
||||
|
||||
_collection0.CollectionItem.Add(this);
|
||||
|
||||
if (_collectionitem1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_collectionitem1));
|
||||
}
|
||||
|
||||
_collectionitem1.Next = this;
|
||||
|
||||
if (_collectionitem2 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_collectionitem2));
|
||||
}
|
||||
|
||||
_collectionitem2.Previous = this;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="_collection0"></param>
|
||||
/// <param name="_collectionitem1"></param>
|
||||
/// <param name="_collectionitem2"></param>
|
||||
public static CollectionItem Create(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
|
||||
{
|
||||
return new CollectionItem(_collection0, _collectionitem1, _collectionitem2);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Id.
|
||||
/// </summary>
|
||||
internal int _Id;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetId(int oldValue, ref int newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetId(ref int result);
|
||||
|
||||
/// <summary>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </summary>
|
||||
[Key]
|
||||
[Required]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
int oldValue = _Id;
|
||||
SetId(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required, ConcurrenyToken.
|
||||
/// </summary>
|
||||
[ConcurrencyCheck]
|
||||
[Required]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Required.
|
||||
/// </summary>
|
||||
[ForeignKey("LibraryItem_Id")]
|
||||
public virtual LibraryItem LibraryItem { get; set; }
|
||||
|
||||
/// <remarks>
|
||||
/// TODO check if this properly updated dependant and has the proper principal relationship
|
||||
/// </remarks>
|
||||
[ForeignKey("CollectionItem_Next_Id")]
|
||||
public virtual CollectionItem Next { get; set; }
|
||||
|
||||
/// <remarks>
|
||||
/// TODO check if this properly updated dependant and has the proper principal relationship
|
||||
/// </remarks>
|
||||
[ForeignKey("CollectionItem_Previous_Id")]
|
||||
public virtual CollectionItem Previous { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,157 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class Company
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected Company()
|
||||
{
|
||||
CompanyMetadata = new HashSet<CompanyMetadata>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static Company CreateCompanyUnsafe()
|
||||
{
|
||||
return new Company();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="_moviemetadata0"></param>
|
||||
/// <param name="_seriesmetadata1"></param>
|
||||
/// <param name="_musicalbummetadata2"></param>
|
||||
/// <param name="_bookmetadata3"></param>
|
||||
/// <param name="_company4"></param>
|
||||
public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
|
||||
{
|
||||
if (_moviemetadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_moviemetadata0));
|
||||
}
|
||||
|
||||
_moviemetadata0.Studios.Add(this);
|
||||
|
||||
if (_seriesmetadata1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_seriesmetadata1));
|
||||
}
|
||||
|
||||
_seriesmetadata1.Networks.Add(this);
|
||||
|
||||
if (_musicalbummetadata2 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_musicalbummetadata2));
|
||||
}
|
||||
|
||||
_musicalbummetadata2.Labels.Add(this);
|
||||
|
||||
if (_bookmetadata3 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_bookmetadata3));
|
||||
}
|
||||
|
||||
_bookmetadata3.Publishers.Add(this);
|
||||
|
||||
if (_company4 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_company4));
|
||||
}
|
||||
|
||||
_company4.Parent = this;
|
||||
|
||||
this.CompanyMetadata = new HashSet<CompanyMetadata>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="_moviemetadata0"></param>
|
||||
/// <param name="_seriesmetadata1"></param>
|
||||
/// <param name="_musicalbummetadata2"></param>
|
||||
/// <param name="_bookmetadata3"></param>
|
||||
/// <param name="_company4"></param>
|
||||
public static Company Create(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
|
||||
{
|
||||
return new Company(_moviemetadata0, _seriesmetadata1, _musicalbummetadata2, _bookmetadata3, _company4);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Id.
|
||||
/// </summary>
|
||||
internal int _Id;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetId(int oldValue, ref int newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetId(ref int result);
|
||||
|
||||
/// <summary>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </summary>
|
||||
[Key]
|
||||
[Required]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
int oldValue = _Id;
|
||||
SetId(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required, ConcurrenyToken.
|
||||
/// </summary>
|
||||
[ConcurrencyCheck]
|
||||
[Required]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
[ForeignKey("CompanyMetadata_CompanyMetadata_Id")]
|
||||
public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
|
||||
[ForeignKey("Company_Parent_Id")]
|
||||
public virtual Company Parent { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,230 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class CompanyMetadata : Metadata
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected CompanyMetadata()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static CompanyMetadata CreateCompanyMetadataUnsafe()
|
||||
{
|
||||
return new CompanyMetadata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_company0"></param>
|
||||
public CompanyMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_company0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_company0));
|
||||
}
|
||||
|
||||
_company0.CompanyMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_company0"></param>
|
||||
public static CompanyMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
|
||||
{
|
||||
return new CompanyMetadata(title, language, dateadded, datemodified, _company0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Description.
|
||||
/// </summary>
|
||||
protected string _Description;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Description to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetDescription(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Description to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetDescription(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 65535
|
||||
/// </summary>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Description;
|
||||
GetDescription(ref value);
|
||||
return _Description = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Description;
|
||||
SetDescription(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Description = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Headquarters.
|
||||
/// </summary>
|
||||
protected string _Headquarters;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Headquarters to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetHeadquarters(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Headquarters to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetHeadquarters(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 255
|
||||
/// </summary>
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string Headquarters
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Headquarters;
|
||||
GetHeadquarters(ref value);
|
||||
return _Headquarters = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Headquarters;
|
||||
SetHeadquarters(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Headquarters = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Country.
|
||||
/// </summary>
|
||||
protected string _Country;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Country to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetCountry(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Country to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetCountry(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 2
|
||||
/// </summary>
|
||||
[MaxLength(2)]
|
||||
[StringLength(2)]
|
||||
public string Country
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Country;
|
||||
GetCountry(ref value);
|
||||
return _Country = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Country;
|
||||
SetCountry(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Country = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Homepage.
|
||||
/// </summary>
|
||||
protected string _Homepage;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Homepage to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetHomepage(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Homepage to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetHomepage(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 1024
|
||||
/// </summary>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Homepage
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Homepage;
|
||||
GetHomepage(ref value);
|
||||
return _Homepage = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Homepage;
|
||||
SetHomepage(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Homepage = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
}
|
||||
}
|
||||
|
@ -1,67 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class CustomItem : LibraryItem
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected CustomItem()
|
||||
{
|
||||
CustomItemMetadata = new HashSet<CustomItemMetadata>();
|
||||
Releases = new HashSet<Release>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static CustomItem CreateCustomItemUnsafe()
|
||||
{
|
||||
return new CustomItem();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
|
||||
public CustomItem(Guid urlid, DateTime dateadded)
|
||||
{
|
||||
this.UrlId = urlid;
|
||||
|
||||
this.CustomItemMetadata = new HashSet<CustomItemMetadata>();
|
||||
this.Releases = new HashSet<Release>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
|
||||
public static CustomItem Create(Guid urlid, DateTime dateadded)
|
||||
{
|
||||
return new CustomItem(urlid, dateadded);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
[ForeignKey("CustomItemMetadata_CustomItemMetadata_Id")]
|
||||
public virtual ICollection<CustomItemMetadata> CustomItemMetadata { get; protected set; }
|
||||
|
||||
[ForeignKey("Release_Releases_Id")]
|
||||
public virtual ICollection<Release> Releases { get; protected set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,77 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class CustomItemMetadata : Metadata
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected CustomItemMetadata()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static CustomItemMetadata CreateCustomItemMetadataUnsafe()
|
||||
{
|
||||
return new CustomItemMetadata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_customitem0"></param>
|
||||
public CustomItemMetadata(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_customitem0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_customitem0));
|
||||
}
|
||||
|
||||
_customitem0.CustomItemMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_customitem0"></param>
|
||||
public static CustomItemMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
|
||||
{
|
||||
return new CustomItemMetadata(title, language, dateadded, datemodified, _customitem0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
}
|
||||
}
|
||||
|
@ -1,114 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class Episode : LibraryItem
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected Episode()
|
||||
{
|
||||
// NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
|
||||
// One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
|
||||
|
||||
Releases = new HashSet<Release>();
|
||||
EpisodeMetadata = new HashSet<EpisodeMetadata>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static Episode CreateEpisodeUnsafe()
|
||||
{
|
||||
return new Episode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
|
||||
/// <param name="_season0"></param>
|
||||
public Episode(Guid urlid, DateTime dateadded, Season _season0)
|
||||
{
|
||||
// NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
|
||||
// One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
|
||||
|
||||
this.UrlId = urlid;
|
||||
|
||||
if (_season0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_season0));
|
||||
}
|
||||
|
||||
_season0.Episodes.Add(this);
|
||||
|
||||
this.Releases = new HashSet<Release>();
|
||||
this.EpisodeMetadata = new HashSet<EpisodeMetadata>();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
|
||||
/// <param name="_season0"></param>
|
||||
public static Episode Create(Guid urlid, DateTime dateadded, Season _season0)
|
||||
{
|
||||
return new Episode(urlid, dateadded, _season0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for EpisodeNumber.
|
||||
/// </summary>
|
||||
protected int? _EpisodeNumber;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of EpisodeNumber to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetEpisodeNumber(int? oldValue, ref int? newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of EpisodeNumber to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetEpisodeNumber(ref int? result);
|
||||
|
||||
public int? EpisodeNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
int? value = _EpisodeNumber;
|
||||
GetEpisodeNumber(ref value);
|
||||
return _EpisodeNumber = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int? oldValue = _EpisodeNumber;
|
||||
SetEpisodeNumber(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_EpisodeNumber = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
[ForeignKey("Release_Releases_Id")]
|
||||
public virtual ICollection<Release> Releases { get; protected set; }
|
||||
[ForeignKey("EpisodeMetadata_EpisodeMetadata_Id")]
|
||||
public virtual ICollection<EpisodeMetadata> EpisodeMetadata { get; protected set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,192 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class EpisodeMetadata : Metadata
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected EpisodeMetadata()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static EpisodeMetadata CreateEpisodeMetadataUnsafe()
|
||||
{
|
||||
return new EpisodeMetadata();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_episode0"></param>
|
||||
public EpisodeMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_episode0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_episode0));
|
||||
}
|
||||
|
||||
_episode0.EpisodeMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_episode0"></param>
|
||||
public static EpisodeMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
|
||||
{
|
||||
return new EpisodeMetadata(title, language, dateadded, datemodified, _episode0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Outline.
|
||||
/// </summary>
|
||||
protected string _Outline;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Outline to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetOutline(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Outline to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetOutline(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 1024
|
||||
/// </summary>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Outline
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Outline;
|
||||
GetOutline(ref value);
|
||||
return _Outline = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Outline;
|
||||
SetOutline(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Outline = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Plot.
|
||||
/// </summary>
|
||||
protected string _Plot;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Plot to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetPlot(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Plot to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetPlot(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 65535
|
||||
/// </summary>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Plot
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Plot;
|
||||
GetPlot(ref value);
|
||||
return _Plot = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Plot;
|
||||
SetPlot(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Plot = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Tagline.
|
||||
/// </summary>
|
||||
protected string _Tagline;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Tagline to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetTagline(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Tagline to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetTagline(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Max length = 1024
|
||||
/// </summary>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Tagline
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Tagline;
|
||||
GetTagline(ref value);
|
||||
return _Tagline = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Tagline;
|
||||
SetTagline(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Tagline = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
}
|
||||
}
|
||||
|
@ -1,160 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Jellyfin.Data.Entities
|
||||
{
|
||||
public partial class Genre
|
||||
{
|
||||
partial void Init();
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </summary>
|
||||
protected Genre()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
|
||||
/// </summary>
|
||||
public static Genre CreateGenreUnsafe()
|
||||
{
|
||||
return new Genre();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="_metadata0"></param>
|
||||
public Genre(string name, Metadata _metadata0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
this.Name = name;
|
||||
|
||||
if (_metadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_metadata0));
|
||||
}
|
||||
|
||||
_metadata0.Genres.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="_metadata0"></param>
|
||||
public static Genre Create(string name, Metadata _metadata0)
|
||||
{
|
||||
return new Genre(name, _metadata0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Properties
|
||||
*************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Id.
|
||||
/// </summary>
|
||||
internal int _Id;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetId(int oldValue, ref int newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Id to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetId(ref int result);
|
||||
|
||||
/// <summary>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </summary>
|
||||
[Key]
|
||||
[Required]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
{
|
||||
int oldValue = _Id;
|
||||
SetId(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for Name.
|
||||
/// </summary>
|
||||
internal string _Name;
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Name to be changed before setting.
|
||||
/// </summary>
|
||||
partial void SetName(string oldValue, ref string newValue);
|
||||
/// <summary>
|
||||
/// When provided in a partial class, allows value of Name to be changed before returning.
|
||||
/// </summary>
|
||||
partial void GetName(ref string result);
|
||||
|
||||
/// <summary>
|
||||
/// Indexed, Required, Max length = 255
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
string oldValue = _Name;
|
||||
SetName(oldValue, ref value);
|
||||
if (oldValue != value)
|
||||
{
|
||||
_Name = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required, ConcurrenyToken.
|
||||
/// </summary>
|
||||
[ConcurrencyCheck]
|
||||
[Required]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Navigation properties
|
||||
*************************************************************************/
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing artwork.
|
||||
/// </summary>
|
||||
public class Artwork : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Artwork"/> class.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="kind">The kind of art.</param>
|
||||
/// <param name="owner">The owner.</param>
|
||||
public Artwork(string path, ArtKind kind, IHasArtwork owner)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
Path = path;
|
||||
Kind = kind;
|
||||
|
||||
owner?.Artwork.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Artwork"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected Artwork()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 65535.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the kind of artwork.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public ArtKind Kind { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a book.
|
||||
/// </summary>
|
||||
public class Book : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Book"/> class.
|
||||
/// </summary>
|
||||
public Book()
|
||||
{
|
||||
BookMetadata = new HashSet<BookMetadata>();
|
||||
Releases = new HashSet<Release>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the metadata for this book.
|
||||
/// </summary>
|
||||
public virtual ICollection<BookMetadata> BookMetadata { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; protected set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity containing metadata for a book.
|
||||
/// </summary>
|
||||
public class BookMetadata : Metadata, IHasCompanies
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BookMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="book">The book.</param>
|
||||
public BookMetadata(string title, string language, Book book) : base(title, language)
|
||||
{
|
||||
if (book == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(book));
|
||||
}
|
||||
|
||||
book.BookMetadata.Add(this);
|
||||
|
||||
Publishers = new HashSet<Company>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BookMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected BookMetadata()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ISBN.
|
||||
/// </summary>
|
||||
public long? Isbn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of the publishers for this book.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> Publishers { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[NotMapped]
|
||||
public ICollection<Company> Companies => Publishers;
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a chapter.
|
||||
/// </summary>
|
||||
public class Chapter : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Chapter"/> class.
|
||||
/// </summary>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="startTime">The start time for this chapter.</param>
|
||||
/// <param name="release">The release.</param>
|
||||
public Chapter(string language, long startTime, Release release)
|
||||
{
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
Language = language;
|
||||
StartTime = startTime;
|
||||
|
||||
if (release == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(release));
|
||||
}
|
||||
|
||||
release.Chapters.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Chapter"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected Chapter()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Min length = 3, Max length = 3
|
||||
/// ISO-639-3 3-character language codes.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MinLength(3)]
|
||||
[MaxLength(3)]
|
||||
[StringLength(3)]
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start time.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public long StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end time.
|
||||
/// </summary>
|
||||
public long? EndTime { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a collection.
|
||||
/// </summary>
|
||||
public class Collection : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Collection"/> class.
|
||||
/// </summary>
|
||||
public Collection()
|
||||
{
|
||||
Items = new HashSet<CollectionItem>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing this collection's items.
|
||||
/// </summary>
|
||||
public virtual ICollection<CollectionItem> Items { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a collection item.
|
||||
/// </summary>
|
||||
public class CollectionItem : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CollectionItem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="collection">The collection.</param>
|
||||
/// <param name="previous">The previous item.</param>
|
||||
/// <param name="next">The next item.</param>
|
||||
public CollectionItem(Collection collection, CollectionItem previous, CollectionItem next)
|
||||
{
|
||||
if (collection == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(collection));
|
||||
}
|
||||
|
||||
collection.Items.Add(this);
|
||||
|
||||
if (next != null)
|
||||
{
|
||||
Next = next;
|
||||
next.Previous = this;
|
||||
}
|
||||
|
||||
if (previous != null)
|
||||
{
|
||||
Previous = previous;
|
||||
previous.Next = this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CollectionItem"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected CollectionItem()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public virtual LibraryItem LibraryItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the next item in the collection.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO check if this properly updated dependant and has the proper principal relationship
|
||||
/// </remarks>
|
||||
public virtual CollectionItem Next { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the previous item in the collection.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO check if this properly updated dependant and has the proper principal relationship
|
||||
/// </remarks>
|
||||
public virtual CollectionItem Previous { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a company.
|
||||
/// </summary>
|
||||
public class Company : IHasCompanies, IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Company"/> class.
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of this company.</param>
|
||||
public Company(IHasCompanies owner)
|
||||
{
|
||||
owner?.Companies.Add(this);
|
||||
|
||||
CompanyMetadata = new HashSet<CompanyMetadata>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Company"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected Company()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing this company's child companies.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> ChildCompanies { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[NotMapped]
|
||||
public ICollection<Company> Companies => ChildCompanies;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity holding metadata for a <see cref="Company"/>.
|
||||
/// </summary>
|
||||
public class CompanyMetadata : Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CompanyMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="company">The company.</param>
|
||||
public CompanyMetadata(string title, string language, Company company) : base(title, language)
|
||||
{
|
||||
if (company == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(company));
|
||||
}
|
||||
|
||||
company.CompanyMetadata.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CompanyMetadata"/> class.
|
||||
/// </summary>
|
||||
protected CompanyMetadata()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the headquarters.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 255.
|
||||
/// </remarks>
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string Headquarters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the country code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 2.
|
||||
/// </remarks>
|
||||
[MaxLength(2)]
|
||||
[StringLength(2)]
|
||||
public string Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the homepage.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Homepage { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a custom item.
|
||||
/// </summary>
|
||||
public class CustomItem : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomItem"/> class.
|
||||
/// </summary>
|
||||
public CustomItem()
|
||||
{
|
||||
CustomItemMetadata = new HashSet<CustomItemMetadata>();
|
||||
Releases = new HashSet<Release>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the metadata for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<CustomItemMetadata> CustomItemMetadata { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; protected set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity containing metadata for a custom item.
|
||||
/// </summary>
|
||||
public class CustomItemMetadata : Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomItemMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
public CustomItemMetadata(string title, string language, CustomItem item) : base(title, language)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
|
||||
item.CustomItemMetadata.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomItemMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected CustomItemMetadata()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing an episode.
|
||||
/// </summary>
|
||||
public class Episode : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Episode"/> class.
|
||||
/// </summary>
|
||||
/// <param name="season">The season.</param>
|
||||
public Episode(Season season)
|
||||
{
|
||||
if (season == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(season));
|
||||
}
|
||||
|
||||
season.Episodes.Add(this);
|
||||
|
||||
Releases = new HashSet<Release>();
|
||||
EpisodeMetadata = new HashSet<EpisodeMetadata>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Episode"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected Episode()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode number.
|
||||
/// </summary>
|
||||
public int? EpisodeNumber { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the metadata for this episode.
|
||||
/// </summary>
|
||||
public virtual ICollection<EpisodeMetadata> EpisodeMetadata { get; protected set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity containing metadata for an <see cref="Episode"/>.
|
||||
/// </summary>
|
||||
public class EpisodeMetadata : Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EpisodeMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="episode">The episode.</param>
|
||||
public EpisodeMetadata(string title, string language, Episode episode) : base(title, language)
|
||||
{
|
||||
if (episode == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(episode));
|
||||
}
|
||||
|
||||
episode.EpisodeMetadata.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EpisodeMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected EpisodeMetadata()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the outline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Outline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the plot.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Plot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tagline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Tagline { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a genre.
|
||||
/// </summary>
|
||||
public class Genre : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Genre"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="metadata">The metadata.</param>
|
||||
public Genre(string name, Metadata metadata)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
Name = name;
|
||||
|
||||
if (metadata == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(metadata));
|
||||
}
|
||||
|
||||
metadata.Genres.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Genre"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected Genre()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Indexed, Required, Max length = 255.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a library.
|
||||
/// </summary>
|
||||
public class Library : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Library"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the library.</param>
|
||||
public Library(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Library"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected Library()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 128.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MaxLength(128)]
|
||||
[StringLength(128)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the root path of the library.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a library item.
|
||||
/// </summary>
|
||||
public abstract class LibraryItem : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryItem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library of this item.</param>
|
||||
protected LibraryItem(Library library)
|
||||
{
|
||||
DateAdded = DateTime.UtcNow;
|
||||
Library = library;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryItem"/> class.
|
||||
/// </summary>
|
||||
protected LibraryItem()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date this library item was added.
|
||||
/// </summary>
|
||||
public DateTime DateAdded { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library of this item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
public virtual Library Library { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a file on disk.
|
||||
/// </summary>
|
||||
public class MediaFile : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaFile"/> class.
|
||||
/// </summary>
|
||||
/// <param name="path">The path relative to the LibraryRoot.</param>
|
||||
/// <param name="kind">The file kind.</param>
|
||||
/// <param name="release">The release.</param>
|
||||
public MediaFile(string path, MediaFileKind kind, Release release)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
Path = path;
|
||||
Kind = kind;
|
||||
|
||||
if (release == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(release));
|
||||
}
|
||||
|
||||
release.MediaFiles.Add(this);
|
||||
|
||||
MediaFileStreams = new HashSet<MediaFileStream>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaFile"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected MediaFile()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path relative to the library root.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 65535.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the kind of media file.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public MediaFileKind Kind { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the streams in this file.
|
||||
/// </summary>
|
||||
public virtual ICollection<MediaFileStream> MediaFileStreams { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a stream in a media file.
|
||||
/// </summary>
|
||||
public class MediaFileStream : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaFileStream"/> class.
|
||||
/// </summary>
|
||||
/// <param name="streamNumber">The number of this stream.</param>
|
||||
/// <param name="mediaFile">The media file.</param>
|
||||
public MediaFileStream(int streamNumber, MediaFile mediaFile)
|
||||
{
|
||||
StreamNumber = streamNumber;
|
||||
|
||||
if (mediaFile == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mediaFile));
|
||||
}
|
||||
|
||||
mediaFile.MediaFileStreams.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaFileStream"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected MediaFileStream()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the stream number.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public int StreamNumber { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An abstract class that holds metadata.
|
||||
/// </summary>
|
||||
public abstract class Metadata : IHasArtwork, IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Metadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
protected Metadata(string title, string language)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
Title = title;
|
||||
Language = language;
|
||||
DateAdded = DateTime.UtcNow;
|
||||
DateModified = DateAdded;
|
||||
|
||||
PersonRoles = new HashSet<PersonRole>();
|
||||
Genres = new HashSet<Genre>();
|
||||
Artwork = new HashSet<Artwork>();
|
||||
Ratings = new HashSet<Rating>();
|
||||
Sources = new HashSet<MetadataProviderId>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Metadata"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to being abstract.
|
||||
/// </remarks>
|
||||
protected Metadata()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 1024.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the original title.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sort title.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string SortTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Min length = 3, Max length = 3.
|
||||
/// ISO-639-3 3-character language codes.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MinLength(3)]
|
||||
[MaxLength(3)]
|
||||
[StringLength(3)]
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release date.
|
||||
/// </summary>
|
||||
public DateTimeOffset? ReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date added.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public DateTime DateAdded { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date modified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the row version.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, ConcurrencyToken.
|
||||
/// </remarks>
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the person roles for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<PersonRole> PersonRoles { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the generes for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<Genre> Genres { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Artwork> Artwork { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the ratings for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<Rating> Ratings { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the metadata sources for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a metadata provider.
|
||||
/// </summary>
|
||||
public class MetadataProvider : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetadataProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the metadata provider.</param>
|
||||
public MetadataProvider(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetadataProvider"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected MetadataProvider()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 1024.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a unique identifier for a metadata provider.
|
||||
/// </summary>
|
||||
public class MetadataProviderId : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetadataProviderId"/> class.
|
||||
/// </summary>
|
||||
/// <param name="providerId">The provider id.</param>
|
||||
/// <param name="metadata">The metadata entity.</param>
|
||||
public MetadataProviderId(string providerId, Metadata metadata)
|
||||
{
|
||||
if (string.IsNullOrEmpty(providerId))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(providerId));
|
||||
}
|
||||
|
||||
ProviderId = providerId;
|
||||
|
||||
if (metadata == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(metadata));
|
||||
}
|
||||
|
||||
metadata.Sources.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetadataProviderId"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected MetadataProviderId()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the provider id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 255.
|
||||
/// </remarks>
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string ProviderId { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the metadata provider.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public virtual MetadataProvider MetadataProvider { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a movie.
|
||||
/// </summary>
|
||||
public class Movie : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Movie"/> class.
|
||||
/// </summary>
|
||||
public Movie()
|
||||
{
|
||||
Releases = new HashSet<Release>();
|
||||
MovieMetadata = new HashSet<MovieMetadata>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the metadata for this movie.
|
||||
/// </summary>
|
||||
public virtual ICollection<MovieMetadata> MovieMetadata { get; protected set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity holding the metadata for a movie.
|
||||
/// </summary>
|
||||
public class MovieMetadata : Metadata, IHasCompanies
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MovieMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the movie.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="movie">The movie.</param>
|
||||
public MovieMetadata(string title, string language, Movie movie) : base(title, language)
|
||||
{
|
||||
Studios = new HashSet<Company>();
|
||||
|
||||
movie.MovieMetadata.Add(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MovieMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||
/// </remarks>
|
||||
protected MovieMetadata()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the outline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Outline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tagline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Tagline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the plot.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Plot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the country code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 2.
|
||||
/// </remarks>
|
||||
[MaxLength(2)]
|
||||
[StringLength(2)]
|
||||
public string Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the studios that produced this movie.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> Studios { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[NotMapped]
|
||||
public ICollection<Company> Companies => Studios;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a music album.
|
||||
/// </summary>
|
||||
public class MusicAlbum : LibraryItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MusicAlbum"/> class.
|
||||
/// </summary>
|
||||
public MusicAlbum()
|
||||
{
|
||||
MusicAlbumMetadata = new HashSet<MusicAlbumMetadata>();
|
||||
Tracks = new HashSet<Track>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the album metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<MusicAlbumMetadata> MusicAlbumMetadata { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection containing the tracks.
|
||||
/// </summary>
|
||||
public virtual ICollection<Track> Tracks { get; protected set; }
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue