mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
Merge branch 'master' into comparisons
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#pragma warning disable CS1591
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Drawing
|
||||
{
|
||||
|
||||
@@ -120,8 +120,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
|
||||
{
|
||||
FileInfo = FileSystem.GetDirectoryInfo(path),
|
||||
Path = path
|
||||
FileInfo = FileSystem.GetDirectoryInfo(path)
|
||||
};
|
||||
|
||||
// Gather child folder and files
|
||||
|
||||
@@ -106,15 +106,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_themeSongIds == null)
|
||||
{
|
||||
_themeSongIds = GetExtras()
|
||||
.Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeSong)
|
||||
.Select(song => song.Id)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
return _themeSongIds;
|
||||
return _themeSongIds ??= GetExtras()
|
||||
.Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeSong)
|
||||
.Select(song => song.Id)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private set
|
||||
@@ -128,15 +123,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_themeVideoIds == null)
|
||||
{
|
||||
_themeVideoIds = GetExtras()
|
||||
.Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeVideo)
|
||||
.Select(song => song.Id)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
return _themeVideoIds;
|
||||
return _themeVideoIds ??= GetExtras()
|
||||
.Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeVideo)
|
||||
.Select(song => song.Id)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private set
|
||||
@@ -2324,7 +2314,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
.Where(i => i.IsLocalFile)
|
||||
.Select(i => System.IO.Path.GetDirectoryName(i.Path))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.SelectMany(i => directoryService.GetFilePaths(i))
|
||||
.SelectMany(directoryService.GetFilePaths)
|
||||
.ToList();
|
||||
|
||||
var deletedImages = ImageInfos
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#nullable enable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
@@ -64,9 +66,19 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="source">The source object.</param>
|
||||
/// <param name="dest">The destination object.</param>
|
||||
public static void DeepCopy<T, TU>(this T source, TU dest)
|
||||
where T : BaseItem
|
||||
where TU : BaseItem
|
||||
where T : BaseItem
|
||||
where TU : BaseItem
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
}
|
||||
|
||||
if (dest == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(dest));
|
||||
}
|
||||
|
||||
var destProps = typeof(TU).GetProperties().Where(x => x.CanWrite).ToList();
|
||||
|
||||
foreach (var sourceProp in typeof(T).GetProperties())
|
||||
@@ -99,8 +111,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
/// <param name="source">The source object.</param>
|
||||
public static TU DeepCopy<T, TU>(this T source)
|
||||
where T : BaseItem
|
||||
where TU : BaseItem, new()
|
||||
where T : BaseItem
|
||||
where TU : BaseItem, new()
|
||||
{
|
||||
var dest = new TU();
|
||||
source.DeepCopy(dest);
|
||||
|
||||
@@ -61,7 +61,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
try
|
||||
{
|
||||
var result = XmlSerializer.DeserializeFromFile(typeof(LibraryOptions), GetLibraryOptionsPath(path)) as LibraryOptions;
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return new LibraryOptions();
|
||||
@@ -271,7 +270,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
|
||||
{
|
||||
FileInfo = FileSystem.GetDirectoryInfo(path),
|
||||
Path = path,
|
||||
Parent = GetParent() as Folder,
|
||||
CollectionType = CollectionType
|
||||
};
|
||||
@@ -355,9 +353,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (result.Count == 0)
|
||||
{
|
||||
var folder = LibraryManager.FindByPath(path, true) as Folder;
|
||||
|
||||
if (folder != null)
|
||||
if (LibraryManager.FindByPath(path, true) is Folder folder)
|
||||
{
|
||||
result.Add(folder);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
@@ -1434,9 +1433,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
var linkedChildren = LinkedChildren;
|
||||
foreach (var i in linkedChildren)
|
||||
{
|
||||
if (i.ItemId.HasValue && i.ItemId.Value == itemId)
|
||||
if (i.ItemId.HasValue)
|
||||
{
|
||||
return true;
|
||||
if (i.ItemId.Value == itemId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
var child = GetLinkedChild(i);
|
||||
@@ -1764,20 +1768,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
EnableImages = false
|
||||
}
|
||||
});
|
||||
}).TotalRecordCount;
|
||||
|
||||
double unplayedCount = unplayedQueryResult.TotalRecordCount;
|
||||
dto.UnplayedItemCount = unplayedQueryResult;
|
||||
|
||||
dto.UnplayedItemCount = unplayedQueryResult.TotalRecordCount;
|
||||
|
||||
if (itemDto != null && itemDto.RecursiveItemCount.HasValue)
|
||||
if (itemDto?.RecursiveItemCount > 0)
|
||||
{
|
||||
if (itemDto.RecursiveItemCount.Value > 0)
|
||||
{
|
||||
var unplayedPercentage = (unplayedCount / itemDto.RecursiveItemCount.Value) * 100;
|
||||
dto.PlayedPercentage = 100 - unplayedPercentage;
|
||||
dto.Played = dto.PlayedPercentage.Value >= 100;
|
||||
}
|
||||
var unplayedPercentage = ((double)unplayedQueryResult / itemDto.RecursiveItemCount.Value) * 100;
|
||||
dto.PlayedPercentage = 100 - unplayedPercentage;
|
||||
dto.Played = dto.PlayedPercentage.Value >= 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -217,8 +217,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
|
||||
private IEnumerable<BaseItem> FlattenItems(BaseItem item, List<Guid> expandedFolders)
|
||||
{
|
||||
var boxset = item as BoxSet;
|
||||
if (boxset != null)
|
||||
if (item is BoxSet boxset)
|
||||
{
|
||||
if (!expandedFolders.Contains(item.Id))
|
||||
{
|
||||
|
||||
@@ -100,23 +100,5 @@ namespace MediaBrowser.Controller.Entities
|
||||
existing.SetProviderId(id.Key, id.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ContainsPerson(List<PersonInfo> people, string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
foreach (var i in people)
|
||||
{
|
||||
if (string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
var parents = GetParents();
|
||||
foreach (var parent in parents)
|
||||
{
|
||||
var photoAlbum = parent as PhotoAlbum;
|
||||
if (photoAlbum != null)
|
||||
if (parent is PhotoAlbum photoAlbum)
|
||||
{
|
||||
return photoAlbum;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,15 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
take--;
|
||||
}
|
||||
|
||||
list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000")));
|
||||
var newList = seriesUserDataKeys.GetRange(0, take);
|
||||
var suffix = ParentIndexNumber.Value.ToString("000", CultureInfo.InvariantCulture) + IndexNumber.Value.ToString("000", CultureInfo.InvariantCulture);
|
||||
for (int i = 0; i < take; i++)
|
||||
{
|
||||
newList[i] = newList[i] + suffix;
|
||||
}
|
||||
|
||||
newList.AddRange(list);
|
||||
list = newList;
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Jellyfin.Data.Entities;
|
||||
@@ -56,7 +57,15 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
var series = Series;
|
||||
if (series != null)
|
||||
{
|
||||
list.InsertRange(0, series.GetUserDataKeys().Select(i => i + (IndexNumber ?? 0).ToString("000")));
|
||||
var newList = series.GetUserDataKeys();
|
||||
var suffix = (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);
|
||||
for (int i = 0; i < newList.Count; i++)
|
||||
{
|
||||
newList[i] = newList[i] + suffix;
|
||||
}
|
||||
|
||||
newList.AddRange(list);
|
||||
list = newList;
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@@ -169,14 +169,12 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
var key = this.GetProviderId(MetadataProvider.Imdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
if (this.TryGetProviderId(MetadataProvider.Imdb, out var key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
}
|
||||
|
||||
key = this.GetProviderId(MetadataProvider.Tvdb);
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
if (this.TryGetProviderId(MetadataProvider.Tvdb, out key))
|
||||
{
|
||||
list.Insert(0, key);
|
||||
}
|
||||
@@ -208,7 +206,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
query.AncestorWithPresentationUniqueKey = null;
|
||||
query.SeriesPresentationUniqueKey = seriesKey;
|
||||
query.IncludeItemTypes = new[] { nameof(Season) };
|
||||
query.OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray();
|
||||
query.OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) };
|
||||
|
||||
if (user != null && !user.DisplayMissingEpisodes)
|
||||
{
|
||||
@@ -228,7 +226,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
query.SeriesPresentationUniqueKey = seriesKey;
|
||||
if (query.OrderBy.Count == 0)
|
||||
{
|
||||
query.OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray();
|
||||
query.OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) };
|
||||
}
|
||||
|
||||
if (query.IncludeItemTypes.Length == 0)
|
||||
@@ -254,7 +252,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
AncestorWithPresentationUniqueKey = null,
|
||||
SeriesPresentationUniqueKey = seriesKey,
|
||||
IncludeItemTypes = new[] { nameof(Episode), nameof(Season) },
|
||||
OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
DtoOptions = options
|
||||
};
|
||||
|
||||
@@ -318,20 +316,13 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var skipItem = false;
|
||||
|
||||
var episode = item as Episode;
|
||||
|
||||
if (episode != null
|
||||
bool skipItem = item is Episode episode
|
||||
&& refreshOptions.MetadataRefreshMode != MetadataRefreshMode.FullRefresh
|
||||
&& !refreshOptions.ReplaceAllMetadata
|
||||
&& episode.IsMissingEpisode
|
||||
&& episode.LocationType == LocationType.Virtual
|
||||
&& episode.PremiereDate.HasValue
|
||||
&& (DateTime.UtcNow - episode.PremiereDate.Value).TotalDays > 30)
|
||||
{
|
||||
skipItem = true;
|
||||
}
|
||||
&& (DateTime.UtcNow - episode.PremiereDate.Value).TotalDays > 30;
|
||||
|
||||
if (!skipItem)
|
||||
{
|
||||
@@ -365,7 +356,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
AncestorWithPresentationUniqueKey = queryFromSeries ? null : seriesKey,
|
||||
SeriesPresentationUniqueKey = queryFromSeries ? seriesKey : null,
|
||||
IncludeItemTypes = new[] { nameof(Episode) },
|
||||
OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
DtoOptions = options
|
||||
};
|
||||
if (user != null)
|
||||
|
||||
@@ -75,10 +75,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
query = new InternalItemsQuery(user);
|
||||
}
|
||||
query ??= new InternalItemsQuery(user);
|
||||
|
||||
query.EnableTotalRecordCount = false;
|
||||
var result = GetItemList(query);
|
||||
|
||||
@@ -217,8 +217,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private QueryResult<BaseItem> GetMovieLatest(Folder parent, User user, InternalItemsQuery query)
|
||||
{
|
||||
query.OrderBy = new[] { ItemSortBy.DateCreated, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
|
||||
|
||||
query.OrderBy = new[] { (ItemSortBy.DateCreated, SortOrder.Descending), (ItemSortBy.SortName, SortOrder.Descending) };
|
||||
query.Recursive = true;
|
||||
query.Parent = parent;
|
||||
query.SetUser(user);
|
||||
@@ -230,7 +229,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private QueryResult<BaseItem> GetMovieResume(Folder parent, User user, InternalItemsQuery query)
|
||||
{
|
||||
query.OrderBy = new[] { ItemSortBy.DatePlayed, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
|
||||
query.OrderBy = new[] { (ItemSortBy.DatePlayed, SortOrder.Descending), (ItemSortBy.SortName, SortOrder.Descending) };
|
||||
query.IsResumable = true;
|
||||
query.Recursive = true;
|
||||
query.Parent = parent;
|
||||
@@ -327,8 +326,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private QueryResult<BaseItem> GetTvLatest(Folder parent, User user, InternalItemsQuery query)
|
||||
{
|
||||
query.OrderBy = new[] { ItemSortBy.DateCreated, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
|
||||
|
||||
query.OrderBy = new[] { (ItemSortBy.DateCreated, SortOrder.Descending), (ItemSortBy.SortName, SortOrder.Descending) };
|
||||
query.Recursive = true;
|
||||
query.Parent = parent;
|
||||
query.SetUser(user);
|
||||
@@ -356,7 +354,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private QueryResult<BaseItem> GetTvResume(Folder parent, User user, InternalItemsQuery query)
|
||||
{
|
||||
query.OrderBy = new[] { ItemSortBy.DatePlayed, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Descending)).ToArray();
|
||||
query.OrderBy = new[] { (ItemSortBy.DatePlayed, SortOrder.Descending), (ItemSortBy.SortName, SortOrder.Descending) };
|
||||
query.IsResumable = true;
|
||||
query.Recursive = true;
|
||||
query.Parent = parent;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Jellyfin.Data.Events;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
|
||||
namespace MediaBrowser.Controller.Events.Updates
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Model.System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
|
||||
@@ -466,6 +466,15 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="people">The people.</param>
|
||||
void UpdatePeople(BaseItem item, List<PersonInfo> people);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously updates the people.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="people">The people.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The async task.</returns>
|
||||
Task UpdatePeopleAsync(BaseItem item, List<PersonInfo> people, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item ids.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace MediaBrowser.Controller.Library
|
||||
/// These are arguments relating to the file system that are collected once and then referred to
|
||||
/// whenever needed. Primarily for entity resolution.
|
||||
/// </summary>
|
||||
public class ItemResolveArgs : EventArgs
|
||||
public class ItemResolveArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The _app paths.
|
||||
/// </summary>
|
||||
private readonly IServerApplicationPaths _appPaths;
|
||||
|
||||
public IDirectoryService DirectoryService { get; private set; }
|
||||
private LibraryOptions _libraryOptions;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class.
|
||||
@@ -34,17 +34,18 @@ namespace MediaBrowser.Controller.Library
|
||||
DirectoryService = directoryService;
|
||||
}
|
||||
|
||||
public IDirectoryService DirectoryService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file system children.
|
||||
/// </summary>
|
||||
/// <value>The file system children.</value>
|
||||
public FileSystemMetadata[] FileSystemChildren { get; set; }
|
||||
|
||||
public LibraryOptions LibraryOptions { get; set; }
|
||||
|
||||
public LibraryOptions GetLibraryOptions()
|
||||
public LibraryOptions LibraryOptions
|
||||
{
|
||||
return LibraryOptions ?? (LibraryOptions = Parent == null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent));
|
||||
get => _libraryOptions ??= Parent == null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent);
|
||||
set => _libraryOptions = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,10 +61,10 @@ namespace MediaBrowser.Controller.Library
|
||||
public FileSystemMetadata FileInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
/// Gets the path.
|
||||
/// </summary>
|
||||
/// <value>The path.</value>
|
||||
public string Path { get; set; }
|
||||
public string Path => FileInfo.FullName;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is directory.
|
||||
@@ -139,7 +140,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// Adds the additional location.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <c>null</c> or empty.</exception>
|
||||
public void AddAdditionalLocation(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
@@ -147,11 +148,7 @@ namespace MediaBrowser.Controller.Library
|
||||
throw new ArgumentException("The path was empty or null.", nameof(path));
|
||||
}
|
||||
|
||||
if (AdditionalLocations == null)
|
||||
{
|
||||
AdditionalLocations = new List<string>();
|
||||
}
|
||||
|
||||
AdditionalLocations ??= new List<string>();
|
||||
AdditionalLocations.Add(path);
|
||||
}
|
||||
|
||||
@@ -175,7 +172,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>FileSystemInfo.</returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c> or empty.</exception>
|
||||
public FileSystemMetadata GetFileSystemEntryByName(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
|
||||
@@ -10,8 +10,6 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@@ -27,9 +25,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
private static readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ISubtitleEncoder _subtitleEncoder;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
private static readonly string[] _videoProfiles = new[]
|
||||
{
|
||||
@@ -44,14 +40,10 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
public EncodingHelper(
|
||||
IMediaEncoder mediaEncoder,
|
||||
IFileSystem fileSystem,
|
||||
ISubtitleEncoder subtitleEncoder,
|
||||
IConfiguration configuration)
|
||||
ISubtitleEncoder subtitleEncoder)
|
||||
{
|
||||
_mediaEncoder = mediaEncoder;
|
||||
_fileSystem = fileSystem;
|
||||
_subtitleEncoder = subtitleEncoder;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string GetH264Encoder(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
|
||||
@@ -9,7 +9,6 @@ using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Session;
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.System;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
|
||||
@@ -153,8 +153,7 @@ namespace MediaBrowser.Controller.Persistence
|
||||
/// <summary>
|
||||
/// Updates the inherited values.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void UpdateInheritedValues(CancellationToken cancellationToken);
|
||||
void UpdateInheritedValues();
|
||||
|
||||
int GetCount(InternalItemsQuery query);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace MediaBrowser.Controller.Playlists
|
||||
@@ -127,10 +126,7 @@ namespace MediaBrowser.Controller.Playlists
|
||||
|
||||
private List<BaseItem> GetPlayableItems(User user, InternalItemsQuery query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
query = new InternalItemsQuery(user);
|
||||
}
|
||||
query ??= new InternalItemsQuery(user);
|
||||
|
||||
query.IsFolder = false;
|
||||
|
||||
@@ -164,7 +160,7 @@ namespace MediaBrowser.Controller.Playlists
|
||||
Recursive = true,
|
||||
IncludeItemTypes = new[] { nameof(Audio) },
|
||||
GenreIds = new[] { musicGenre.Id },
|
||||
OrderBy = new[] { ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
|
||||
OrderBy = new[] { (ItemSortBy.AlbumArtist, SortOrder.Ascending), (ItemSortBy.Album, SortOrder.Ascending), (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
DtoOptions = options
|
||||
});
|
||||
}
|
||||
@@ -176,7 +172,7 @@ namespace MediaBrowser.Controller.Playlists
|
||||
Recursive = true,
|
||||
IncludeItemTypes = new[] { nameof(Audio) },
|
||||
ArtistIds = new[] { musicArtist.Id },
|
||||
OrderBy = new[] { ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
|
||||
OrderBy = new[] { (ItemSortBy.AlbumArtist, SortOrder.Ascending), (ItemSortBy.Album, SortOrder.Ascending), (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
DtoOptions = options
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
|
||||
@@ -14,8 +14,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
ContainingFolderPath = item.ContainingFolderPath;
|
||||
IsInMixedFolder = item.IsInMixedFolder;
|
||||
|
||||
var video = item as Video;
|
||||
if (video != null)
|
||||
if (item is Video video)
|
||||
{
|
||||
VideoType = video.VideoType;
|
||||
IsPlaceHolder = video.IsPlaceHolder;
|
||||
|
||||
@@ -45,10 +45,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
if (copy.RefreshPaths != null && copy.RefreshPaths.Length > 0)
|
||||
{
|
||||
if (RefreshPaths == null)
|
||||
{
|
||||
RefreshPaths = Array.Empty<string>();
|
||||
}
|
||||
RefreshPaths ??= Array.Empty<string>();
|
||||
|
||||
RefreshPaths = copy.RefreshPaths.ToArray();
|
||||
}
|
||||
|
||||
@@ -37,10 +37,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
public void AddPerson(PersonInfo p)
|
||||
{
|
||||
if (People == null)
|
||||
{
|
||||
People = new List<PersonInfo>();
|
||||
}
|
||||
People ??= new List<PersonInfo>();
|
||||
|
||||
PeopleHelper.AddPerson(People, p);
|
||||
}
|
||||
@@ -54,16 +51,15 @@ namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
People = new List<PersonInfo>();
|
||||
}
|
||||
|
||||
People.Clear();
|
||||
else
|
||||
{
|
||||
People.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public UserItemData GetOrAddUserData(string userId)
|
||||
{
|
||||
if (UserDataList == null)
|
||||
{
|
||||
UserDataList = new List<UserItemData>();
|
||||
}
|
||||
UserDataList ??= new List<UserItemData>();
|
||||
|
||||
UserItemData userData = null;
|
||||
|
||||
|
||||
@@ -10,6 +10,12 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
public abstract class ItemResolver<T> : IItemResolver
|
||||
where T : BaseItem, new()
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public virtual ResolverPriority Priority => ResolverPriority.First;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
/// </summary>
|
||||
@@ -20,12 +26,6 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public virtual ResolverPriority Priority => ResolverPriority.First;
|
||||
|
||||
/// <summary>
|
||||
/// Sets initial values on the newly resolved item.
|
||||
/// </summary>
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace MediaBrowser.Controller.Session
|
||||
|
||||
public string Password { get; set; }
|
||||
|
||||
[Obsolete("Send full password in Password field")]
|
||||
public string PasswordSha1 { get; set; }
|
||||
|
||||
public string App { get; set; }
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
Reference in New Issue
Block a user