commit
b5586e64f5
|
@ -117,12 +117,19 @@ namespace DvdLib.Ifo
|
|||
uint chapNum = 1;
|
||||
vtsFs.Seek(baseAddr + offsets[titleNum], SeekOrigin.Begin);
|
||||
var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum + 1));
|
||||
if (t == null) continue;
|
||||
if (t == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
t.Chapters.Add(new Chapter(vtsRead.ReadUInt16(), vtsRead.ReadUInt16(), chapNum));
|
||||
if (titleNum + 1 < numTitles && vtsFs.Position == (baseAddr + offsets[titleNum + 1])) break;
|
||||
if (titleNum + 1 < numTitles && vtsFs.Position == (baseAddr + offsets[titleNum + 1]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
chapNum++;
|
||||
}
|
||||
while (vtsFs.Position < (baseAddr + endaddr));
|
||||
|
@ -147,7 +154,10 @@ namespace DvdLib.Ifo
|
|||
uint vtsPgcOffset = vtsRead.ReadUInt32();
|
||||
|
||||
var t = Titles.FirstOrDefault(vtst => vtst.IsVTSTitle(vtsNum, titleNum));
|
||||
if (t != null) t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum);
|
||||
if (t != null)
|
||||
{
|
||||
t.AddPgc(vtsRead, startByte + vtsPgcOffset, entryPgc, pgcNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,14 @@ namespace DvdLib.Ifo
|
|||
Second = GetBCDValue(data[2]);
|
||||
Frames = GetBCDValue((byte)(data[3] & 0x3F));
|
||||
|
||||
if ((data[3] & 0x80) != 0) FrameRate = 30;
|
||||
else if ((data[3] & 0x40) != 0) FrameRate = 25;
|
||||
if ((data[3] & 0x80) != 0)
|
||||
{
|
||||
FrameRate = 30;
|
||||
}
|
||||
else if ((data[3] & 0x40) != 0)
|
||||
{
|
||||
FrameRate = 25;
|
||||
}
|
||||
}
|
||||
|
||||
private static byte GetBCDValue(byte data)
|
||||
|
|
|
@ -75,8 +75,15 @@ namespace DvdLib.Ifo
|
|||
|
||||
StillTime = br.ReadByte();
|
||||
byte pbMode = br.ReadByte();
|
||||
if (pbMode == 0) PlaybackMode = ProgramPlaybackMode.Sequential;
|
||||
else PlaybackMode = ((pbMode & 0x80) == 0) ? ProgramPlaybackMode.Random : ProgramPlaybackMode.Shuffle;
|
||||
if (pbMode == 0)
|
||||
{
|
||||
PlaybackMode = ProgramPlaybackMode.Sequential;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaybackMode = ((pbMode & 0x80) == 0) ? ProgramPlaybackMode.Random : ProgramPlaybackMode.Shuffle;
|
||||
}
|
||||
|
||||
ProgramCount = (uint)(pbMode & 0x7F);
|
||||
|
||||
Palette = br.ReadBytes(64);
|
||||
|
|
|
@ -59,7 +59,10 @@ namespace DvdLib.Ifo
|
|||
var pgc = new ProgramChain(pgcNum);
|
||||
pgc.ParseHeader(br);
|
||||
ProgramChains.Add(pgc);
|
||||
if (entryPgc) EntryProgramChain = pgc;
|
||||
if (entryPgc)
|
||||
{
|
||||
EntryProgramChain = pgc;
|
||||
}
|
||||
|
||||
br.BaseStream.Seek(curPos, SeekOrigin.Begin);
|
||||
}
|
||||
|
|
|
@ -140,55 +140,73 @@ namespace Emby.Dlna
|
|||
if (!string.IsNullOrEmpty(profileInfo.DeviceDescription))
|
||||
{
|
||||
if (deviceInfo.DeviceDescription == null || !IsRegexMatch(deviceInfo.DeviceDescription, profileInfo.DeviceDescription))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.FriendlyName))
|
||||
{
|
||||
if (deviceInfo.FriendlyName == null || !IsRegexMatch(deviceInfo.FriendlyName, profileInfo.FriendlyName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.Manufacturer))
|
||||
{
|
||||
if (deviceInfo.Manufacturer == null || !IsRegexMatch(deviceInfo.Manufacturer, profileInfo.Manufacturer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.ManufacturerUrl))
|
||||
{
|
||||
if (deviceInfo.ManufacturerUrl == null || !IsRegexMatch(deviceInfo.ManufacturerUrl, profileInfo.ManufacturerUrl))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.ModelDescription))
|
||||
{
|
||||
if (deviceInfo.ModelDescription == null || !IsRegexMatch(deviceInfo.ModelDescription, profileInfo.ModelDescription))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.ModelName))
|
||||
{
|
||||
if (deviceInfo.ModelName == null || !IsRegexMatch(deviceInfo.ModelName, profileInfo.ModelName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.ModelNumber))
|
||||
{
|
||||
if (deviceInfo.ModelNumber == null || !IsRegexMatch(deviceInfo.ModelNumber, profileInfo.ModelNumber))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.ModelUrl))
|
||||
{
|
||||
if (deviceInfo.ModelUrl == null || !IsRegexMatch(deviceInfo.ModelUrl, profileInfo.ModelUrl))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(profileInfo.SerialNumber))
|
||||
{
|
||||
if (deviceInfo.SerialNumber == null || !IsRegexMatch(deviceInfo.SerialNumber, profileInfo.SerialNumber))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,8 +19,6 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
public class Device : IDisposable
|
||||
{
|
||||
#region Fields & Properties
|
||||
|
||||
private Timer _timer;
|
||||
|
||||
public DeviceInfo Properties { get; set; }
|
||||
|
@ -53,10 +51,10 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
public bool IsStopped => TransportState == TRANSPORTSTATE.STOPPED;
|
||||
|
||||
#endregion
|
||||
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
public Action OnDeviceUnavailable { get; set; }
|
||||
|
@ -142,8 +140,6 @@ namespace Emby.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
#region Commanding
|
||||
|
||||
public Task VolumeDown(CancellationToken cancellationToken)
|
||||
{
|
||||
var sendVolume = Math.Max(Volume - 5, 0);
|
||||
|
@ -212,7 +208,9 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var command = rendererCommands.ServiceActions.FirstOrDefault(c => c.Name == "SetMute");
|
||||
if (command == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var service = GetServiceRenderingControl();
|
||||
|
||||
|
@ -241,7 +239,9 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var command = rendererCommands.ServiceActions.FirstOrDefault(c => c.Name == "SetVolume");
|
||||
if (command == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var service = GetServiceRenderingControl();
|
||||
|
||||
|
@ -264,7 +264,9 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Seek");
|
||||
if (command == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var service = GetAvTransportService();
|
||||
|
||||
|
@ -289,7 +291,9 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "SetAVTransportURI");
|
||||
if (command == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var dictionary = new Dictionary<string, string>
|
||||
{
|
||||
|
@ -402,11 +406,8 @@ namespace Emby.Dlna.PlayTo
|
|||
RestartTimer(true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Get data
|
||||
|
||||
private int _connectFailureCount;
|
||||
|
||||
private async void TimerCallback(object sender)
|
||||
{
|
||||
if (_disposed)
|
||||
|
@ -459,7 +460,9 @@ namespace Emby.Dlna.PlayTo
|
|||
_connectFailureCount = 0;
|
||||
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're not playing anything make sure we don't get data more often than neccessry to keep the Session alive
|
||||
if (transportState.Value == TRANSPORTSTATE.STOPPED)
|
||||
|
@ -479,7 +482,9 @@ namespace Emby.Dlna.PlayTo
|
|||
catch (Exception ex)
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogError(ex, "Error updating device info for {DeviceName}", Properties.Name);
|
||||
|
||||
|
@ -580,7 +585,9 @@ namespace Emby.Dlna.PlayTo
|
|||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null || result.Document == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var valueNode = result.Document.Descendants(uPnpNamespaces.RenderingControl + "GetMuteResponse")
|
||||
.Select(i => i.Element("CurrentMute"))
|
||||
|
@ -870,10 +877,6 @@ namespace Emby.Dlna.PlayTo
|
|||
return new string[4];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region From XML
|
||||
|
||||
private async Task<TransportCommands> GetAVProtocolAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (AvCommands != null)
|
||||
|
@ -1068,8 +1071,6 @@ namespace Emby.Dlna.PlayTo
|
|||
return new Device(deviceProperties, httpClient, logger, config);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||
private static DeviceIcon CreateIcon(XElement element)
|
||||
{
|
||||
|
@ -1193,8 +1194,6 @@ namespace Emby.Dlna.PlayTo
|
|||
});
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
bool _disposed;
|
||||
|
||||
public void Dispose()
|
||||
|
@ -1221,8 +1220,6 @@ namespace Emby.Dlna.PlayTo
|
|||
_disposed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
|
||||
|
|
|
@ -78,9 +78,15 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var info = e.Argument;
|
||||
|
||||
if (!info.Headers.TryGetValue("USN", out string usn)) usn = string.Empty;
|
||||
if (!info.Headers.TryGetValue("USN", out string usn))
|
||||
{
|
||||
usn = string.Empty;
|
||||
}
|
||||
|
||||
if (!info.Headers.TryGetValue("NT", out string nt)) nt = string.Empty;
|
||||
if (!info.Headers.TryGetValue("NT", out string nt))
|
||||
{
|
||||
nt = string.Empty;
|
||||
}
|
||||
|
||||
string location = info.Location.ToString();
|
||||
|
||||
|
|
|
@ -2775,22 +2775,85 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
private string FixUnicodeChars(string buffer)
|
||||
{
|
||||
if (buffer.IndexOf('\u2013') > -1) buffer = buffer.Replace('\u2013', '-'); // en dash
|
||||
if (buffer.IndexOf('\u2014') > -1) buffer = buffer.Replace('\u2014', '-'); // em dash
|
||||
if (buffer.IndexOf('\u2015') > -1) buffer = buffer.Replace('\u2015', '-'); // horizontal bar
|
||||
if (buffer.IndexOf('\u2017') > -1) buffer = buffer.Replace('\u2017', '_'); // double low line
|
||||
if (buffer.IndexOf('\u2018') > -1) buffer = buffer.Replace('\u2018', '\''); // left single quotation mark
|
||||
if (buffer.IndexOf('\u2019') > -1) buffer = buffer.Replace('\u2019', '\''); // right single quotation mark
|
||||
if (buffer.IndexOf('\u201a') > -1) buffer = buffer.Replace('\u201a', ','); // single low-9 quotation mark
|
||||
if (buffer.IndexOf('\u201b') > -1) buffer = buffer.Replace('\u201b', '\''); // single high-reversed-9 quotation mark
|
||||
if (buffer.IndexOf('\u201c') > -1) buffer = buffer.Replace('\u201c', '\"'); // left double quotation mark
|
||||
if (buffer.IndexOf('\u201d') > -1) buffer = buffer.Replace('\u201d', '\"'); // right double quotation mark
|
||||
if (buffer.IndexOf('\u201e') > -1) buffer = buffer.Replace('\u201e', '\"'); // double low-9 quotation mark
|
||||
if (buffer.IndexOf('\u2026') > -1) buffer = buffer.Replace("\u2026", "..."); // horizontal ellipsis
|
||||
if (buffer.IndexOf('\u2032') > -1) buffer = buffer.Replace('\u2032', '\''); // prime
|
||||
if (buffer.IndexOf('\u2033') > -1) buffer = buffer.Replace('\u2033', '\"'); // double prime
|
||||
if (buffer.IndexOf('\u0060') > -1) buffer = buffer.Replace('\u0060', '\''); // grave accent
|
||||
if (buffer.IndexOf('\u00B4') > -1) buffer = buffer.Replace('\u00B4', '\''); // acute accent
|
||||
if (buffer.IndexOf('\u2013') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2013', '-'); // en dash
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2014') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2014', '-'); // em dash
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2015') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2015', '-'); // horizontal bar
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2017') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2017', '_'); // double low line
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2018') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2018', '\''); // left single quotation mark
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2019') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2019', '\''); // right single quotation mark
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u201a') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u201a', ','); // single low-9 quotation mark
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u201b') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u201b', '\''); // single high-reversed-9 quotation mark
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u201c') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u201c', '\"'); // left double quotation mark
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u201d') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u201d', '\"'); // right double quotation mark
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u201e') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u201e', '\"'); // double low-9 quotation mark
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2026') > -1)
|
||||
{
|
||||
buffer = buffer.Replace("\u2026", "..."); // horizontal ellipsis
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2032') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2032', '\''); // prime
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u2033') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u2033', '\"'); // double prime
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u0060') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u0060', '\''); // grave accent
|
||||
}
|
||||
|
||||
if (buffer.IndexOf('\u00B4') > -1)
|
||||
{
|
||||
buffer = buffer.Replace('\u00B4', '\''); // acute accent
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -6308,7 +6371,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
/// Gets the attachment.
|
||||
/// </summary>
|
||||
/// <param name="reader">The reader.</param>
|
||||
/// <returns>MediaAttachment</returns>
|
||||
/// <returns>MediaAttachment.</returns>
|
||||
private MediaAttachment GetMediaAttachment(IReadOnlyList<IResultSetValue> reader)
|
||||
{
|
||||
var item = new MediaAttachment
|
||||
|
|
|
@ -426,7 +426,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||
/// </summary>
|
||||
private object GetCachedResult(IRequest requestContext, IDictionary<string, string> responseHeaders, StaticResultOptions options)
|
||||
{
|
||||
bool noCache = (requestContext.Headers[HeaderNames.CacheControl].ToString()).IndexOf("no-cache", StringComparison.OrdinalIgnoreCase) != -1;
|
||||
bool noCache = requestContext.Headers[HeaderNames.CacheControl].ToString().IndexOf("no-cache", StringComparison.OrdinalIgnoreCase) != -1;
|
||||
AddCachingHeaders(responseHeaders, options.CacheDuration, noCache, options.DateLastModified);
|
||||
|
||||
if (!noCache)
|
||||
|
|
|
@ -41,11 +41,11 @@ namespace Emby.Server.Implementations.HttpServer
|
|||
res.Headers.Add(key, value);
|
||||
}
|
||||
// Try to prevent compatibility view
|
||||
res.Headers["Access-Control-Allow-Headers"] = ("Accept, Accept-Language, Authorization, Cache-Control, " +
|
||||
res.Headers["Access-Control-Allow-Headers"] = "Accept, Accept-Language, Authorization, Cache-Control, " +
|
||||
"Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, " +
|
||||
"Content-Type, Cookie, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, " +
|
||||
"Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, " +
|
||||
"X-Emby-Authorization");
|
||||
"X-Emby-Authorization";
|
||||
|
||||
if (dto is Exception exception)
|
||||
{
|
||||
|
|
|
@ -136,7 +136,7 @@ namespace Emby.Server.Implementations.Library
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="appHost">The application host</param>
|
||||
/// <param name="appHost">The application host.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
|
@ -1793,7 +1793,7 @@ namespace Emby.Server.Implementations.Library
|
|||
/// Creates the items.
|
||||
/// </summary>
|
||||
/// <param name="items">The items.</param>
|
||||
/// <param name="parent">The parent item</param>
|
||||
/// <param name="parent">The parent item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
public void CreateItems(IEnumerable<BaseItem> items, BaseItem parent, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
|
|||
|
||||
// Only process items that are in a collection folder containing books
|
||||
if (!string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.IsDirectory)
|
||||
{
|
||||
|
@ -55,7 +57,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
|
|||
|
||||
// Don't return a Book if there is more (or less) than one document in the directory
|
||||
if (bookFiles.Count != 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Book
|
||||
{
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||
/// </summary>
|
||||
/// <param name="config">The config.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="localization">The localization</param>
|
||||
/// <param name="logger">The logger</param>
|
||||
/// <param name="localization">The localization.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public SeasonResolver(
|
||||
IServerConfigurationManager config,
|
||||
ILibraryManager libraryManager,
|
||||
|
|
|
@ -201,7 +201,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
var index = line.IndexOf("Channel", StringComparison.OrdinalIgnoreCase);
|
||||
var name = line.Substring(0, index - 1);
|
||||
var currentChannel = line.Substring(index + 7);
|
||||
if (currentChannel != "none") { status = LiveTvTunerStatus.LiveTv; } else { status = LiveTvTunerStatus.Available; }
|
||||
if (currentChannel != "none")
|
||||
{
|
||||
status = LiveTvTunerStatus.LiveTv;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = LiveTvTunerStatus.Available;
|
||||
}
|
||||
|
||||
tuners.Add(new LiveTvTunerInfo
|
||||
{
|
||||
|
@ -691,7 +698,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
{
|
||||
var model = ModelNumber ?? string.Empty;
|
||||
|
||||
if ((model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1))
|
||||
if (model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"Albums": "專輯",
|
||||
"AppDeviceValues": "軟件: {0}, 設備: {1}",
|
||||
"AppDeviceValues": "程式: {0}, 設備: {1}",
|
||||
"Application": "應用程式",
|
||||
"Artists": "藝人",
|
||||
"AuthenticationSucceededWithUserName": "{0} 授權成功",
|
||||
|
@ -113,5 +113,6 @@
|
|||
"TaskCleanCacheDescription": "刪除系統不再需要的緩存文件。",
|
||||
"TaskCleanCache": "清理緩存目錄",
|
||||
"TasksChannelsCategory": "互聯網頻道",
|
||||
"TasksLibraryCategory": "庫"
|
||||
"TasksLibraryCategory": "庫",
|
||||
"TaskRefreshPeople": "刷新人物"
|
||||
}
|
||||
|
|
|
@ -37,7 +37,10 @@ namespace Emby.Server.Implementations.Net
|
|||
|
||||
public UdpSocket(Socket socket, int localPort, IPAddress ip)
|
||||
{
|
||||
if (socket == null) throw new ArgumentNullException(nameof(socket));
|
||||
if (socket == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(socket));
|
||||
}
|
||||
|
||||
_socket = socket;
|
||||
_localPort = localPort;
|
||||
|
@ -103,7 +106,10 @@ namespace Emby.Server.Implementations.Net
|
|||
|
||||
public UdpSocket(Socket socket, IPEndPoint endPoint)
|
||||
{
|
||||
if (socket == null) throw new ArgumentNullException(nameof(socket));
|
||||
if (socket == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(socket));
|
||||
}
|
||||
|
||||
_socket = socket;
|
||||
_socket.Connect(endPoint);
|
||||
|
|
|
@ -539,13 +539,21 @@ namespace Emby.Server.Implementations.Playlists
|
|||
|
||||
private static string UnEscape(string content)
|
||||
{
|
||||
if (content == null) return content;
|
||||
if (content == null)
|
||||
{
|
||||
return content;
|
||||
}
|
||||
|
||||
return content.Replace("&", "&").Replace("'", "'").Replace(""", "\"").Replace(">", ">").Replace("<", "<");
|
||||
}
|
||||
|
||||
private static string Escape(string content)
|
||||
{
|
||||
if (content == null) return null;
|
||||
if (content == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return content.Replace("&", "&").Replace("'", "'").Replace("\"", """).Replace(">", ">").Replace("<", "<");
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||
/// Queues the scheduled task.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="options">Task options</param>
|
||||
/// <param name="options">Task options.</param>
|
||||
public void QueueScheduledTask<T>(TaskOptions options)
|
||||
where T : IScheduledTask
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.Security
|
|||
statement.TryBind("@AppName", info.AppName);
|
||||
statement.TryBind("@AppVersion", info.AppVersion);
|
||||
statement.TryBind("@DeviceName", info.DeviceName);
|
||||
statement.TryBind("@UserId", (info.UserId.Equals(Guid.Empty) ? null : info.UserId.ToString("N", CultureInfo.InvariantCulture)));
|
||||
statement.TryBind("@UserId", info.UserId.Equals(Guid.Empty) ? null : info.UserId.ToString("N", CultureInfo.InvariantCulture));
|
||||
statement.TryBind("@UserName", info.UserName);
|
||||
statement.TryBind("@IsActive", true);
|
||||
statement.TryBind("@DateCreated", info.DateCreated.ToDateTimeParamValue());
|
||||
|
@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.Security
|
|||
statement.TryBind("@AppName", info.AppName);
|
||||
statement.TryBind("@AppVersion", info.AppVersion);
|
||||
statement.TryBind("@DeviceName", info.DeviceName);
|
||||
statement.TryBind("@UserId", (info.UserId.Equals(Guid.Empty) ? null : info.UserId.ToString("N", CultureInfo.InvariantCulture)));
|
||||
statement.TryBind("@UserId", info.UserId.Equals(Guid.Empty) ? null : info.UserId.ToString("N", CultureInfo.InvariantCulture));
|
||||
statement.TryBind("@UserName", info.UserName);
|
||||
statement.TryBind("@DateCreated", info.DateCreated.ToDateTimeParamValue());
|
||||
statement.TryBind("@DateLastActivity", info.DateLastActivity.ToDateTimeParamValue());
|
||||
|
|
|
@ -40,7 +40,9 @@ namespace Emby.Server.Implementations.Services
|
|||
if (httpResult != null)
|
||||
{
|
||||
if (httpResult.RequestContext == null)
|
||||
{
|
||||
httpResult.RequestContext = request;
|
||||
}
|
||||
|
||||
response.StatusCode = httpResult.Status;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,10 @@ namespace Emby.Server.Implementations.Services
|
|||
var yieldedWildcardMatches = RestPath.GetFirstMatchWildCardHashKeys(matchUsingPathParts);
|
||||
foreach (var potentialHashMatch in yieldedWildcardMatches)
|
||||
{
|
||||
if (!this.RestPathMap.TryGetValue(potentialHashMatch, out firstMatches)) continue;
|
||||
if (!this.RestPathMap.TryGetValue(potentialHashMatch, out firstMatches))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var bestScore = -1;
|
||||
RestPath bestMatch = null;
|
||||
|
|
|
@ -42,11 +42,15 @@ namespace Emby.Server.Implementations.Services
|
|||
}
|
||||
|
||||
if (mi.GetParameters().Length != 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var actionName = mi.Name;
|
||||
if (!AllVerbs.Contains(actionName, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
list.Add(mi);
|
||||
}
|
||||
|
@ -63,7 +67,10 @@ namespace Emby.Server.Implementations.Services
|
|||
{
|
||||
foreach (var actionCtx in actions)
|
||||
{
|
||||
if (execMap.ContainsKey(actionCtx.Id)) continue;
|
||||
if (execMap.ContainsKey(actionCtx.Id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
execMap[actionCtx.Id] = actionCtx;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,10 @@ namespace Emby.Server.Implementations.Services
|
|||
var hasSeparators = new List<bool>();
|
||||
foreach (var component in this.restPath.Split(PathSeperatorChar))
|
||||
{
|
||||
if (string.IsNullOrEmpty(component)) continue;
|
||||
if (string.IsNullOrEmpty(component))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (component.IndexOf(VariablePrefix, StringComparison.OrdinalIgnoreCase) != -1
|
||||
&& component.IndexOf(ComponentSeperator) != -1)
|
||||
|
@ -302,9 +305,9 @@ namespace Emby.Server.Implementations.Services
|
|||
}
|
||||
|
||||
// Routes with least wildcard matches get the highest score
|
||||
var score = Math.Max((100 - wildcardMatchCount), 1) * 1000
|
||||
var score = Math.Max(100 - wildcardMatchCount, 1) * 1000
|
||||
// Routes with less variable (and more literal) matches
|
||||
+ Math.Max((10 - VariableArgsCount), 1) * 100;
|
||||
+ Math.Max(10 - VariableArgsCount, 1) * 100;
|
||||
|
||||
// Exact verb match is better than ANY
|
||||
if (Verbs.Length == 1 && string.Equals(httpMethod, Verbs[0], StringComparison.OrdinalIgnoreCase))
|
||||
|
@ -442,12 +445,14 @@ namespace Emby.Server.Implementations.Services
|
|||
&& requestComponents.Length >= this.TotalComponentsCount - this.wildcardCount;
|
||||
|
||||
if (!isValidWildCardPath)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"Path Mismatch: Request Path '{0}' has invalid number of components compared to: '{1}'",
|
||||
pathInfo,
|
||||
this.restPath));
|
||||
}
|
||||
}
|
||||
|
||||
var requestKeyValuesMap = new Dictionary<string, string>();
|
||||
|
|
|
@ -19,10 +19,14 @@ namespace Emby.Server.Implementations.Sorting
|
|||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(x));
|
||||
}
|
||||
|
||||
if (y == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(y));
|
||||
}
|
||||
|
||||
return DateTime.Compare(x.DateCreated, y.DateCreated);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,14 @@ namespace Emby.Server.Implementations.Sorting
|
|||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(x));
|
||||
}
|
||||
|
||||
if (y == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(y));
|
||||
}
|
||||
|
||||
return (x.RunTimeTicks ?? 0).CompareTo(y.RunTimeTicks ?? 0);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,14 @@ namespace Emby.Server.Implementations.Sorting
|
|||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
if (x == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(x));
|
||||
}
|
||||
|
||||
if (y == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(y));
|
||||
}
|
||||
|
||||
return string.Compare(x.SortName, y.SortName, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
|
|
@ -101,11 +101,18 @@ namespace Emby.Server.Implementations.Udp
|
|||
{
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
var infiniteTask = Task.Delay(-1, cancellationToken);
|
||||
try
|
||||
{
|
||||
var result = await _udpSocket.ReceiveFromAsync(_receiveBuffer, SocketFlags.None, _endpoint).ConfigureAwait(false);
|
||||
var task = _udpSocket.ReceiveFromAsync(_receiveBuffer, SocketFlags.None, _endpoint);
|
||||
await Task.WhenAny(task, infiniteTask).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (!task.IsCompleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var result = task.Result;
|
||||
|
||||
var text = Encoding.UTF8.GetString(_receiveBuffer, 0, result.ReceivedBytes);
|
||||
if (text.Contains("who is JellyfinServer?", StringComparison.OrdinalIgnoreCase))
|
||||
|
|
|
@ -32,17 +32,28 @@ namespace Jellyfin.Data.Entities
|
|||
/// <param name="_personrole1"></param>
|
||||
public Artwork(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
this.Path = path;
|
||||
|
||||
this.Kind = kind;
|
||||
|
||||
if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
|
||||
if (_metadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_metadata0));
|
||||
}
|
||||
|
||||
_metadata0.Artwork.Add(this);
|
||||
|
||||
if (_personrole1 == null) throw new ArgumentNullException(nameof(_personrole1));
|
||||
_personrole1.Artwork = this;
|
||||
if (_personrole1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_personrole1));
|
||||
}
|
||||
|
||||
_personrole1.Artwork = this;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -87,7 +98,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -126,7 +137,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Path;
|
||||
GetPath(ref value);
|
||||
return (_Path = value);
|
||||
return _Path = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -163,7 +174,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
Enums.ArtKind value = _Kind;
|
||||
GetKind(ref value);
|
||||
return (_Kind = value);
|
||||
return _Kind = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -29,18 +29,30 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_book0 == null) throw new ArgumentNullException(nameof(_book0));
|
||||
if (_book0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_book0));
|
||||
}
|
||||
|
||||
_book0.BookMetadata.Add(this);
|
||||
|
||||
this.Publishers = new HashSet<Company>();
|
||||
|
@ -51,8 +63,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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)
|
||||
{
|
||||
|
@ -82,7 +94,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
long? value = _ISBN;
|
||||
GetISBN(ref value);
|
||||
return (_ISBN = value);
|
||||
return _ISBN = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -27,17 +27,25 @@ namespace Jellyfin.Data.Entities
|
|||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="language">ISO-639-3 3-character language codes</param>
|
||||
/// <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));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
this.TimeStart = timestart;
|
||||
|
||||
if (_release0 == null) throw new ArgumentNullException(nameof(_release0));
|
||||
if (_release0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_release0));
|
||||
}
|
||||
|
||||
_release0.Chapters.Add(this);
|
||||
|
||||
|
||||
|
@ -47,7 +55,7 @@ namespace Jellyfin.Data.Entities
|
|||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="language">ISO-639-3 3-character language codes</param>
|
||||
/// <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)
|
||||
|
@ -84,7 +92,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -122,7 +130,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -163,7 +171,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Language;
|
||||
GetLanguage(ref value);
|
||||
return (_Language = value);
|
||||
return _Language = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -200,7 +208,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
long value = _TimeStart;
|
||||
GetTimeStart(ref value);
|
||||
return (_TimeStart = value);
|
||||
return _TimeStart = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -233,7 +241,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
long? value = _TimeEnd;
|
||||
GetTimeEnd(ref value);
|
||||
return (_TimeEnd = value);
|
||||
return _TimeEnd = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -85,7 +85,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -38,15 +38,26 @@ namespace Jellyfin.Data.Entities
|
|||
// 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));
|
||||
if (_collection0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_collection0));
|
||||
}
|
||||
|
||||
_collection0.CollectionItem.Add(this);
|
||||
|
||||
if (_collectionitem1 == null) throw new ArgumentNullException(nameof(_collectionitem1));
|
||||
if (_collectionitem1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_collectionitem1));
|
||||
}
|
||||
|
||||
_collectionitem1.Next = this;
|
||||
|
||||
if (_collectionitem2 == null) throw new ArgumentNullException(nameof(_collectionitem2));
|
||||
_collectionitem2.Previous = this;
|
||||
if (_collectionitem2 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_collectionitem2));
|
||||
}
|
||||
|
||||
_collectionitem2.Previous = this;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -91,7 +102,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
|
|
@ -37,19 +37,39 @@ namespace Jellyfin.Data.Entities
|
|||
/// <param name="_company4"></param>
|
||||
public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
|
||||
{
|
||||
if (_moviemetadata0 == null) throw new ArgumentNullException(nameof(_moviemetadata0));
|
||||
if (_moviemetadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_moviemetadata0));
|
||||
}
|
||||
|
||||
_moviemetadata0.Studios.Add(this);
|
||||
|
||||
if (_seriesmetadata1 == null) throw new ArgumentNullException(nameof(_seriesmetadata1));
|
||||
if (_seriesmetadata1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_seriesmetadata1));
|
||||
}
|
||||
|
||||
_seriesmetadata1.Networks.Add(this);
|
||||
|
||||
if (_musicalbummetadata2 == null) throw new ArgumentNullException(nameof(_musicalbummetadata2));
|
||||
if (_musicalbummetadata2 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_musicalbummetadata2));
|
||||
}
|
||||
|
||||
_musicalbummetadata2.Labels.Add(this);
|
||||
|
||||
if (_bookmetadata3 == null) throw new ArgumentNullException(nameof(_bookmetadata3));
|
||||
if (_bookmetadata3 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_bookmetadata3));
|
||||
}
|
||||
|
||||
_bookmetadata3.Publishers.Add(this);
|
||||
|
||||
if (_company4 == null) throw new ArgumentNullException(nameof(_company4));
|
||||
if (_company4 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_company4));
|
||||
}
|
||||
|
||||
_company4.Parent = this;
|
||||
|
||||
this.CompanyMetadata = new HashSet<CompanyMetadata>();
|
||||
|
@ -99,7 +119,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
|
|
@ -26,20 +26,31 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_company0 == null) throw new ArgumentNullException(nameof(_company0));
|
||||
_company0.CompanyMetadata.Add(this);
|
||||
if (_company0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_company0));
|
||||
}
|
||||
|
||||
_company0.CompanyMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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)
|
||||
{
|
||||
|
@ -83,7 +94,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Description;
|
||||
GetDescription(ref value);
|
||||
return (_Description = value);
|
||||
return _Description = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -121,7 +132,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Headquarters;
|
||||
GetHeadquarters(ref value);
|
||||
return (_Headquarters = value);
|
||||
return _Headquarters = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -159,7 +170,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Country;
|
||||
GetCountry(ref value);
|
||||
return (_Country = value);
|
||||
return _Country = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -197,7 +208,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Homepage;
|
||||
GetHomepage(ref value);
|
||||
return (_Homepage = value);
|
||||
return _Homepage = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -25,20 +25,31 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_customitem0 == null) throw new ArgumentNullException(nameof(_customitem0));
|
||||
_customitem0.CustomItemMetadata.Add(this);
|
||||
if (_customitem0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_customitem0));
|
||||
}
|
||||
|
||||
_customitem0.CustomItemMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -46,8 +57,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
|
|||
|
||||
this.UrlId = urlid;
|
||||
|
||||
if (_season0 == null) throw new ArgumentNullException(nameof(_season0));
|
||||
if (_season0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_season0));
|
||||
}
|
||||
|
||||
_season0.Episodes.Add(this);
|
||||
|
||||
this.Releases = new HashSet<Release>();
|
||||
|
@ -84,7 +88,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int? value = _EpisodeNumber;
|
||||
GetEpisodeNumber(ref value);
|
||||
return (_EpisodeNumber = value);
|
||||
return _EpisodeNumber = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -26,20 +26,31 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_episode0 == null) throw new ArgumentNullException(nameof(_episode0));
|
||||
_episode0.EpisodeMetadata.Add(this);
|
||||
if (_episode0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_episode0));
|
||||
}
|
||||
|
||||
_episode0.EpisodeMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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)
|
||||
{
|
||||
|
@ -83,7 +94,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Outline;
|
||||
GetOutline(ref value);
|
||||
return (_Outline = value);
|
||||
return _Outline = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -121,7 +132,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Plot;
|
||||
GetPlot(ref value);
|
||||
return (_Plot = value);
|
||||
return _Plot = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -159,7 +170,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Tagline;
|
||||
GetTagline(ref value);
|
||||
return (_Tagline = value);
|
||||
return _Tagline = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -31,12 +31,19 @@ namespace Jellyfin.Data.Entities
|
|||
/// <param name="_metadata0"></param>
|
||||
public Genre(string name, Metadata _metadata0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
this.Name = name;
|
||||
|
||||
if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
|
||||
_metadata0.Genres.Add(this);
|
||||
if (_metadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_metadata0));
|
||||
}
|
||||
|
||||
_metadata0.Genres.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -80,7 +87,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -119,7 +126,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace Jellyfin.Data.Entities
|
|||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="name">The name of this group</param>
|
||||
/// <param name="name">The name of this group.</param>
|
||||
public static Group Create(string name)
|
||||
{
|
||||
return new Group(name);
|
||||
|
|
|
@ -30,9 +30,12 @@ namespace Jellyfin.Data.Entities
|
|||
/// <param name="name"></param>
|
||||
public Library(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
|
||||
this.Name = name;
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
this.Name = name;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -75,7 +78,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -114,7 +117,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -95,7 +95,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
Guid value = _UrlId;
|
||||
GetUrlId(ref value);
|
||||
return (_UrlId = value);
|
||||
return _UrlId = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -132,7 +132,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTime value = _DateAdded;
|
||||
GetDateAdded(ref value);
|
||||
return (_DateAdded = value);
|
||||
return _DateAdded = value;
|
||||
}
|
||||
|
||||
internal set
|
||||
|
|
|
@ -27,12 +27,15 @@ namespace Jellyfin.Data.Entities
|
|||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="path">Absolute Path</param>
|
||||
/// <param name="path">Absolute Path.</param>
|
||||
public LibraryRoot(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
|
||||
this.Path = path;
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
this.Path = path;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -40,7 +43,7 @@ namespace Jellyfin.Data.Entities
|
|||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="path">Absolute Path</param>
|
||||
/// <param name="path">Absolute Path.</param>
|
||||
public static LibraryRoot Create(string path)
|
||||
{
|
||||
return new LibraryRoot(path);
|
||||
|
@ -75,7 +78,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -115,7 +118,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Path;
|
||||
GetPath(ref value);
|
||||
return (_Path = value);
|
||||
return _Path = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -154,7 +157,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _NetworkPath;
|
||||
GetNetworkPath(ref value);
|
||||
return (_NetworkPath = value);
|
||||
return _NetworkPath = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -30,17 +30,25 @@ namespace Jellyfin.Data.Entities
|
|||
/// <summary>
|
||||
/// Public constructor with required data.
|
||||
/// </summary>
|
||||
/// <param name="path">Relative to the LibraryRoot</param>
|
||||
/// <param name="path">Relative to the LibraryRoot.</param>
|
||||
/// <param name="kind"></param>
|
||||
/// <param name="_release0"></param>
|
||||
public MediaFile(string path, Enums.MediaFileKind kind, Release _release0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
this.Path = path;
|
||||
|
||||
this.Kind = kind;
|
||||
|
||||
if (_release0 == null) throw new ArgumentNullException(nameof(_release0));
|
||||
if (_release0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_release0));
|
||||
}
|
||||
|
||||
_release0.MediaFiles.Add(this);
|
||||
|
||||
this.MediaFileStreams = new HashSet<MediaFileStream>();
|
||||
|
@ -51,7 +59,7 @@ namespace Jellyfin.Data.Entities
|
|||
/// <summary>
|
||||
/// Static create function (for use in LINQ queries, etc.)
|
||||
/// </summary>
|
||||
/// <param name="path">Relative to the LibraryRoot</param>
|
||||
/// <param name="path">Relative to the LibraryRoot.</param>
|
||||
/// <param name="kind"></param>
|
||||
/// <param name="_release0"></param>
|
||||
public static MediaFile Create(string path, Enums.MediaFileKind kind, Release _release0)
|
||||
|
@ -88,7 +96,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -128,7 +136,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Path;
|
||||
GetPath(ref value);
|
||||
return (_Path = value);
|
||||
return _Path = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -165,7 +173,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
Enums.MediaFileKind value = _Kind;
|
||||
GetKind(ref value);
|
||||
return (_Kind = value);
|
||||
return _Kind = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -33,9 +33,12 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
this.StreamNumber = streamnumber;
|
||||
|
||||
if (_mediafile0 == null) throw new ArgumentNullException(nameof(_mediafile0));
|
||||
_mediafile0.MediaFileStreams.Add(this);
|
||||
if (_mediafile0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_mediafile0));
|
||||
}
|
||||
|
||||
_mediafile0.MediaFileStreams.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -79,7 +82,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -116,7 +119,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _StreamNumber;
|
||||
GetStreamNumber(ref value);
|
||||
return (_StreamNumber = value);
|
||||
return _StreamNumber = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -26,14 +26,22 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="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, DateTime dateadded, DateTime datemodified)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
this.PersonRoles = new HashSet<PersonRole>();
|
||||
|
@ -74,7 +82,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -114,7 +122,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Title;
|
||||
GetTitle(ref value);
|
||||
return (_Title = value);
|
||||
return _Title = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -152,7 +160,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _OriginalTitle;
|
||||
GetOriginalTitle(ref value);
|
||||
return (_OriginalTitle = value);
|
||||
return _OriginalTitle = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -190,7 +198,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _SortTitle;
|
||||
GetSortTitle(ref value);
|
||||
return (_SortTitle = value);
|
||||
return _SortTitle = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -231,7 +239,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Language;
|
||||
GetLanguage(ref value);
|
||||
return (_Language = value);
|
||||
return _Language = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -264,7 +272,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTimeOffset? value = _ReleaseDate;
|
||||
GetReleaseDate(ref value);
|
||||
return (_ReleaseDate = value);
|
||||
return _ReleaseDate = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -301,7 +309,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTime value = _DateAdded;
|
||||
GetDateAdded(ref value);
|
||||
return (_DateAdded = value);
|
||||
return _DateAdded = value;
|
||||
}
|
||||
|
||||
internal set
|
||||
|
@ -338,7 +346,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTime value = _DateModified;
|
||||
GetDateModified(ref value);
|
||||
return (_DateModified = value);
|
||||
return _DateModified = value;
|
||||
}
|
||||
|
||||
internal set
|
||||
|
|
|
@ -30,9 +30,12 @@ namespace Jellyfin.Data.Entities
|
|||
/// <param name="name"></param>
|
||||
public MetadataProvider(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
|
||||
this.Name = name;
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
this.Name = name;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -75,7 +78,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -114,7 +117,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -40,21 +40,40 @@ namespace Jellyfin.Data.Entities
|
|||
// NOTE: This class has one-to-one associations with MetadataProviderId.
|
||||
// One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
|
||||
|
||||
if (string.IsNullOrEmpty(providerid)) throw new ArgumentNullException(nameof(providerid));
|
||||
if (string.IsNullOrEmpty(providerid))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(providerid));
|
||||
}
|
||||
|
||||
this.ProviderId = providerid;
|
||||
|
||||
if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
|
||||
if (_metadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_metadata0));
|
||||
}
|
||||
|
||||
_metadata0.Sources.Add(this);
|
||||
|
||||
if (_person1 == null) throw new ArgumentNullException(nameof(_person1));
|
||||
if (_person1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_person1));
|
||||
}
|
||||
|
||||
_person1.Sources.Add(this);
|
||||
|
||||
if (_personrole2 == null) throw new ArgumentNullException(nameof(_personrole2));
|
||||
if (_personrole2 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_personrole2));
|
||||
}
|
||||
|
||||
_personrole2.Sources.Add(this);
|
||||
|
||||
if (_ratingsource3 == null) throw new ArgumentNullException(nameof(_ratingsource3));
|
||||
_ratingsource3.Source = this;
|
||||
if (_ratingsource3 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_ratingsource3));
|
||||
}
|
||||
|
||||
_ratingsource3.Source = this;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -101,7 +120,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -140,7 +159,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _ProviderId;
|
||||
GetProviderId(ref value);
|
||||
return (_ProviderId = value);
|
||||
return _ProviderId = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -30,18 +30,30 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_movie0"></param>
|
||||
public MovieMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_movie0 == null) throw new ArgumentNullException(nameof(_movie0));
|
||||
if (_movie0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_movie0));
|
||||
}
|
||||
|
||||
_movie0.MovieMetadata.Add(this);
|
||||
|
||||
this.Studios = new HashSet<Company>();
|
||||
|
@ -52,8 +64,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_movie0"></param>
|
||||
public static MovieMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
|
||||
{
|
||||
|
@ -88,7 +100,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Outline;
|
||||
GetOutline(ref value);
|
||||
return (_Outline = value);
|
||||
return _Outline = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -126,7 +138,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Plot;
|
||||
GetPlot(ref value);
|
||||
return (_Plot = value);
|
||||
return _Plot = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -164,7 +176,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Tagline;
|
||||
GetTagline(ref value);
|
||||
return (_Tagline = value);
|
||||
return _Tagline = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -202,7 +214,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Country;
|
||||
GetCountry(ref value);
|
||||
return (_Country = value);
|
||||
return _Country = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -30,18 +30,30 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_musicalbum0"></param>
|
||||
public MusicAlbumMetadata(string title, string language, DateTime dateadded, DateTime datemodified, MusicAlbum _musicalbum0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_musicalbum0 == null) throw new ArgumentNullException(nameof(_musicalbum0));
|
||||
if (_musicalbum0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_musicalbum0));
|
||||
}
|
||||
|
||||
_musicalbum0.MusicAlbumMetadata.Add(this);
|
||||
|
||||
this.Labels = new HashSet<Company>();
|
||||
|
@ -52,8 +64,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_musicalbum0"></param>
|
||||
public static MusicAlbumMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, MusicAlbum _musicalbum0)
|
||||
{
|
||||
|
@ -88,7 +100,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Barcode;
|
||||
GetBarcode(ref value);
|
||||
return (_Barcode = value);
|
||||
return _Barcode = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -126,7 +138,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _LabelNumber;
|
||||
GetLabelNumber(ref value);
|
||||
return (_LabelNumber = value);
|
||||
return _LabelNumber = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -164,7 +176,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Country;
|
||||
GetCountry(ref value);
|
||||
return (_Country = value);
|
||||
return _Country = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -36,7 +36,11 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
this.UrlId = urlid;
|
||||
|
||||
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
this.Name = name;
|
||||
|
||||
this.Sources = new HashSet<MetadataProviderId>();
|
||||
|
@ -83,7 +87,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -120,7 +124,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
Guid value = _UrlId;
|
||||
GetUrlId(ref value);
|
||||
return (_UrlId = value);
|
||||
return _UrlId = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -159,7 +163,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -197,7 +201,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _SourceId;
|
||||
GetSourceId(ref value);
|
||||
return (_SourceId = value);
|
||||
return _SourceId = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -234,7 +238,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTime value = _DateAdded;
|
||||
GetDateAdded(ref value);
|
||||
return (_DateAdded = value);
|
||||
return _DateAdded = value;
|
||||
}
|
||||
|
||||
internal set
|
||||
|
@ -271,7 +275,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTime value = _DateModified;
|
||||
GetDateModified(ref value);
|
||||
return (_DateModified = value);
|
||||
return _DateModified = value;
|
||||
}
|
||||
|
||||
internal set
|
||||
|
|
|
@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
|
|||
|
||||
this.Type = type;
|
||||
|
||||
if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
|
||||
if (_metadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_metadata0));
|
||||
}
|
||||
|
||||
_metadata0.PersonRoles.Add(this);
|
||||
|
||||
this.Sources = new HashSet<MetadataProviderId>();
|
||||
|
@ -89,7 +93,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -127,7 +131,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Role;
|
||||
GetRole(ref value);
|
||||
return (_Role = value);
|
||||
return _Role = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -164,7 +168,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
Enums.PersonRoleType value = _Type;
|
||||
GetType(ref value);
|
||||
return (_Type = value);
|
||||
return _Type = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -26,20 +26,31 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_photo0"></param>
|
||||
public PhotoMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Photo _photo0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_photo0 == null) throw new ArgumentNullException(nameof(_photo0));
|
||||
_photo0.PhotoMetadata.Add(this);
|
||||
if (_photo0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_photo0));
|
||||
}
|
||||
|
||||
_photo0.PhotoMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_photo0"></param>
|
||||
public static PhotoMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Photo _photo0)
|
||||
{
|
||||
|
|
|
@ -34,15 +34,26 @@ namespace Jellyfin.Data.Entities
|
|||
/// <param name="_group1"></param>
|
||||
public ProviderMapping(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
|
||||
{
|
||||
if (string.IsNullOrEmpty(providername)) throw new ArgumentNullException(nameof(providername));
|
||||
if (string.IsNullOrEmpty(providername))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(providername));
|
||||
}
|
||||
|
||||
this.ProviderName = providername;
|
||||
|
||||
if (string.IsNullOrEmpty(providersecrets)) throw new ArgumentNullException(nameof(providersecrets));
|
||||
if (string.IsNullOrEmpty(providersecrets))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(providersecrets));
|
||||
}
|
||||
|
||||
this.ProviderSecrets = providersecrets;
|
||||
|
||||
if (string.IsNullOrEmpty(providerdata)) throw new ArgumentNullException(nameof(providerdata));
|
||||
this.ProviderData = providerdata;
|
||||
if (string.IsNullOrEmpty(providerdata))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(providerdata));
|
||||
}
|
||||
|
||||
this.ProviderData = providerdata;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
|
|
@ -33,9 +33,12 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
this.Value = value;
|
||||
|
||||
if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
|
||||
_metadata0.Ratings.Add(this);
|
||||
if (_metadata0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_metadata0));
|
||||
}
|
||||
|
||||
_metadata0.Ratings.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -79,7 +82,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -116,7 +119,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
double value = _Value;
|
||||
GetValue(ref value);
|
||||
return (_Value = value);
|
||||
return _Value = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -149,7 +152,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int? value = _Votes;
|
||||
GetVotes(ref value);
|
||||
return (_Votes = value);
|
||||
return _Votes = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -39,9 +39,12 @@ namespace Jellyfin.Data.Entities
|
|||
|
||||
this.MinimumValue = minimumvalue;
|
||||
|
||||
if (_rating0 == null) throw new ArgumentNullException(nameof(_rating0));
|
||||
_rating0.RatingType = this;
|
||||
if (_rating0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_rating0));
|
||||
}
|
||||
|
||||
_rating0.RatingType = this;
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -86,7 +89,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -124,7 +127,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -161,7 +164,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
double value = _MaximumValue;
|
||||
GetMaximumValue(ref value);
|
||||
return (_MaximumValue = value);
|
||||
return _MaximumValue = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -198,7 +201,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
double value = _MinimumValue;
|
||||
GetMinimumValue(ref value);
|
||||
return (_MinimumValue = value);
|
||||
return _MinimumValue = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -40,25 +40,53 @@ namespace Jellyfin.Data.Entities
|
|||
/// <param name="_photo5"></param>
|
||||
public Release(string name, Movie _movie0, Episode _episode1, Track _track2, CustomItem _customitem3, Book _book4, Photo _photo5)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
this.Name = name;
|
||||
|
||||
if (_movie0 == null) throw new ArgumentNullException(nameof(_movie0));
|
||||
if (_movie0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_movie0));
|
||||
}
|
||||
|
||||
_movie0.Releases.Add(this);
|
||||
|
||||
if (_episode1 == null) throw new ArgumentNullException(nameof(_episode1));
|
||||
if (_episode1 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_episode1));
|
||||
}
|
||||
|
||||
_episode1.Releases.Add(this);
|
||||
|
||||
if (_track2 == null) throw new ArgumentNullException(nameof(_track2));
|
||||
if (_track2 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_track2));
|
||||
}
|
||||
|
||||
_track2.Releases.Add(this);
|
||||
|
||||
if (_customitem3 == null) throw new ArgumentNullException(nameof(_customitem3));
|
||||
if (_customitem3 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_customitem3));
|
||||
}
|
||||
|
||||
_customitem3.Releases.Add(this);
|
||||
|
||||
if (_book4 == null) throw new ArgumentNullException(nameof(_book4));
|
||||
if (_book4 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_book4));
|
||||
}
|
||||
|
||||
_book4.Releases.Add(this);
|
||||
|
||||
if (_photo5 == null) throw new ArgumentNullException(nameof(_photo5));
|
||||
if (_photo5 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_photo5));
|
||||
}
|
||||
|
||||
_photo5.Releases.Add(this);
|
||||
|
||||
this.MediaFiles = new HashSet<MediaFile>();
|
||||
|
@ -111,7 +139,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int value = _Id;
|
||||
GetId(ref value);
|
||||
return (_Id = value);
|
||||
return _Id = value;
|
||||
}
|
||||
|
||||
protected set
|
||||
|
@ -150,7 +178,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Name;
|
||||
GetName(ref value);
|
||||
return (_Name = value);
|
||||
return _Name = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
|
|||
|
||||
this.UrlId = urlid;
|
||||
|
||||
if (_series0 == null) throw new ArgumentNullException(nameof(_series0));
|
||||
if (_series0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_series0));
|
||||
}
|
||||
|
||||
_series0.Seasons.Add(this);
|
||||
|
||||
this.SeasonMetadata = new HashSet<SeasonMetadata>();
|
||||
|
@ -84,7 +88,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int? value = _SeasonNumber;
|
||||
GetSeasonNumber(ref value);
|
||||
return (_SeasonNumber = value);
|
||||
return _SeasonNumber = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -27,20 +27,31 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_season0"></param>
|
||||
public SeasonMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Season _season0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_season0 == null) throw new ArgumentNullException(nameof(_season0));
|
||||
_season0.SeasonMetadata.Add(this);
|
||||
if (_season0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_season0));
|
||||
}
|
||||
|
||||
_season0.SeasonMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -48,8 +59,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_season0"></param>
|
||||
public static SeasonMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Season _season0)
|
||||
{
|
||||
|
@ -84,7 +95,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Outline;
|
||||
GetOutline(ref value);
|
||||
return (_Outline = value);
|
||||
return _Outline = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DayOfWeek? value = _AirsDayOfWeek;
|
||||
GetAirsDayOfWeek(ref value);
|
||||
return (_AirsDayOfWeek = value);
|
||||
return _AirsDayOfWeek = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -101,7 +101,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTimeOffset? value = _AirsTime;
|
||||
GetAirsTime(ref value);
|
||||
return (_AirsTime = value);
|
||||
return _AirsTime = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -134,7 +134,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
DateTimeOffset? value = _FirstAired;
|
||||
GetFirstAired(ref value);
|
||||
return (_FirstAired = value);
|
||||
return _FirstAired = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -30,18 +30,30 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_series0"></param>
|
||||
public SeriesMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Series _series0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_series0 == null) throw new ArgumentNullException(nameof(_series0));
|
||||
if (_series0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_series0));
|
||||
}
|
||||
|
||||
_series0.SeriesMetadata.Add(this);
|
||||
|
||||
this.Networks = new HashSet<Company>();
|
||||
|
@ -52,8 +64,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_series0"></param>
|
||||
public static SeriesMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Series _series0)
|
||||
{
|
||||
|
@ -88,7 +100,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Outline;
|
||||
GetOutline(ref value);
|
||||
return (_Outline = value);
|
||||
return _Outline = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -126,7 +138,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Plot;
|
||||
GetPlot(ref value);
|
||||
return (_Plot = value);
|
||||
return _Plot = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -164,7 +176,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Tagline;
|
||||
GetTagline(ref value);
|
||||
return (_Tagline = value);
|
||||
return _Tagline = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -202,7 +214,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
string value = _Country;
|
||||
GetCountry(ref value);
|
||||
return (_Country = value);
|
||||
return _Country = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
|
|||
|
||||
this.UrlId = urlid;
|
||||
|
||||
if (_musicalbum0 == null) throw new ArgumentNullException(nameof(_musicalbum0));
|
||||
if (_musicalbum0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_musicalbum0));
|
||||
}
|
||||
|
||||
_musicalbum0.Tracks.Add(this);
|
||||
|
||||
this.Releases = new HashSet<Release>();
|
||||
|
@ -84,7 +88,7 @@ namespace Jellyfin.Data.Entities
|
|||
{
|
||||
int? value = _TrackNumber;
|
||||
GetTrackNumber(ref value);
|
||||
return (_TrackNumber = value);
|
||||
return _TrackNumber = value;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -26,20 +26,31 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_track0"></param>
|
||||
public TrackMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Track _track0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(title));
|
||||
}
|
||||
|
||||
this.Title = title;
|
||||
|
||||
if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(language));
|
||||
}
|
||||
|
||||
this.Language = language;
|
||||
|
||||
if (_track0 == null) throw new ArgumentNullException(nameof(_track0));
|
||||
_track0.TrackMetadata.Add(this);
|
||||
if (_track0 == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(_track0));
|
||||
}
|
||||
|
||||
_track0.TrackMetadata.Add(this);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
|
|||
/// <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="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="_track0"></param>
|
||||
public static TrackMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Track _track0)
|
||||
{
|
||||
|
|
|
@ -63,25 +63,29 @@ namespace Jellyfin.Server.Implementations.Users
|
|||
});
|
||||
}
|
||||
|
||||
byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
|
||||
|
||||
PasswordHash readyHash = PasswordHash.Parse(resolvedUser.Password);
|
||||
if (_cryptographyProvider.GetSupportedHashMethods().Contains(readyHash.Id)
|
||||
|| _cryptographyProvider.DefaultHashMethod == readyHash.Id)
|
||||
// Handle the case when the stored password is null, but the user tried to login with a password
|
||||
if (resolvedUser.Password != null)
|
||||
{
|
||||
byte[] calculatedHash = _cryptographyProvider.ComputeHash(
|
||||
readyHash.Id,
|
||||
passwordBytes,
|
||||
readyHash.Salt.ToArray());
|
||||
byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
|
||||
|
||||
if (readyHash.Hash.SequenceEqual(calculatedHash))
|
||||
PasswordHash readyHash = PasswordHash.Parse(resolvedUser.Password);
|
||||
if (_cryptographyProvider.GetSupportedHashMethods().Contains(readyHash.Id)
|
||||
|| _cryptographyProvider.DefaultHashMethod == readyHash.Id)
|
||||
{
|
||||
success = true;
|
||||
byte[] calculatedHash = _cryptographyProvider.ComputeHash(
|
||||
readyHash.Id,
|
||||
passwordBytes,
|
||||
readyHash.Salt.ToArray());
|
||||
|
||||
if (readyHash.Hash.SequenceEqual(calculatedHash))
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AuthenticationException($"Requested crypto method not available in provider: {readyHash.Id}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AuthenticationException($"Requested crypto method not available in provider: {readyHash.Id}");
|
||||
}
|
||||
|
||||
if (!success)
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||
/// Gets the dimensions of the image.
|
||||
/// </summary>
|
||||
/// <param name="path">Path to the image file.</param>
|
||||
/// <returns>ImageDimensions</returns>
|
||||
/// <returns>ImageDimensions.</returns>
|
||||
ImageDimensions GetImageDimensions(string path);
|
||||
|
||||
/// <summary>
|
||||
|
@ -38,14 +38,14 @@ namespace MediaBrowser.Controller.Drawing
|
|||
/// </summary>
|
||||
/// <param name="item">The base item.</param>
|
||||
/// <param name="info">The information.</param>
|
||||
/// <returns>ImageDimensions</returns>
|
||||
/// <returns>ImageDimensions.</returns>
|
||||
ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blurhash of the image.
|
||||
/// </summary>
|
||||
/// <param name="path">Path to the image file.</param>
|
||||
/// <returns>BlurHash</returns>
|
||||
/// <returns>BlurHash.</returns>
|
||||
string GetImageBlurHash(string path);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -690,7 +690,10 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <returns>System.String.</returns>
|
||||
protected virtual string CreateSortName()
|
||||
{
|
||||
if (Name == null) return null; // some items may not have name filled in properly
|
||||
if (Name == null)
|
||||
{
|
||||
return null; // some items may not have name filled in properly
|
||||
}
|
||||
|
||||
if (!EnableAlphaNumericSorting)
|
||||
{
|
||||
|
@ -1371,7 +1374,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>true if a provider reports we changed</returns>
|
||||
/// <returns>true if a provider reports we changed.</returns>
|
||||
public async Task<ItemUpdateType> RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
|
||||
{
|
||||
TriggerOnRefreshStart();
|
||||
|
@ -2948,9 +2951,13 @@ namespace MediaBrowser.Controller.Entities
|
|||
public IEnumerable<BaseItem> GetTrailers()
|
||||
{
|
||||
if (this is IHasTrailers)
|
||||
{
|
||||
return ((IHasTrailers)this).LocalTrailerIds.Select(LibraryManager.GetItemById).Where(i => i != null).OrderBy(i => i.SortName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Array.Empty<BaseItem>();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsHD => Height >= 720;
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
return null;
|
||||
}
|
||||
|
||||
return (totalProgresses / foldersWithProgress);
|
||||
return totalProgresses / foldersWithProgress;
|
||||
}
|
||||
|
||||
protected override bool RefreshLinkedChildren(IEnumerable<FileSystemMetadata> fileSystemChildren)
|
||||
|
|
|
@ -480,7 +480,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
innerProgress.RegisterAction(p =>
|
||||
{
|
||||
double innerPercent = currentInnerPercent;
|
||||
innerPercent += p / (count);
|
||||
innerPercent += p / count;
|
||||
progress.Report(innerPercent);
|
||||
});
|
||||
|
||||
|
@ -556,7 +556,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
innerProgress.RegisterAction(p =>
|
||||
{
|
||||
double innerPercent = currentInnerPercent;
|
||||
innerPercent += p / (count);
|
||||
innerPercent += p / count;
|
||||
progress.Report(innerPercent);
|
||||
});
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace MediaBrowser.Controller.Library
|
|||
|
||||
public LibraryOptions GetLibraryOptions()
|
||||
{
|
||||
return LibraryOptions ?? (LibraryOptions = (Parent == null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent)));
|
||||
return LibraryOptions ?? (LibraryOptions = Parent == null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -224,8 +224,6 @@ namespace MediaBrowser.Controller.Library
|
|||
|
||||
public string CollectionType { get; set; }
|
||||
|
||||
#region Equality Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <see cref="object" /> is equal to this instance.
|
||||
/// </summary>
|
||||
|
@ -254,14 +252,15 @@ namespace MediaBrowser.Controller.Library
|
|||
{
|
||||
if (args != null)
|
||||
{
|
||||
if (args.Path == null && Path == null) return true;
|
||||
if (args.Path == null && Path == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return args.Path != null && BaseItem.FileSystem.AreEqual(args.Path, Path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace MediaBrowser.Controller.Library
|
|||
_stopwatch = new Stopwatch();
|
||||
_stopwatch.Start();
|
||||
}
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
|
@ -71,7 +70,5 @@ namespace MediaBrowser.Controller.Library
|
|||
_logger.LogInformation(message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2603,6 +2603,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
{
|
||||
return "-c:v vp8_qsv";
|
||||
}
|
||||
|
||||
break;
|
||||
case "vp9":
|
||||
if (_mediaEncoder.SupportsDecoder("vp9_qsv") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase))
|
||||
|
@ -2610,6 +2611,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return (isColorDepth10 &&
|
||||
!encodingOptions.EnableDecodingColorDepth10Vp9) ? null : "-c:v vp9_qsv";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2667,6 +2669,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
{
|
||||
return "-c:v vp8_cuvid";
|
||||
}
|
||||
|
||||
break;
|
||||
case "vp9":
|
||||
if (_mediaEncoder.SupportsDecoder("vp9_cuvid") && encodingOptions.HardwareDecodingCodecs.Contains("vp9", StringComparer.OrdinalIgnoreCase))
|
||||
|
@ -2674,6 +2677,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return (isColorDepth10 &&
|
||||
!encodingOptions.EnableDecodingColorDepth10Vp9) ? null : "-c:v vp9_cuvid";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2818,6 +2822,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
{
|
||||
return "-c:v h264_opencl";
|
||||
}
|
||||
|
||||
break;
|
||||
case "hevc":
|
||||
case "h265":
|
||||
|
@ -2826,30 +2831,35 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return (isColorDepth10 &&
|
||||
!encodingOptions.EnableDecodingColorDepth10Hevc) ? null : "-c:v hevc_opencl";
|
||||
}
|
||||
|
||||
break;
|
||||
case "mpeg2video":
|
||||
if (_mediaEncoder.SupportsDecoder("mpeg2_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg2video", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v mpeg2_opencl";
|
||||
}
|
||||
|
||||
break;
|
||||
case "mpeg4":
|
||||
if (_mediaEncoder.SupportsDecoder("mpeg4_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg4", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v mpeg4_opencl";
|
||||
}
|
||||
|
||||
break;
|
||||
case "vc1":
|
||||
if (_mediaEncoder.SupportsDecoder("vc1_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v vc1_opencl";
|
||||
}
|
||||
|
||||
break;
|
||||
case "vp8":
|
||||
if (_mediaEncoder.SupportsDecoder("vp8_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v vp8_opencl";
|
||||
}
|
||||
|
||||
break;
|
||||
case "vp9":
|
||||
if (_mediaEncoder.SupportsDecoder("vp9_opencl") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase))
|
||||
|
@ -2857,6 +2867,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
return (isColorDepth10 &&
|
||||
!encodingOptions.EnableDecodingColorDepth10Vp9) ? null : "-c:v vp9_opencl";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ namespace MediaBrowser.Controller.Net
|
|||
/// <summary>
|
||||
/// The request filter is executed before the service.
|
||||
/// </summary>
|
||||
/// <param name="request">The http request wrapper</param>
|
||||
/// <param name="response">The http response wrapper</param>
|
||||
/// <param name="requestDto">The request DTO</param>
|
||||
/// <param name="request">The http request wrapper.</param>
|
||||
/// <param name="response">The http response wrapper.</param>
|
||||
/// <param name="requestDto">The request DTO.</param>
|
||||
public void RequestFilter(IRequest request, HttpResponse response, object requestDto)
|
||||
{
|
||||
AuthService.Authenticate(request, this);
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.Net
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SecurityException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error</param>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
|
||||
public SecurityException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
|
|
|
@ -7,12 +7,43 @@ using MediaBrowser.Model.IO;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// The BaseXmlProvider.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of provider.</typeparam>
|
||||
public abstract class BaseXmlProvider<T> : ILocalMetadataProvider<T>, IHasItemChangeMonitor, IHasOrder
|
||||
where T : BaseItem, new()
|
||||
{
|
||||
protected IFileSystem FileSystem;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseXmlProvider{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
protected BaseXmlProvider(IFileSystem fileSystem)
|
||||
{
|
||||
this.FileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public Task<MetadataResult<T>> GetMetadata(ItemInfo info,
|
||||
/// <inheritdoc />
|
||||
public string Name => XmlProviderUtils.Name;
|
||||
|
||||
/// After Nfo
|
||||
/// <inheritdoc />
|
||||
public virtual int Order => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IFileSystem.
|
||||
/// </summary>
|
||||
protected IFileSystem FileSystem { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets metadata for item.
|
||||
/// </summary>
|
||||
/// <param name="info">The item info.</param>
|
||||
/// <param name="directoryService">Instance of the <see cref="IDirectoryService"/> interface.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The metadata for item.</returns>
|
||||
public Task<MetadataResult<T>> GetMetadata(
|
||||
ItemInfo info,
|
||||
IDirectoryService directoryService,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -46,15 +77,23 @@ namespace MediaBrowser.LocalMetadata
|
|||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get metadata from path.
|
||||
/// </summary>
|
||||
/// <param name="result">Resulting metadata.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
protected abstract void Fetch(MetadataResult<T> result, string path, CancellationToken cancellationToken);
|
||||
|
||||
protected BaseXmlProvider(IFileSystem fileSystem)
|
||||
{
|
||||
FileSystem = fileSystem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get metadata from xml file.
|
||||
/// </summary>
|
||||
/// <param name="info">Item inf.</param>
|
||||
/// <param name="directoryService">Instance of the <see cref="IDirectoryService"/> interface.</param>
|
||||
/// <returns>The file system metadata.</returns>
|
||||
protected abstract FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService);
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasChanged(BaseItem item, IDirectoryService directoryService)
|
||||
{
|
||||
var file = GetXmlFile(new ItemInfo(item), directoryService);
|
||||
|
@ -66,15 +105,5 @@ namespace MediaBrowser.LocalMetadata
|
|||
|
||||
return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > item.DateLastSaved;
|
||||
}
|
||||
|
||||
public string Name => XmlProviderUtils.Name;
|
||||
|
||||
// After Nfo
|
||||
public virtual int Order => 1;
|
||||
}
|
||||
|
||||
static class XmlProviderUtils
|
||||
{
|
||||
public static string Name => "Emby Xml";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,30 +5,41 @@ using MediaBrowser.Model.IO;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Images
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection folder local image provider.
|
||||
/// </summary>
|
||||
public class CollectionFolderLocalImageProvider : ILocalImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CollectionFolderLocalImageProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
public CollectionFolderLocalImageProvider(IFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Collection Folder Images";
|
||||
|
||||
/// Run after LocalImageProvider
|
||||
/// <inheritdoc />
|
||||
public int Order => 1;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
return item is CollectionFolder && item.SupportsLocalMetadata;
|
||||
}
|
||||
|
||||
// Run after LocalImageProvider
|
||||
public int Order => 1;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
|
||||
{
|
||||
var collectionFolder = (CollectionFolder)item;
|
||||
|
||||
return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, true, directoryService);
|
||||
return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, directoryService);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,24 +10,35 @@ using MediaBrowser.Model.IO;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Images
|
||||
{
|
||||
public class EpisodeLocalLocalImageProvider : ILocalImageProvider, IHasOrder
|
||||
/// <summary>
|
||||
/// Episode local image provider.
|
||||
/// </summary>
|
||||
public class EpisodeLocalImageProvider : ILocalImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public EpisodeLocalLocalImageProvider(IFileSystem fileSystem)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EpisodeLocalImageProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
public EpisodeLocalImageProvider(IFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Local Images";
|
||||
|
||||
/// <inheritdoc />
|
||||
public int Order => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
return item is Episode && item.SupportsLocalMetadata;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
|
||||
{
|
||||
var parentPath = Path.GetDirectoryName(item.Path);
|
||||
|
@ -58,20 +69,11 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
|
||||
if (string.Equals(filenameWithoutExtension, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
list.Add(new LocalImageInfo
|
||||
{
|
||||
FileInfo = i,
|
||||
Type = ImageType.Primary
|
||||
});
|
||||
list.Add(new LocalImageInfo { FileInfo = i, Type = ImageType.Primary });
|
||||
}
|
||||
|
||||
else if (string.Equals(thumbName, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
list.Add(new LocalImageInfo
|
||||
{
|
||||
FileInfo = i,
|
||||
Type = ImageType.Primary
|
||||
});
|
||||
list.Add(new LocalImageInfo { FileInfo = i, Type = ImageType.Primary });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,21 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Images
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal metadata folder image provider.
|
||||
/// </summary>
|
||||
public class InternalMetadataFolderImageProvider : ILocalImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger<InternalMetadataFolderImageProvider> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InternalMetadataFolderImageProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="config">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{InternalMetadataFolderImageProvider}"/> interface.</param>
|
||||
public InternalMetadataFolderImageProvider(
|
||||
IServerConfigurationManager config,
|
||||
IFileSystem fileSystem,
|
||||
|
@ -25,8 +34,14 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
/// Make sure this is last so that all other locations are scanned first
|
||||
/// <inheritdoc />
|
||||
public int Order => 1000;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Internal Images";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
if (item is Photo)
|
||||
|
@ -52,9 +67,8 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
|
||||
return true;
|
||||
}
|
||||
// Make sure this is last so that all other locations are scanned first
|
||||
public int Order => 1000;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
|
||||
{
|
||||
var path = item.GetInternalMetadataPath();
|
||||
|
@ -66,7 +80,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
|
||||
try
|
||||
{
|
||||
return new LocalImageProvider(_fileSystem).GetImages(item, path, false, directoryService);
|
||||
return new LocalImageProvider(_fileSystem).GetImages(item, path, directoryService);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
|
|
@ -13,19 +13,71 @@ using MediaBrowser.Model.IO;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Images
|
||||
{
|
||||
/// <summary>
|
||||
/// Local image provider.
|
||||
/// </summary>
|
||||
public class LocalImageProvider : ILocalImageProvider, IHasOrder
|
||||
{
|
||||
private static readonly string[] _commonImageFileNames =
|
||||
{
|
||||
"poster",
|
||||
"folder",
|
||||
"cover",
|
||||
"default"
|
||||
};
|
||||
|
||||
private static readonly string[] _musicImageFileNames =
|
||||
{
|
||||
"folder",
|
||||
"poster",
|
||||
"cover",
|
||||
"default"
|
||||
};
|
||||
|
||||
private static readonly string[] _personImageFileNames =
|
||||
{
|
||||
"folder",
|
||||
"poster"
|
||||
};
|
||||
|
||||
private static readonly string[] _seriesImageFileNames =
|
||||
{
|
||||
"poster",
|
||||
"folder",
|
||||
"cover",
|
||||
"default",
|
||||
"show"
|
||||
};
|
||||
|
||||
private static readonly string[] _videoImageFileNames =
|
||||
{
|
||||
"poster",
|
||||
"folder",
|
||||
"cover",
|
||||
"default",
|
||||
"movie"
|
||||
};
|
||||
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LocalImageProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
public LocalImageProvider(IFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Local Images";
|
||||
|
||||
/// <inheritdoc />
|
||||
public int Order => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
if (item.SupportsLocalMetadata)
|
||||
|
@ -42,15 +94,10 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
if (item.LocationType == LocationType.Virtual)
|
||||
{
|
||||
var season = item as Season;
|
||||
|
||||
if (season != null)
|
||||
var series = season?.Series;
|
||||
if (series != null && series.IsFileProtocol)
|
||||
{
|
||||
var series = season.Series;
|
||||
|
||||
if (series != null && series.IsFileProtocol)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,6 +132,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
.OrderBy(i => Array.IndexOf(BaseItem.SupportedImageExtensions, i.Extension ?? string.Empty));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
|
||||
{
|
||||
var files = GetFiles(item, true, directoryService).ToList();
|
||||
|
@ -96,12 +144,26 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
return list;
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, string path, bool isPathInMediaFolder, IDirectoryService directoryService)
|
||||
/// <summary>
|
||||
/// Get images for item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="path">The images path.</param>
|
||||
/// <param name="directoryService">Instance of the <see cref="IDirectoryService"/> interface.</param>
|
||||
/// <returns>The local image info.</returns>
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, string path, IDirectoryService directoryService)
|
||||
{
|
||||
return GetImages(item, new[] { path }, isPathInMediaFolder, directoryService);
|
||||
return GetImages(item, new[] { path }, directoryService);
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, IEnumerable<string> paths, bool arePathsInMediaFolders, IDirectoryService directoryService)
|
||||
/// <summary>
|
||||
/// Get images for item from multiple paths.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="paths">The image paths.</param>
|
||||
/// <param name="directoryService">Instance of the <see cref="IDirectoryService"/> interface.</param>
|
||||
/// <returns>The local image info.</returns>
|
||||
public List<LocalImageInfo> GetImages(BaseItem item, IEnumerable<string> paths, IDirectoryService directoryService)
|
||||
{
|
||||
IEnumerable<FileSystemMetadata> files = paths.SelectMany(i => _fileSystem.GetFiles(i, BaseItem.SupportedImageExtensions, true, false));
|
||||
|
||||
|
@ -196,7 +258,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
|
||||
if (!isEpisode && !isSong && !isPerson)
|
||||
{
|
||||
PopulateBackdrops(item, images, files, imagePrefix, isInMixedFolder, directoryService);
|
||||
PopulateBackdrops(item, images, files, imagePrefix, isInMixedFolder);
|
||||
}
|
||||
|
||||
if (item is IHasScreenshots)
|
||||
|
@ -205,46 +267,6 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly string[] CommonImageFileNames = new[]
|
||||
{
|
||||
"poster",
|
||||
"folder",
|
||||
"cover",
|
||||
"default"
|
||||
};
|
||||
|
||||
private static readonly string[] MusicImageFileNames = new[]
|
||||
{
|
||||
"folder",
|
||||
"poster",
|
||||
"cover",
|
||||
"default"
|
||||
};
|
||||
|
||||
private static readonly string[] PersonImageFileNames = new[]
|
||||
{
|
||||
"folder",
|
||||
"poster"
|
||||
};
|
||||
|
||||
private static readonly string[] SeriesImageFileNames = new[]
|
||||
{
|
||||
"poster",
|
||||
"folder",
|
||||
"cover",
|
||||
"default",
|
||||
"show"
|
||||
};
|
||||
|
||||
private static readonly string[] VideoImageFileNames = new[]
|
||||
{
|
||||
"poster",
|
||||
"folder",
|
||||
"cover",
|
||||
"default",
|
||||
"movie"
|
||||
};
|
||||
|
||||
private void PopulatePrimaryImages(BaseItem item, List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder)
|
||||
{
|
||||
string[] imageFileNames;
|
||||
|
@ -252,24 +274,24 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
if (item is MusicAlbum || item is MusicArtist || item is PhotoAlbum)
|
||||
{
|
||||
// these prefer folder
|
||||
imageFileNames = MusicImageFileNames;
|
||||
imageFileNames = _musicImageFileNames;
|
||||
}
|
||||
else if (item is Person)
|
||||
{
|
||||
// these prefer folder
|
||||
imageFileNames = PersonImageFileNames;
|
||||
imageFileNames = _personImageFileNames;
|
||||
}
|
||||
else if (item is Series)
|
||||
{
|
||||
imageFileNames = SeriesImageFileNames;
|
||||
imageFileNames = _seriesImageFileNames;
|
||||
}
|
||||
else if (item is Video && !(item is Episode))
|
||||
{
|
||||
imageFileNames = VideoImageFileNames;
|
||||
imageFileNames = _videoImageFileNames;
|
||||
}
|
||||
else
|
||||
{
|
||||
imageFileNames = CommonImageFileNames;
|
||||
imageFileNames = _commonImageFileNames;
|
||||
}
|
||||
|
||||
var fileNameWithoutExtension = item.FileNameWithoutExtension;
|
||||
|
@ -301,7 +323,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
}
|
||||
}
|
||||
|
||||
private void PopulateBackdrops(BaseItem item, List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder, IDirectoryService directoryService)
|
||||
private void PopulateBackdrops(BaseItem item, List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.Path))
|
||||
{
|
||||
|
@ -328,13 +350,13 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
|
||||
if (extraFanartFolder != null)
|
||||
{
|
||||
PopulateBackdropsFromExtraFanart(extraFanartFolder.FullName, images, directoryService);
|
||||
PopulateBackdropsFromExtraFanart(extraFanartFolder.FullName, images);
|
||||
}
|
||||
|
||||
PopulateBackdrops(images, files, imagePrefix, "backdrop", "backdrop", isInMixedFolder, ImageType.Backdrop);
|
||||
}
|
||||
|
||||
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images, IDirectoryService directoryService)
|
||||
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images)
|
||||
{
|
||||
var imageFiles = _fileSystem.GetFiles(path, BaseItem.SupportedImageExtensions, false, false);
|
||||
|
||||
|
@ -395,8 +417,6 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
}
|
||||
}
|
||||
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
private void PopulateSeasonImagesFromSeriesFolder(Season season, List<LocalImageInfo> images, IDirectoryService directoryService)
|
||||
{
|
||||
var seasonNumber = season.IndexNumber;
|
||||
|
@ -410,7 +430,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
var seriesFiles = GetFiles(series, false, directoryService).ToList();
|
||||
|
||||
// Try using the season name
|
||||
var prefix = season.Name.ToLowerInvariant().Replace(" ", string.Empty);
|
||||
var prefix = season.Name.Replace(" ", string.Empty, StringComparison.Ordinal).ToLowerInvariant();
|
||||
|
||||
var filenamePrefixes = new List<string> { prefix };
|
||||
|
||||
|
|
|
@ -10,14 +10,28 @@
|
|||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SharedVersion.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SharedVersion.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
|
||||
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
|
||||
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,8 +7,22 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Parsers
|
||||
{
|
||||
/// <summary>
|
||||
/// The box set xml parser.
|
||||
/// </summary>
|
||||
public class BoxSetXmlParser : BaseItemXmlParser<BoxSet>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BoxSetXmlParser"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{BoxSetXmlParset}"/> interface.</param>
|
||||
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
||||
public BoxSetXmlParser(ILogger<BoxSetXmlParser> logger, IProviderManager providerManager)
|
||||
: base(logger, providerManager)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<BoxSet> item)
|
||||
{
|
||||
switch (reader.Name)
|
||||
|
@ -50,32 +64,32 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "CollectionItem":
|
||||
{
|
||||
if (!reader.IsEmptyElement)
|
||||
{
|
||||
if (!reader.IsEmptyElement)
|
||||
using (var subReader = reader.ReadSubtree())
|
||||
{
|
||||
using (var subReader = reader.ReadSubtree())
|
||||
{
|
||||
var child = GetLinkedChild(subReader);
|
||||
var child = GetLinkedChild(subReader);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
list.Add(child);
|
||||
}
|
||||
if (child != null)
|
||||
{
|
||||
list.Add(child);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
{
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -86,10 +100,5 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
|
||||
item.Item.LinkedChildren = list.ToArray();
|
||||
}
|
||||
|
||||
public BoxSetXmlParser(ILogger<BoxSetXmlParser> logger, IProviderManager providerManager)
|
||||
: base(logger, providerManager)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,22 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Parsers
|
||||
{
|
||||
/// <summary>
|
||||
/// Playlist xml parser.
|
||||
/// </summary>
|
||||
public class PlaylistXmlParser : BaseItemXmlParser<Playlist>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PlaylistXmlParser"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{PlaylistXmlParser}"/> interface.</param>
|
||||
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
||||
public PlaylistXmlParser(ILogger<PlaylistXmlParser> logger, IProviderManager providerManager)
|
||||
: base(logger, providerManager)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Playlist> result)
|
||||
{
|
||||
var item = result.Item;
|
||||
|
@ -16,11 +30,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "PlaylistMediaType":
|
||||
{
|
||||
item.PlaylistMediaType = reader.ReadElementContentAsString();
|
||||
{
|
||||
item.PlaylistMediaType = reader.ReadElementContentAsString();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "PlaylistItems":
|
||||
|
||||
|
@ -59,31 +73,31 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "PlaylistItem":
|
||||
{
|
||||
if (reader.IsEmptyElement)
|
||||
{
|
||||
if (reader.IsEmptyElement)
|
||||
{
|
||||
reader.Read();
|
||||
continue;
|
||||
}
|
||||
|
||||
using (var subReader = reader.ReadSubtree())
|
||||
{
|
||||
var child = GetLinkedChild(subReader);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
list.Add(child);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
reader.Read();
|
||||
continue;
|
||||
}
|
||||
|
||||
using (var subReader = reader.ReadSubtree())
|
||||
{
|
||||
var child = GetLinkedChild(subReader);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
list.Add(child);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
{
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -94,10 +108,5 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
|
||||
item.LinkedChildren = list.ToArray();
|
||||
}
|
||||
|
||||
public PlaylistXmlParser(ILogger<PlaylistXmlParser> logger, IProviderManager providerManager)
|
||||
: base(logger, providerManager)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,12 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||
private readonly ILogger<BoxSetXmlParser> _logger;
|
||||
private readonly IProviderManager _providerManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BoxSetXmlProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{BoxSetXmlParser}"/> interface.</param>
|
||||
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
||||
public BoxSetXmlProvider(IFileSystem fileSystem, ILogger<BoxSetXmlParser> logger, IProviderManager providerManager)
|
||||
: base(fileSystem)
|
||||
{
|
||||
|
@ -23,11 +29,13 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||
_providerManager = providerManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Fetch(MetadataResult<BoxSet> result, string path, CancellationToken cancellationToken)
|
||||
{
|
||||
new BoxSetXmlParser(_logger, _providerManager).Fetch(result, path, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||
{
|
||||
return directoryService.GetFile(Path.Combine(info.Path, "collection.xml"));
|
||||
|
|
|
@ -8,11 +8,20 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Playlist xml provider.
|
||||
/// </summary>
|
||||
public class PlaylistXmlProvider : BaseXmlProvider<Playlist>
|
||||
{
|
||||
private readonly ILogger<PlaylistXmlParser> _logger;
|
||||
private readonly IProviderManager _providerManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PlaylistXmlProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{PlaylistXmlParser}"/> interface.</param>
|
||||
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
||||
public PlaylistXmlProvider(
|
||||
IFileSystem fileSystem,
|
||||
ILogger<PlaylistXmlParser> logger,
|
||||
|
@ -23,14 +32,16 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||
_providerManager = providerManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Fetch(MetadataResult<Playlist> result, string path, CancellationToken cancellationToken)
|
||||
{
|
||||
new PlaylistXmlParser(_logger, _providerManager).Fetch(result, path, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||
{
|
||||
return directoryService.GetFile(PlaylistXmlSaver.GetSavePath(info.Path, FileSystem));
|
||||
return directoryService.GetFile(PlaylistXmlSaver.GetSavePath(info.Path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,25 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Savers
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public abstract class BaseXmlSaver : IMetadataFileSaver
|
||||
{
|
||||
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||
/// <summary>
|
||||
/// Gets the date added format.
|
||||
/// </summary>
|
||||
public const string DateAddedFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseXmlSaver"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
/// <param name="configurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
||||
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
|
||||
/// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
|
||||
/// <param name="userDataManager">Instance of the <see cref="IUserDataManager"/> interface.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{BaseXmlSaver}"/> interface.</param>
|
||||
public BaseXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger<BaseXmlSaver> logger)
|
||||
{
|
||||
FileSystem = fileSystem;
|
||||
|
@ -31,20 +46,40 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file system.
|
||||
/// </summary>
|
||||
protected IFileSystem FileSystem { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration manager.
|
||||
/// </summary>
|
||||
protected IServerConfigurationManager ConfigurationManager { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the library manager.
|
||||
/// </summary>
|
||||
protected ILibraryManager LibraryManager { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user manager.
|
||||
/// </summary>
|
||||
protected IUserManager UserManager { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user data manager.
|
||||
/// </summary>
|
||||
protected IUserDataManager UserDataManager { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the logger.
|
||||
/// </summary>
|
||||
protected ILogger<BaseXmlSaver> Logger { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => XmlProviderUtils.Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetSavePath(BaseItem item)
|
||||
{
|
||||
return GetLocalSavePath(item);
|
||||
|
@ -75,20 +110,19 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||
public abstract bool IsEnabledFor(BaseItem item, ItemUpdateType updateType);
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Save(BaseItem item, CancellationToken cancellationToken)
|
||||
{
|
||||
var path = GetSavePath(item);
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
Save(item, memoryStream, path);
|
||||
using var memoryStream = new MemoryStream();
|
||||
Save(item, memoryStream);
|
||||
|
||||
memoryStream.Position = 0;
|
||||
memoryStream.Position = 0;
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
SaveToFile(memoryStream, path);
|
||||
}
|
||||
SaveToFile(memoryStream, path);
|
||||
}
|
||||
|
||||
private void SaveToFile(Stream stream, string path)
|
||||
|
@ -120,7 +154,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
}
|
||||
|
||||
private void Save(BaseItem item, Stream stream, string xmlPath)
|
||||
private void Save(BaseItem item, Stream stream)
|
||||
{
|
||||
var settings = new XmlWriterSettings
|
||||
{
|
||||
|
@ -141,7 +175,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
if (baseItem != null)
|
||||
{
|
||||
AddCommonNodes(baseItem, writer, LibraryManager, UserManager, UserDataManager, FileSystem, ConfigurationManager);
|
||||
AddCommonNodes(baseItem, writer, LibraryManager);
|
||||
}
|
||||
|
||||
WriteCustomElements(item, writer);
|
||||
|
@ -152,22 +186,27 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write custom elements.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="writer">The xml writer.</param>
|
||||
protected abstract void WriteCustomElements(BaseItem item, XmlWriter writer);
|
||||
|
||||
public const string DateAddedFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/// <summary>
|
||||
/// Adds the common nodes.
|
||||
/// </summary>
|
||||
/// <returns>Task.</returns>
|
||||
public static void AddCommonNodes(BaseItem item, XmlWriter writer, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataRepo, IFileSystem fileSystem, IServerConfigurationManager config)
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="writer">The xml writer.</param>
|
||||
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
|
||||
public static void AddCommonNodes(BaseItem item, XmlWriter writer, ILibraryManager libraryManager)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.OfficialRating))
|
||||
{
|
||||
writer.WriteElementString("ContentRating", item.OfficialRating);
|
||||
}
|
||||
|
||||
writer.WriteElementString("Added", item.DateCreated.ToLocalTime().ToString("G"));
|
||||
writer.WriteElementString("Added", item.DateCreated.ToLocalTime().ToString("G", CultureInfo.InvariantCulture));
|
||||
|
||||
writer.WriteElementString("LockData", item.IsLocked.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
|
||||
|
||||
|
@ -178,7 +217,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
if (item.CriticRating.HasValue)
|
||||
{
|
||||
writer.WriteElementString("CriticRating", item.CriticRating.Value.ToString(UsCulture));
|
||||
writer.WriteElementString("CriticRating", item.CriticRating.Value.ToString(_usCulture));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(item.Overview))
|
||||
|
@ -211,11 +250,11 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
{
|
||||
if (item is Person)
|
||||
{
|
||||
writer.WriteElementString("BirthDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd"));
|
||||
writer.WriteElementString("BirthDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (!(item is Episode))
|
||||
{
|
||||
writer.WriteElementString("PremiereDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd"));
|
||||
writer.WriteElementString("PremiereDate", item.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,11 +262,11 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
{
|
||||
if (item is Person)
|
||||
{
|
||||
writer.WriteElementString("DeathDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd"));
|
||||
writer.WriteElementString("DeathDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (!(item is Episode))
|
||||
{
|
||||
writer.WriteElementString("EndDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd"));
|
||||
writer.WriteElementString("EndDate", item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,12 +302,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
if (item.CommunityRating.HasValue)
|
||||
{
|
||||
writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(UsCulture));
|
||||
writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(_usCulture));
|
||||
}
|
||||
|
||||
if (item.ProductionYear.HasValue && !(item is Person))
|
||||
{
|
||||
writer.WriteElementString("ProductionYear", item.ProductionYear.Value.ToString(UsCulture));
|
||||
writer.WriteElementString("ProductionYear", item.ProductionYear.Value.ToString(_usCulture));
|
||||
}
|
||||
|
||||
var hasAspectRatio = item as IHasAspectRatio;
|
||||
|
@ -295,9 +334,9 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
if (runTimeTicks.HasValue)
|
||||
{
|
||||
var timespan = TimeSpan.FromTicks(runTimeTicks.Value);
|
||||
var timespan = TimeSpan.FromTicks(runTimeTicks!.Value);
|
||||
|
||||
writer.WriteElementString("RunningTime", Math.Floor(timespan.TotalMinutes).ToString(UsCulture));
|
||||
writer.WriteElementString("RunningTime", Math.Floor(timespan.TotalMinutes).ToString(_usCulture));
|
||||
}
|
||||
|
||||
if (item.ProviderIds != null)
|
||||
|
@ -370,7 +409,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
if (person.SortOrder.HasValue)
|
||||
{
|
||||
writer.WriteElementString("SortOrder", person.SortOrder.Value.ToString(UsCulture));
|
||||
writer.WriteElementString("SortOrder", person.SortOrder.Value.ToString(_usCulture));
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
@ -400,6 +439,11 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
AddMediaInfo(item, writer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add shares.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="writer">The xml writer.</param>
|
||||
public static void AddShares(IHasShares item, XmlWriter writer)
|
||||
{
|
||||
writer.WriteStartElement("Shares");
|
||||
|
@ -422,13 +466,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
/// <summary>
|
||||
/// Appends the media info.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="writer">The xml writer.</param>
|
||||
/// <typeparam name="T">Type of item.</typeparam>
|
||||
public static void AddMediaInfo<T>(T item, XmlWriter writer)
|
||||
where T : BaseItem
|
||||
{
|
||||
var video = item as Video;
|
||||
|
||||
if (video != null)
|
||||
if (item is Video video)
|
||||
{
|
||||
if (video.Video3DFormat.HasValue)
|
||||
{
|
||||
|
@ -454,6 +498,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ADd linked children.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="writer">The xml writer.</param>
|
||||
/// <param name="pluralNodeName">The plural node name.</param>
|
||||
/// <param name="singularNodeName">The singular node name.</param>
|
||||
public static void AddLinkedChildren(Folder item, XmlWriter writer, string pluralNodeName, string singularNodeName)
|
||||
{
|
||||
var items = item.LinkedChildren
|
||||
|
|
|
@ -9,8 +9,26 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Savers
|
||||
{
|
||||
/// <summary>
|
||||
/// Box set xml saver.
|
||||
/// </summary>
|
||||
public class BoxSetXmlSaver : BaseXmlSaver
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BoxSetXmlSaver"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
/// <param name="configurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
||||
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
|
||||
/// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
|
||||
/// <param name="userDataManager">Instance of the <see cref="IUserDataManager"/> interface.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{BoxSetXmlSaver}"/> interface.</param>
|
||||
public BoxSetXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger<BoxSetXmlSaver> logger)
|
||||
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
||||
{
|
||||
if (!item.SupportsLocalMetadata)
|
||||
|
@ -21,18 +39,15 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
return item is BoxSet && updateType >= ItemUpdateType.MetadataDownload;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override string GetLocalSavePath(BaseItem item)
|
||||
{
|
||||
return Path.Combine(item.Path, "collection.xml");
|
||||
}
|
||||
|
||||
public BoxSetXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger<BoxSetXmlSaver> logger)
|
||||
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace MediaBrowser.LocalMetadata.Savers
|
||||
{
|
||||
/// <summary>
|
||||
/// Playlist xml saver.
|
||||
/// </summary>
|
||||
public class PlaylistXmlSaver : BaseXmlSaver
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -16,6 +19,21 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
/// </summary>
|
||||
public const string DefaultPlaylistFilename = "playlist.xml";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PlaylistXmlSaver"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
||||
/// <param name="configurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
||||
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
|
||||
/// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
|
||||
/// <param name="userDataManager">Instance of the <see cref="IUserDataManager"/> interface.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{PlaylistXmlSaver}"/> interface.</param>
|
||||
public PlaylistXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger<PlaylistXmlSaver> logger)
|
||||
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
||||
{
|
||||
if (!item.SupportsLocalMetadata)
|
||||
|
@ -26,6 +44,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
return item is Playlist && updateType >= ItemUpdateType.MetadataImport;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
|
||||
{
|
||||
var game = (Playlist)item;
|
||||
|
@ -36,12 +55,18 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override string GetLocalSavePath(BaseItem item)
|
||||
{
|
||||
return GetSavePath(item.Path, FileSystem);
|
||||
return GetSavePath(item.Path);
|
||||
}
|
||||
|
||||
public static string GetSavePath(string itemPath, IFileSystem fileSystem)
|
||||
/// <summary>
|
||||
/// Get the save path.
|
||||
/// </summary>
|
||||
/// <param name="itemPath">The item path.</param>
|
||||
/// <returns>The save path.</returns>
|
||||
public static string GetSavePath(string itemPath)
|
||||
{
|
||||
var path = itemPath;
|
||||
|
||||
|
@ -52,10 +77,5 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
return Path.Combine(path, DefaultPlaylistFilename);
|
||||
}
|
||||
|
||||
public PlaylistXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger<PlaylistXmlSaver> logger)
|
||||
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
13
MediaBrowser.LocalMetadata/XmlProviderUtils.cs
Normal file
13
MediaBrowser.LocalMetadata/XmlProviderUtils.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace MediaBrowser.LocalMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// The xml provider utils.
|
||||
/// </summary>
|
||||
public static class XmlProviderUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
public static string Name => "Emby Xml";
|
||||
}
|
||||
}
|
|
@ -166,7 +166,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
/// Validates the supplied FQPN to ensure it is a ffmpeg utility.
|
||||
/// If checks pass, global variable FFmpegPath and EncoderLocation are updated.
|
||||
/// </summary>
|
||||
/// <param name="path">FQPN to test</param>
|
||||
/// <param name="path">FQPN to test.</param>
|
||||
/// <param name="location">Location (External, Custom, System) of tool</param>
|
||||
/// <returns></returns>
|
||||
private bool ValidatePath(string path, FFmpegLocation location)
|
||||
|
|
|
@ -1065,23 +1065,43 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||
|
||||
// These support mulitple values, but for now we only store the first.
|
||||
var mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id"));
|
||||
if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMARTISTID"));
|
||||
if (mb == null)
|
||||
{
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMARTISTID"));
|
||||
}
|
||||
|
||||
audio.SetProviderId(MetadataProvider.MusicBrainzAlbumArtist, mb);
|
||||
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id"));
|
||||
if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ARTISTID"));
|
||||
if (mb == null)
|
||||
{
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ARTISTID"));
|
||||
}
|
||||
|
||||
audio.SetProviderId(MetadataProvider.MusicBrainzArtist, mb);
|
||||
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Id"));
|
||||
if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMID"));
|
||||
if (mb == null)
|
||||
{
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMID"));
|
||||
}
|
||||
|
||||
audio.SetProviderId(MetadataProvider.MusicBrainzAlbum, mb);
|
||||
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Group Id"));
|
||||
if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASEGROUPID"));
|
||||
if (mb == null)
|
||||
{
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASEGROUPID"));
|
||||
}
|
||||
|
||||
audio.SetProviderId(MetadataProvider.MusicBrainzReleaseGroup, mb);
|
||||
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Track Id"));
|
||||
if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASETRACKID"));
|
||||
if (mb == null)
|
||||
{
|
||||
mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASETRACKID"));
|
||||
}
|
||||
|
||||
audio.SetProviderId(MetadataProvider.MusicBrainzTrack, mb);
|
||||
}
|
||||
|
||||
|
@ -1364,14 +1384,18 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||
description = string.Join(" ", numbers, 1, numbers.Length - 1).Trim(); // Skip the first, concatenate the rest, clean up spaces and save it
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(); // Switch to default parsing
|
||||
}
|
||||
}
|
||||
catch // Default parsing
|
||||
{
|
||||
if (subtitle.Contains(".")) // skip the comment, keep the subtitle
|
||||
description = string.Join(".", subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first
|
||||
else
|
||||
{
|
||||
description = subtitle.Trim(); // Clean up whitespaces and save it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,10 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
var endTime = time[1];
|
||||
var idx = endTime.IndexOf(" ", StringComparison.Ordinal);
|
||||
if (idx > 0)
|
||||
{
|
||||
endTime = endTime.Substring(0, idx);
|
||||
}
|
||||
|
||||
subEvent.EndPositionTicks = GetTicks(endTime);
|
||||
var multiline = new List<string>();
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
|
|
|
@ -41,7 +41,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
|
||||
lineNumber++;
|
||||
if (!eventsStarted)
|
||||
{
|
||||
header.AppendLine(line);
|
||||
}
|
||||
|
||||
if (line.Trim().ToLowerInvariant() == "[events]")
|
||||
{
|
||||
|
@ -62,17 +64,29 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
for (int i = 0; i < format.Length; i++)
|
||||
{
|
||||
if (format[i].Trim().ToLowerInvariant() == "layer")
|
||||
{
|
||||
indexLayer = i;
|
||||
}
|
||||
else if (format[i].Trim().ToLowerInvariant() == "start")
|
||||
{
|
||||
indexStart = i;
|
||||
}
|
||||
else if (format[i].Trim().ToLowerInvariant() == "end")
|
||||
{
|
||||
indexEnd = i;
|
||||
}
|
||||
else if (format[i].Trim().ToLowerInvariant() == "text")
|
||||
{
|
||||
indexText = i;
|
||||
}
|
||||
else if (format[i].Trim().ToLowerInvariant() == "effect")
|
||||
{
|
||||
indexEffect = i;
|
||||
}
|
||||
else if (format[i].Trim().ToLowerInvariant() == "style")
|
||||
{
|
||||
indexStyle = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,28 +103,48 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
string[] splittedLine;
|
||||
|
||||
if (s.StartsWith("dialogue:"))
|
||||
{
|
||||
splittedLine = line.Substring(10).Split(',');
|
||||
}
|
||||
else
|
||||
{
|
||||
splittedLine = line.Split(',');
|
||||
}
|
||||
|
||||
for (int i = 0; i < splittedLine.Length; i++)
|
||||
{
|
||||
if (i == indexStart)
|
||||
{
|
||||
start = splittedLine[i].Trim();
|
||||
}
|
||||
else if (i == indexEnd)
|
||||
{
|
||||
end = splittedLine[i].Trim();
|
||||
}
|
||||
else if (i == indexLayer)
|
||||
{
|
||||
layer = splittedLine[i];
|
||||
}
|
||||
else if (i == indexEffect)
|
||||
{
|
||||
effect = splittedLine[i];
|
||||
}
|
||||
else if (i == indexText)
|
||||
{
|
||||
text = splittedLine[i];
|
||||
}
|
||||
else if (i == indexStyle)
|
||||
{
|
||||
style = splittedLine[i];
|
||||
}
|
||||
else if (i == indexName)
|
||||
{
|
||||
name = splittedLine[i];
|
||||
}
|
||||
else if (i > indexText)
|
||||
{
|
||||
text += "," + splittedLine[i];
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -169,15 +203,23 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
CheckAndAddSubTags(ref fontName, ref extraTags, out italic);
|
||||
text = text.Remove(start, end - start + 1);
|
||||
if (italic)
|
||||
{
|
||||
text = text.Insert(start, "<font face=\"" + fontName + "\"" + extraTags + "><i>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text.Insert(start, "<font face=\"" + fontName + "\"" + extraTags + ">");
|
||||
}
|
||||
|
||||
int indexOfEndTag = text.IndexOf("{\\fn}", start);
|
||||
if (indexOfEndTag > 0)
|
||||
{
|
||||
text = text.Remove(indexOfEndTag, "{\\fn}".Length).Insert(indexOfEndTag, "</font>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text += "</font>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,15 +236,23 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
{
|
||||
text = text.Remove(start, end - start + 1);
|
||||
if (italic)
|
||||
{
|
||||
text = text.Insert(start, "<font size=\"" + fontSize + "\"" + extraTags + "><i>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text.Insert(start, "<font size=\"" + fontSize + "\"" + extraTags + ">");
|
||||
}
|
||||
|
||||
int indexOfEndTag = text.IndexOf("{\\fs}", start);
|
||||
if (indexOfEndTag > 0)
|
||||
{
|
||||
text = text.Remove(indexOfEndTag, "{\\fs}".Length).Insert(indexOfEndTag, "</font>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text += "</font>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,14 +276,22 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
|
||||
text = text.Remove(start, end - start + 1);
|
||||
if (italic)
|
||||
{
|
||||
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + "><i>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + ">");
|
||||
}
|
||||
int indexOfEndTag = text.IndexOf("{\\c}", start);
|
||||
if (indexOfEndTag > 0)
|
||||
{
|
||||
text = text.Remove(indexOfEndTag, "{\\c}".Length).Insert(indexOfEndTag, "</font>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text += "</font>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,9 +314,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
|
||||
text = text.Remove(start, end - start + 1);
|
||||
if (italic)
|
||||
{
|
||||
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + "><i>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + ">");
|
||||
}
|
||||
text += "</font>";
|
||||
}
|
||||
}
|
||||
|
@ -268,19 +330,25 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
text = text.Replace(@"{\i0}", "</i>");
|
||||
text = text.Replace(@"{\i}", "</i>");
|
||||
if (CountTagInText(text, "<i>") > CountTagInText(text, "</i>"))
|
||||
{
|
||||
text += "</i>";
|
||||
}
|
||||
|
||||
text = text.Replace(@"{\u1}", "<u>");
|
||||
text = text.Replace(@"{\u0}", "</u>");
|
||||
text = text.Replace(@"{\u}", "</u>");
|
||||
if (CountTagInText(text, "<u>") > CountTagInText(text, "</u>"))
|
||||
{
|
||||
text += "</u>";
|
||||
}
|
||||
|
||||
text = text.Replace(@"{\b1}", "<b>");
|
||||
text = text.Replace(@"{\b0}", "</b>");
|
||||
text = text.Replace(@"{\b}", "</b>");
|
||||
if (CountTagInText(text, "<b>") > CountTagInText(text, "</b>"))
|
||||
{
|
||||
text += "</b>";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
@ -288,7 +356,10 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
private static bool IsInteger(string s)
|
||||
{
|
||||
if (int.TryParse(s, out var i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -300,7 +371,10 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
{
|
||||
count++;
|
||||
if (index == text.Length)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
index = text.IndexOf(tag, index + 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,11 @@ namespace MediaBrowser.Model.Configuration
|
|||
public string EncoderPreset { get; set; }
|
||||
|
||||
public string DeinterlaceMethod { get; set; }
|
||||
|
||||
public bool EnableDecodingColorDepth10Hevc { get; set; }
|
||||
|
||||
public bool EnableDecodingColorDepth10Vp9 { get; set; }
|
||||
|
||||
public bool EnableHardwareEncoding { get; set; }
|
||||
|
||||
public bool EnableSubtitleExtraction { get; set; }
|
||||
|
|
|
@ -32,18 +32,25 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
|
||||
if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.AVI };
|
||||
}
|
||||
|
||||
if (string.Equals(container, "mkv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA };
|
||||
}
|
||||
|
||||
if (string.Equals(container, "mpeg2ps", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(container, "ts", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
|
||||
}
|
||||
|
||||
if (string.Equals(container, "mpeg1video", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 };
|
||||
}
|
||||
|
||||
if (string.Equals(container, "mpeg2ts", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(container, "mpegts", StringComparison.OrdinalIgnoreCase) ||
|
||||
|
@ -54,10 +61,14 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
|
||||
if (string.Equals(container, "flv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.FLV };
|
||||
}
|
||||
|
||||
if (string.Equals(container, "wtv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.WTV };
|
||||
}
|
||||
|
||||
if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -66,7 +77,9 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
|
||||
if (string.Equals(container, "ogv", StringComparison.OrdinalIgnoreCase) || string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.OGV };
|
||||
}
|
||||
|
||||
return Array.Empty<MediaFormatProfile>();
|
||||
}
|
||||
|
@ -111,7 +124,9 @@ namespace MediaBrowser.Model.Dlna
|
|||
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "dts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -134,14 +149,20 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
|
||||
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(audioCodec) ||
|
||||
string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
|
||||
}
|
||||
}
|
||||
else if (string.Equals(videoCodec, "vc1", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -165,13 +186,24 @@ namespace MediaBrowser.Model.Dlna
|
|||
else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "mp2", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
|
||||
}
|
||||
}
|
||||
|
||||
return new MediaFormatProfile[] { };
|
||||
|
@ -187,7 +219,10 @@ namespace MediaBrowser.Model.Dlna
|
|||
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.AVC_MP4_LPCM;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(audioCodec) ||
|
||||
string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -204,12 +239,16 @@ namespace MediaBrowser.Model.Dlna
|
|||
if ((width.Value <= 720) && (height.Value <= 576))
|
||||
{
|
||||
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.AVC_MP4_MP_SD_AAC_MULT5;
|
||||
}
|
||||
}
|
||||
else if ((width.Value <= 1280) && (height.Value <= 720))
|
||||
{
|
||||
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.AVC_MP4_MP_HD_720p_AAC;
|
||||
}
|
||||
}
|
||||
else if ((width.Value <= 1920) && (height.Value <= 1080))
|
||||
{
|
||||
|
@ -226,7 +265,10 @@ namespace MediaBrowser.Model.Dlna
|
|||
if (width.HasValue && height.HasValue && width.Value <= 720 && height.Value <= 576)
|
||||
{
|
||||
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.MPEG4_P2_MP4_ASP_AAC;
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase) || string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.MPEG4_P2_MP4_NDSD;
|
||||
|
@ -250,15 +292,22 @@ namespace MediaBrowser.Model.Dlna
|
|||
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.AVC_3GPP_BL_QCIF15_AAC;
|
||||
}
|
||||
}
|
||||
else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AAC;
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AMR;
|
||||
}
|
||||
}
|
||||
else if (string.Equals(videoCodec, "h263", StringComparison.OrdinalIgnoreCase) && string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -300,11 +349,19 @@ namespace MediaBrowser.Model.Dlna
|
|||
if (width.HasValue && height.HasValue)
|
||||
{
|
||||
if ((width.Value <= 720) && (height.Value <= 576))
|
||||
{
|
||||
return MediaFormatProfile.VC1_ASF_AP_L1_WMA;
|
||||
}
|
||||
|
||||
if ((width.Value <= 1280) && (height.Value <= 720))
|
||||
{
|
||||
return MediaFormatProfile.VC1_ASF_AP_L2_WMA;
|
||||
}
|
||||
|
||||
if ((width.Value <= 1920) && (height.Value <= 1080))
|
||||
{
|
||||
return MediaFormatProfile.VC1_ASF_AP_L3_WMA;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
|
||||
|
@ -318,27 +375,41 @@ namespace MediaBrowser.Model.Dlna
|
|||
public MediaFormatProfile? ResolveAudioFormat(string container, int? bitrate, int? frequency, int? channels)
|
||||
{
|
||||
if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ResolveAudioASFFormat(bitrate);
|
||||
}
|
||||
|
||||
if (string.Equals(container, "mp3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.MP3;
|
||||
}
|
||||
|
||||
if (string.Equals(container, "lpcm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ResolveAudioLPCMFormat(frequency, channels);
|
||||
}
|
||||
|
||||
if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(container, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ResolveAudioMP4Format(bitrate);
|
||||
}
|
||||
|
||||
if (string.Equals(container, "adts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ResolveAudioADTSFormat(bitrate);
|
||||
}
|
||||
|
||||
if (string.Equals(container, "flac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.FLAC;
|
||||
}
|
||||
|
||||
if (string.Equals(container, "oga", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.OGG;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -410,13 +481,19 @@ namespace MediaBrowser.Model.Dlna
|
|||
return ResolveImageJPGFormat(width, height);
|
||||
|
||||
if (string.Equals(container, "png", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ResolveImagePNGFormat(width, height);
|
||||
}
|
||||
|
||||
if (string.Equals(container, "gif", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.GIF_LRG;
|
||||
}
|
||||
|
||||
if (string.Equals(container, "raw", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return MediaFormatProfile.RAW;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -426,10 +503,14 @@ namespace MediaBrowser.Model.Dlna
|
|||
if (width.HasValue && height.HasValue)
|
||||
{
|
||||
if ((width.Value <= 160) && (height.Value <= 160))
|
||||
{
|
||||
return MediaFormatProfile.JPEG_TN;
|
||||
}
|
||||
|
||||
if ((width.Value <= 640) && (height.Value <= 480))
|
||||
{
|
||||
return MediaFormatProfile.JPEG_SM;
|
||||
}
|
||||
|
||||
if ((width.Value <= 1024) && (height.Value <= 768))
|
||||
{
|
||||
|
@ -447,7 +528,9 @@ namespace MediaBrowser.Model.Dlna
|
|||
if (width.HasValue && height.HasValue)
|
||||
{
|
||||
if ((width.Value <= 160) && (height.Value <= 160))
|
||||
{
|
||||
return MediaFormatProfile.PNG_TN;
|
||||
}
|
||||
}
|
||||
|
||||
return MediaFormatProfile.PNG_LRG;
|
||||
|
|
|
@ -384,7 +384,10 @@ namespace MediaBrowser.Model.Dlna
|
|||
audioCodecProfiles.Add(i);
|
||||
}
|
||||
|
||||
if (audioCodecProfiles.Count >= 1) break;
|
||||
if (audioCodecProfiles.Count >= 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var audioTranscodingConditions = new List<ProfileCondition>();
|
||||
|
|
|
@ -421,7 +421,10 @@ namespace MediaBrowser.Model.Entities
|
|||
{
|
||||
get
|
||||
{
|
||||
if (Type != MediaStreamType.Subtitle) return false;
|
||||
if (Type != MediaStreamType.Subtitle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Codec) && !IsExternal)
|
||||
{
|
||||
|
|
|
@ -124,8 +124,8 @@ namespace MediaBrowser.Model.Services
|
|||
/// Gets or sets a query parameter value by name. A query may contain multiple values of the same name
|
||||
/// (i.e. "x=1&x=2"), in which case the value is an array, which works for both getting and setting.
|
||||
/// </summary>
|
||||
/// <param name="name">The query parameter name</param>
|
||||
/// <returns>The query parameter value or array of values</returns>
|
||||
/// <param name="name">The query parameter name.</param>
|
||||
/// <returns>The query parameter value or array of values.</returns>
|
||||
public string this[string name]
|
||||
{
|
||||
get => Get(name);
|
||||
|
|
|
@ -128,9 +128,21 @@ namespace MediaBrowser.Model.Services
|
|||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ReferenceEquals(this, obj))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj.GetType() != this.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Equals((RouteAttribute)obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable CS1591
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user