aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
authorBaronGreenback <jimcartlidge@yahoo.co.uk>2021-06-19 15:04:30 +0100
committerGitHub <noreply@github.com>2021-06-19 15:04:30 +0100
commit6648b7d7dabeaa84835fc7a8a7a2a468a00cad5c (patch)
tree4b3eeee4f10f5465eaee0110aa18452dab2f9f6d /MediaBrowser.Controller/Entities
parent97c2c523a89dabead25b5b0d028acbd92d136660 (diff)
parent0c3dcdf77b0d124517bffa608bfddf7d8f7682db (diff)
Merge branch 'master' into comparisons
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/AggregateFolder.cs13
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs9
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicArtist.cs10
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicGenre.cs6
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs121
-rw-r--r--MediaBrowser.Controller/Entities/BaseItemExtensions.cs3
-rw-r--r--MediaBrowser.Controller/Entities/Book.cs10
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs72
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs221
-rw-r--r--MediaBrowser.Controller/Entities/Genre.cs42
-rw-r--r--MediaBrowser.Controller/Entities/IHasScreenshots.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasSeries.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasShares.cs11
-rw-r--r--MediaBrowser.Controller/Entities/InternalItemsQuery.cs90
-rw-r--r--MediaBrowser.Controller/Entities/InternalPeopleQuery.cs22
-rw-r--r--MediaBrowser.Controller/Entities/LinkedChild.cs45
-rw-r--r--MediaBrowser.Controller/Entities/LinkedChildComparer.cs35
-rw-r--r--MediaBrowser.Controller/Entities/LinkedChildType.cs18
-rw-r--r--MediaBrowser.Controller/Entities/Movies/Movie.cs4
-rw-r--r--MediaBrowser.Controller/Entities/MusicVideo.cs12
-rw-r--r--MediaBrowser.Controller/Entities/Person.cs9
-rw-r--r--MediaBrowser.Controller/Entities/Share.cs5
-rw-r--r--MediaBrowser.Controller/Entities/Studio.cs6
-rw-r--r--MediaBrowser.Controller/Entities/TV/Episode.cs20
-rw-r--r--MediaBrowser.Controller/Entities/TV/Season.cs10
-rw-r--r--MediaBrowser.Controller/Entities/TV/Series.cs5
-rw-r--r--MediaBrowser.Controller/Entities/Trailer.cs4
-rw-r--r--MediaBrowser.Controller/Entities/UserItemData.cs2
-rw-r--r--MediaBrowser.Controller/Entities/UserRootFolder.cs9
-rw-r--r--MediaBrowser.Controller/Entities/UserView.cs22
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs18
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs3
-rw-r--r--MediaBrowser.Controller/Entities/Year.cs10
33 files changed, 488 insertions, 383 deletions
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs
index f1944a7d3..fe1bc62ab 100644
--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs
+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs
@@ -22,6 +22,8 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public class AggregateFolder : Folder
{
+ private bool _requiresRefresh;
+
public AggregateFolder()
{
PhysicalLocationsList = Array.Empty<string>();
@@ -85,7 +87,6 @@ namespace MediaBrowser.Controller.Entities
}
}
- private bool _requiresRefresh;
public override bool RequiresRefresh()
{
var changed = base.RequiresRefresh() || _requiresRefresh;
@@ -105,11 +106,11 @@ namespace MediaBrowser.Controller.Entities
return changed;
}
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
ClearCache();
- var changed = base.BeforeMetadataRefresh(replaceAllMetdata) || _requiresRefresh;
+ var changed = base.BeforeMetadataRefresh(replaceAllMetadata) || _requiresRefresh;
_requiresRefresh = false;
return changed;
}
@@ -154,11 +155,11 @@ namespace MediaBrowser.Controller.Entities
return base.GetNonCachedChildren(directoryService).Concat(_virtualChildren);
}
- protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
+ protected override async Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{
ClearCache();
- await base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService)
+ await base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken)
.ConfigureAwait(false);
ClearCache();
@@ -184,7 +185,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="id">The id.</param>
/// <returns>BaseItem.</returns>
- /// <exception cref="ArgumentNullException">id</exception>
+ /// <exception cref="ArgumentNullException">The id is empty.</exception>
public BaseItem FindVirtualChild(Guid id)
{
if (id.Equals(Guid.Empty))
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 4c2b7cb7c..576ab67a2 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
@@ -82,19 +83,19 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <returns>System.String.</returns>
protected override string CreateSortName()
{
- return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
- + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
+ return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty)
+ + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
}
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();
- var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
+ var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : string.Empty;
if (ParentIndexNumber.HasValue)
{
- songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey;
+ songKey = ParentIndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) + "-" + songKey;
}
songKey += Name;
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
index 6101d3016..c0cd81110 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
@@ -94,7 +94,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return base.IsSaveLocalMetadataEnabled();
}
- protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
+ protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{
if (IsAccessedByName)
{
@@ -102,7 +102,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return Task.CompletedTask;
}
- return base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService);
+ return base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken);
}
public override List<string> GetUserDataKeys()
@@ -114,7 +114,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
/// <summary>
- /// Returns the folder containing the item.
+ /// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
@@ -208,9 +208,9 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary>
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
if (IsAccessedByName)
{
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
index b07d47ffd..a682a2e58 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
@@ -38,7 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio
public override bool IsDisplayedAsFolder => true;
/// <summary>
- /// Returns the folder containing the item.
+ /// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
@@ -106,9 +106,9 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary>
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
var newPath = GetRebasedPath();
if (!string.Equals(Path, newPath, StringComparison.Ordinal))
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index ca5213273..6137ddbf7 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -92,7 +92,8 @@ namespace MediaBrowser.Controller.Entities
public const string ShortsFolderName = "shorts";
public const string FeaturettesFolderName = "featurettes";
- public static readonly string[] AllExtrasTypesFolderNames = {
+ public static readonly string[] AllExtrasTypesFolderNames =
+ {
ExtrasFolderName,
BehindTheScenesFolderName,
DeletedScenesFolderName,
@@ -177,7 +178,7 @@ namespace MediaBrowser.Controller.Entities
public virtual bool AlwaysScanInternalMetadataPath => false;
/// <summary>
- /// Gets a value indicating whether this instance is in mixed folder.
+ /// Gets or sets a value indicating whether this instance is in mixed folder.
/// </summary>
/// <value><c>true</c> if this instance is in mixed folder; otherwise, <c>false</c>.</value>
[JsonIgnore]
@@ -244,7 +245,7 @@ namespace MediaBrowser.Controller.Entities
public ProgramAudio? Audio { get; set; }
/// <summary>
- /// Return the id that should be used to key display prefs for this item.
+ /// Gets the id that should be used to key display prefs for this item.
/// Default is based on the type for everything except actual generic folders.
/// </summary>
/// <value>The display prefs id.</value>
@@ -280,7 +281,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Returns the folder containing the item.
+ /// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
[JsonIgnore]
@@ -305,8 +306,11 @@ namespace MediaBrowser.Controller.Entities
public string ServiceName { get; set; }
/// <summary>
- /// If this content came from an external service, the id of the content on that service.
+ /// Gets or sets the external id.
/// </summary>
+ /// <remarks>
+ /// If this content came from an external service, the id of the content on that service.
+ /// </remarks>
[JsonIgnore]
public string ExternalId { get; set; }
@@ -330,7 +334,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Gets or sets the type of the location.
+ /// Gets the type of the location.
/// </summary>
/// <value>The type of the location.</value>
[JsonIgnore]
@@ -339,9 +343,9 @@ namespace MediaBrowser.Controller.Entities
get
{
// if (IsOffline)
- //{
+ // {
// return LocationType.Offline;
- //}
+ // }
var path = Path;
if (string.IsNullOrEmpty(path))
@@ -449,8 +453,11 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// This is just a helper for convenience.
+ /// Gets the primary image path.
/// </summary>
+ /// <remarks>
+ /// This is just a helper for convenience.
+ /// </remarks>
/// <value>The primary image path.</value>
[JsonIgnore]
public string PrimaryImagePath => this.GetImagePath(ImageType.Primary);
@@ -541,7 +548,7 @@ namespace MediaBrowser.Controller.Entities
public DateTime DateLastRefreshed { get; set; }
/// <summary>
- /// The logger.
+ /// Gets or sets the logger.
/// </summary>
public static ILogger<BaseItem> Logger { get; set; }
@@ -613,7 +620,11 @@ namespace MediaBrowser.Controller.Entities
public string ForcedSortName
{
get => _forcedSortName;
- set { _forcedSortName = value; _sortName = null; }
+ set
+ {
+ _forcedSortName = value;
+ _sortName = null;
+ }
}
private string _sortName;
@@ -621,7 +632,7 @@ namespace MediaBrowser.Controller.Entities
private Guid[] _themeVideoIds;
/// <summary>
- /// Gets the name of the sort.
+ /// Gets or sets the name of the sort.
/// </summary>
/// <value>The name of the sort.</value>
[JsonIgnore]
@@ -659,14 +670,12 @@ namespace MediaBrowser.Controller.Entities
{
if (SourceType == SourceType.Channel)
{
- return System.IO.Path.Combine(basePath, "channels", ChannelId.ToString("N", CultureInfo.InvariantCulture), Id.ToString("N", CultureInfo.InvariantCulture));
+ return System.IO.Path.Join(basePath, "channels", ChannelId.ToString("N", CultureInfo.InvariantCulture), Id.ToString("N", CultureInfo.InvariantCulture));
}
ReadOnlySpan<char> idString = Id.ToString("N", CultureInfo.InvariantCulture);
- basePath = System.IO.Path.Combine(basePath, "library");
-
- return System.IO.Path.Join(basePath, idString.Slice(0, 2), idString);
+ return System.IO.Path.Join(basePath, "library", idString.Slice(0, 2), idString);
}
/// <summary>
@@ -848,7 +857,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// When the item first debuted. For movies this could be premiere date, episodes would be first aired
+ /// Gets or sets the date that the item first debuted. For movies this could be premiere date, episodes would be first aired.
/// </summary>
/// <value>The premiere date.</value>
[JsonIgnore]
@@ -945,7 +954,7 @@ namespace MediaBrowser.Controller.Entities
public int? ProductionYear { get; set; }
/// <summary>
- /// If the item is part of a series, this is it's number in the series.
+ /// Gets or sets the index number. If the item is part of a series, this is it's number in the series.
/// This could be episode number, album track number, etc.
/// </summary>
/// <value>The index number.</value>
@@ -953,7 +962,7 @@ namespace MediaBrowser.Controller.Entities
public int? IndexNumber { get; set; }
/// <summary>
- /// For an episode this could be the season number, or for a song this could be the disc number.
+ /// Gets or sets the parent index number. For an episode this could be the season number, or for a song this could be the disc number.
/// </summary>
/// <value>The parent index number.</value>
[JsonIgnore]
@@ -1017,9 +1026,9 @@ namespace MediaBrowser.Controller.Entities
}
// if (!user.IsParentalScheduleAllowed())
- //{
+ // {
// return PlayAccess.None;
- //}
+ // }
return PlayAccess.Full;
}
@@ -1251,7 +1260,7 @@ namespace MediaBrowser.Controller.Entities
// Support plex/xbmc convention
files.AddRange(fileSystemChildren
- .Where(i => !i.IsDirectory && string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase)));
+ .Where(i => !i.IsDirectory && System.IO.Path.GetFileNameWithoutExtension(i.FullName.AsSpan()).Equals(ThemeSongFilename, StringComparison.OrdinalIgnoreCase)));
return LibraryManager.ResolvePaths(files, directoryService, null, new LibraryOptions())
.OfType<Audio.Audio>()
@@ -1312,14 +1321,16 @@ namespace MediaBrowser.Controller.Entities
{
var extras = new List<Video>();
- var folders = fileSystemChildren.Where(i => i.IsDirectory).ToArray();
+ var libraryOptions = new LibraryOptions();
+ var folders = fileSystemChildren.Where(i => i.IsDirectory).ToList();
foreach (var extraFolderName in AllExtrasTypesFolderNames)
{
var files = folders
.Where(i => string.Equals(i.Name, extraFolderName, StringComparison.OrdinalIgnoreCase))
.SelectMany(i => FileSystem.GetFiles(i.FullName));
- extras.AddRange(LibraryManager.ResolvePaths(files, directoryService, null, new LibraryOptions())
+ // Re-using the same instance of LibraryOptions since it looks like it's never being altered.
+ extras.AddRange(LibraryManager.ResolvePaths(files, directoryService, null, libraryOptions)
.OfType<Video>()
.Select(item =>
{
@@ -1330,7 +1341,7 @@ namespace MediaBrowser.Controller.Entities
}
// Use some hackery to get the extra type based on foldername
- item.ExtraType = Enum.TryParse(extraFolderName.Replace(" ", string.Empty), true, out ExtraType extraType)
+ item.ExtraType = Enum.TryParse(extraFolderName.Replace(" ", string.Empty, StringComparison.Ordinal), true, out ExtraType extraType)
? extraType
: Model.Entities.ExtraType.Unknown;
@@ -1420,10 +1431,10 @@ namespace MediaBrowser.Controller.Entities
/// Refreshes owned items such as trailers, theme videos, special features, etc.
/// Returns true or false indicating if changes were found.
/// </summary>
- /// <param name="options"></param>
- /// <param name="fileSystemChildren"></param>
- /// <param name="cancellationToken"></param>
- /// <returns></returns>
+ /// <param name="options">The metadata refresh options.</param>
+ /// <param name="fileSystemChildren">The list of filesystem children.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns><c>true</c> if any items have changed, else <c>false</c>.</returns>
protected virtual async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
{
var themeSongsChanged = false;
@@ -1765,7 +1776,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The user.</param>
/// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns>
- /// <exception cref="ArgumentNullException">user</exception>
+ /// <exception cref="ArgumentNullException">If user is null.</exception>
public bool IsParentalAllowed(User user)
{
if (user == null)
@@ -1910,7 +1921,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The user.</param>
/// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns>
- /// <exception cref="ArgumentNullException">user</exception>
+ /// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
public virtual bool IsVisible(User user)
{
if (user == null)
@@ -2208,7 +2219,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="type">The type.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <returns><c>true</c> if the specified type has image; otherwise, <c>false</c>.</returns>
- /// <exception cref="ArgumentException">Backdrops should be accessed using Item.Backdrops</exception>
+ /// <exception cref="ArgumentException">Backdrops should be accessed using Item.Backdrops.</exception>
public bool HasImage(ImageType type, int imageIndex)
{
return GetImageInfo(type, imageIndex) != null;
@@ -2316,7 +2327,7 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i.IsLocalFile)
.Select(i => System.IO.Path.GetDirectoryName(i.Path))
.Distinct(StringComparer.OrdinalIgnoreCase)
- .SelectMany(directoryService.GetFilePaths)
+ .SelectMany(path => directoryService.GetFilePaths(path))
.ToList();
var deletedImages = ImageInfos
@@ -2337,9 +2348,8 @@ namespace MediaBrowser.Controller.Entities
/// <param name="imageType">Type of the image.</param>
/// <param name="imageIndex">Index of the image.</param>
/// <returns>System.String.</returns>
- /// <exception cref="InvalidOperationException">
- /// </exception>
- /// <exception cref="ArgumentNullException">item</exception>
+ /// <exception cref="InvalidOperationException"> </exception>
+ /// <exception cref="ArgumentNullException">Item is null.</exception>
public string GetImagePath(ImageType imageType, int imageIndex)
=> GetImageInfo(imageType, imageIndex)?.Path;
@@ -2426,7 +2436,15 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentException("No image info for chapter images");
}
- return ImageInfos.Where(i => i.Type == imageType);
+ // Yield return is more performant than LINQ Where on an Array
+ for (var i = 0; i < ImageInfos.Length; i++)
+ {
+ var imageInfo = ImageInfos[i];
+ if (imageInfo.Type == imageType)
+ {
+ yield return imageInfo;
+ }
+ }
}
/// <summary>
@@ -2435,7 +2453,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="imageType">Type of the image.</param>
/// <param name="images">The images.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
- /// <exception cref="ArgumentException">Cannot call AddImages with chapter images</exception>
+ /// <exception cref="ArgumentException">Cannot call AddImages with chapter images.</exception>
public bool AddImages(ImageType imageType, List<FileSystemMetadata> images)
{
if (imageType == ImageType.Chapter)
@@ -2458,7 +2476,7 @@ namespace MediaBrowser.Controller.Entities
}
var existing = existingImages
- .FirstOrDefault(i => string.Equals(i.Path, newImage.FullName, StringComparison.OrdinalIgnoreCase));
+ .Find(i => string.Equals(i.Path, newImage.FullName, StringComparison.OrdinalIgnoreCase));
if (existing == null)
{
@@ -2489,8 +2507,7 @@ namespace MediaBrowser.Controller.Entities
var newImagePaths = images.Select(i => i.FullName).ToList();
var deleted = existingImages
- .Where(i => i.IsLocalFile && !newImagePaths.Contains(i.Path, StringComparer.OrdinalIgnoreCase) && !File.Exists(i.Path))
- .ToList();
+ .FindAll(i => i.IsLocalFile && !newImagePaths.Contains(i.Path.AsSpan(), StringComparison.OrdinalIgnoreCase) && !File.Exists(i.Path));
if (deleted.Count > 0)
{
@@ -2519,10 +2536,11 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Gets the file system path to delete when the item is to be deleted.
/// </summary>
- /// <returns></returns>
+ /// <returns>The metadata for the deleted paths.</returns>
public virtual IEnumerable<FileSystemMetadata> GetDeletePaths()
{
- return new[] {
+ return new[]
+ {
new FileSystemMetadata
{
FullName = Path,
@@ -2629,6 +2647,7 @@ namespace MediaBrowser.Controller.Entities
MetadataCountryCode = GetPreferredMetadataCountryCode(),
MetadataLanguage = GetPreferredMetadataLanguage(),
Name = GetNameForMetadataLookup(),
+ OriginalTitle = OriginalTitle,
ProviderIds = ProviderIds,
IndexNumber = IndexNumber,
ParentIndexNumber = ParentIndexNumber,
@@ -2645,7 +2664,9 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// This is called before any metadata refresh and returns true if changes were made.
/// </summary>
- public virtual bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ /// <param name="replaceAllMetadata">Whether to replace all metadata.</param>
+ /// <returns>true if the item has change, else false.</returns>
+ public virtual bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
_sortName = null;
@@ -2769,11 +2790,11 @@ namespace MediaBrowser.Controller.Entities
// var parentId = Id;
// if (!video.IsOwnedItem || video.ParentId != parentId)
- //{
+ // {
// video.IsOwnedItem = true;
// video.ParentId = parentId;
// newOptions.ForceSave = true;
- //}
+ // }
if (video == null)
{
@@ -2880,7 +2901,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Updates the official rating based on content and returns true or false indicating if it changed.
/// </summary>
- /// <returns></returns>
+ /// <returns><c>true</c> if the rating was updated; otherwise <c>false</c>.</returns>
public bool UpdateRatingToItems(IList<BaseItem> children)
{
var currentOfficialRating = OfficialRating;
@@ -2896,7 +2917,9 @@ namespace MediaBrowser.Controller.Entities
OfficialRating = ratings.FirstOrDefault() ?? currentOfficialRating;
- return !string.Equals(currentOfficialRating ?? string.Empty, OfficialRating ?? string.Empty,
+ return !string.Equals(
+ currentOfficialRating ?? string.Empty,
+ OfficialRating ?? string.Empty,
StringComparison.OrdinalIgnoreCase);
}
@@ -2993,7 +3016,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <inheritdoc />
- public bool Equals(BaseItem item) => Object.Equals(Id, item?.Id);
+ public bool Equals(BaseItem other) => object.Equals(Id, other?.Id);
/// <inheritdoc />
public override int GetHashCode() => HashCode.Combine(Id);
diff --git a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
index c39b18891..89ad392a4 100644
--- a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
+++ b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
@@ -1,6 +1,3 @@
-#nullable disable
-
-#nullable enable
#pragma warning disable CS1591
using System;
diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs
index 3d0370248..d75beb06d 100644
--- a/MediaBrowser.Controller/Entities/Book.cs
+++ b/MediaBrowser.Controller/Entities/Book.cs
@@ -12,6 +12,11 @@ namespace MediaBrowser.Controller.Entities
{
public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries
{
+ public Book()
+ {
+ this.RunTimeTicks = TimeSpan.TicksPerSecond;
+ }
+
[JsonIgnore]
public override string MediaType => Model.Entities.MediaType.Book;
@@ -28,11 +33,6 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public Guid SeriesId { get; set; }
- public Book()
- {
- this.RunTimeTicks = TimeSpan.TicksPerSecond;
- }
-
public string FindSeriesSortName()
{
return SeriesName;
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index a86da29ce..4a721ca44 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -29,30 +29,45 @@ namespace MediaBrowser.Controller.Entities
public class CollectionFolder : Folder, ICollectionFolder
{
private static readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
- public static IXmlSerializer XmlSerializer { get; set; }
-
- public static IServerApplicationHost ApplicationHost { get; set; }
+ private static readonly Dictionary<string, LibraryOptions> _libraryOptions = new Dictionary<string, LibraryOptions>();
+ private bool _requiresRefresh;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CollectionFolder"/> class.
+ /// </summary>
public CollectionFolder()
{
PhysicalLocationsList = Array.Empty<string>();
PhysicalFolderIds = Array.Empty<Guid>();
}
+ public static IXmlSerializer XmlSerializer { get; set; }
+
+ public static IServerApplicationHost ApplicationHost { get; set; }
+
[JsonIgnore]
public override bool SupportsPlayedStatus => false;
[JsonIgnore]
public override bool SupportsInheritedParentImages => false;
+ public string CollectionType { get; set; }
+
+ /// <summary>
+ /// Gets the item's children.
+ /// </summary>
+ /// <remarks>
+ /// Our children are actually just references to the ones in the physical root...
+ /// </remarks>
+ /// <value>The actual children.</value>
+ [JsonIgnore]
+ public override IEnumerable<BaseItem> Children => GetActualChildren();
+
public override bool CanDelete()
{
return false;
}
- public string CollectionType { get; set; }
-
- private static readonly Dictionary<string, LibraryOptions> LibraryOptions = new Dictionary<string, LibraryOptions>();
public LibraryOptions GetLibraryOptions()
{
return GetLibraryOptions(Path);
@@ -106,12 +121,12 @@ namespace MediaBrowser.Controller.Entities
public static LibraryOptions GetLibraryOptions(string path)
{
- lock (LibraryOptions)
+ lock (_libraryOptions)
{
- if (!LibraryOptions.TryGetValue(path, out var options))
+ if (!_libraryOptions.TryGetValue(path, out var options))
{
options = LoadLibraryOptions(path);
- LibraryOptions[path] = options;
+ _libraryOptions[path] = options;
}
return options;
@@ -120,9 +135,9 @@ namespace MediaBrowser.Controller.Entities
public static void SaveLibraryOptions(string path, LibraryOptions options)
{
- lock (LibraryOptions)
+ lock (_libraryOptions)
{
- LibraryOptions[path] = options;
+ _libraryOptions[path] = options;
var clone = JsonSerializer.Deserialize<LibraryOptions>(JsonSerializer.SerializeToUtf8Bytes(options, _jsonOptions), _jsonOptions);
foreach (var mediaPath in clone.PathInfos)
@@ -139,15 +154,18 @@ namespace MediaBrowser.Controller.Entities
public static void OnCollectionFolderChange()
{
- lock (LibraryOptions)
+ lock (_libraryOptions)
{
- LibraryOptions.Clear();
+ _libraryOptions.Clear();
}
}
/// <summary>
- /// Allow different display preferences for each collection folder.
+ /// Gets the display preferences id.
/// </summary>
+ /// <remarks>
+ /// Allow different display preferences for each collection folder.
+ /// </remarks>
/// <value>The display prefs id.</value>
[JsonIgnore]
public override Guid DisplayPreferencesId => Id;
@@ -155,21 +173,20 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public override string[] PhysicalLocations => PhysicalLocationsList;
+ public string[] PhysicalLocationsList { get; set; }
+
+ public Guid[] PhysicalFolderIds { get; set; }
+
public override bool IsSaveLocalMetadataEnabled()
{
return true;
}
- public string[] PhysicalLocationsList { get; set; }
-
- public Guid[] PhysicalFolderIds { get; set; }
-
protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService)
{
return CreateResolveArgs(directoryService, true).FileSystemChildren;
}
- private bool _requiresRefresh;
public override bool RequiresRefresh()
{
var changed = base.RequiresRefresh() || _requiresRefresh;
@@ -201,9 +218,9 @@ namespace MediaBrowser.Controller.Entities
return changed;
}
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var changed = base.BeforeMetadataRefresh(replaceAllMetdata) || _requiresRefresh;
+ var changed = base.BeforeMetadataRefresh(replaceAllMetadata) || _requiresRefresh;
_requiresRefresh = false;
return changed;
}
@@ -298,27 +315,20 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Compare our current children (presumably just read from the repo) with the current state of the file system and adjust for any changes
- /// ***Currently does not contain logic to maintain items that are unavailable in the file system***
+ /// ***Currently does not contain logic to maintain items that are unavailable in the file system***.
/// </summary>
/// <param name="progress">The progress.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param>
/// <param name="refreshOptions">The refresh options.</param>
/// <param name="directoryService">The directory service.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
+ protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
- /// <summary>
- /// Our children are actually just references to the ones in the physical root...
- /// </summary>
- /// <value>The actual children.</value>
- [JsonIgnore]
- public override IEnumerable<BaseItem> Children => GetActualChildren();
-
public IEnumerable<BaseItem> GetActualChildren()
{
return GetPhysicalFolders(true).SelectMany(c => c.Children);
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index a59f5c6e4..541747422 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -37,6 +37,11 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public class Folder : BaseItem
{
+ public Folder()
+ {
+ LinkedChildren = Array.Empty<LinkedChild>();
+ }
+
public static IUserViewManager UserViewManager { get; set; }
/// <summary>
@@ -50,11 +55,6 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public DateTime? DateLastMediaAdded { get; set; }
- public Folder()
- {
- LinkedChildren = Array.Empty<LinkedChild>();
- }
-
[JsonIgnore]
public override bool SupportsThemeMedia => true;
@@ -86,6 +86,85 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public virtual bool SupportsDateLastMediaAdded => false;
+ [JsonIgnore]
+ public override string FileNameWithoutExtension
+ {
+ get
+ {
+ if (IsFileProtocol)
+ {
+ return System.IO.Path.GetFileName(Path);
+ }
+
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the actual children.
+ /// </summary>
+ /// <value>The actual children.</value>
+ [JsonIgnore]
+ public virtual IEnumerable<BaseItem> Children => LoadChildren();
+
+ /// <summary>
+ /// Gets thread-safe access to all recursive children of this folder - without regard to user.
+ /// </summary>
+ /// <value>The recursive children.</value>
+ [JsonIgnore]
+ public IEnumerable<BaseItem> RecursiveChildren => GetRecursiveChildren();
+
+ [JsonIgnore]
+ protected virtual bool SupportsShortcutChildren => false;
+
+ protected virtual bool FilterLinkedChildrenPerUser => false;
+
+ [JsonIgnore]
+ protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren;
+
+ [JsonIgnore]
+ public virtual bool SupportsUserDataFromChildren
+ {
+ get
+ {
+ // These are just far too slow.
+ if (this is ICollectionFolder)
+ {
+ return false;
+ }
+
+ if (this is UserView)
+ {
+ return false;
+ }
+
+ if (this is UserRootFolder)
+ {
+ return false;
+ }
+
+ if (this is Channel)
+ {
+ return false;
+ }
+
+ if (SourceType != SourceType.Library)
+ {
+ return false;
+ }
+
+ if (this is IItemByName)
+ {
+ if (this is not IHasDualAccess hasDualAccess || hasDualAccess.IsAccessedByName)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }
+
public override bool CanDelete()
{
if (IsRoot)
@@ -108,20 +187,6 @@ namespace MediaBrowser.Controller.Entities
return baseResult;
}
- [JsonIgnore]
- public override string FileNameWithoutExtension
- {
- get
- {
- if (IsFileProtocol)
- {
- return System.IO.Path.GetFileName(Path);
- }
-
- return null;
- }
- }
-
protected override bool IsAllowTagFilterEnforced()
{
if (this is ICollectionFolder)
@@ -137,16 +202,12 @@ namespace MediaBrowser.Controller.Entities
return true;
}
- [JsonIgnore]
- protected virtual bool SupportsShortcutChildren => false;
-
/// <summary>
/// Adds the child.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- /// <exception cref="InvalidOperationException">Unable to add + item.Name</exception>
+ /// <exception cref="InvalidOperationException">Unable to add + item.Name.</exception>
public void AddChild(BaseItem item, CancellationToken cancellationToken)
{
item.SetParent(this);
@@ -169,20 +230,6 @@ namespace MediaBrowser.Controller.Entities
LibraryManager.CreateItem(item, this);
}
- /// <summary>
- /// Gets the actual children.
- /// </summary>
- /// <value>The actual children.</value>
- [JsonIgnore]
- public virtual IEnumerable<BaseItem> Children => LoadChildren();
-
- /// <summary>
- /// thread-safe access to all recursive children of this folder - without regard to user.
- /// </summary>
- /// <value>The recursive children.</value>
- [JsonIgnore]
- public IEnumerable<BaseItem> RecursiveChildren => GetRecursiveChildren();
-
public override bool IsVisible(User user)
{
if (this is ICollectionFolder && !(this is BasePluginFolder))
@@ -226,20 +273,20 @@ namespace MediaBrowser.Controller.Entities
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken)
{
- return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(FileSystem)));
+ return ValidateChildren(progress, new MetadataRefreshOptions(new DirectoryService(FileSystem)), cancellationToken: cancellationToken);
}
/// <summary>
/// Validates that the children of the folder still exist.
/// </summary>
/// <param name="progress">The progress.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
/// <param name="metadataRefreshOptions">The metadata refresh options.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken, MetadataRefreshOptions metadataRefreshOptions, bool recursive = true)
+ public Task ValidateChildren(IProgress<double> progress, MetadataRefreshOptions metadataRefreshOptions, bool recursive = true, CancellationToken cancellationToken = default)
{
- return ValidateChildrenInternal(progress, cancellationToken, recursive, true, metadataRefreshOptions, metadataRefreshOptions.DirectoryService);
+ return ValidateChildrenInternal(progress, recursive, true, metadataRefreshOptions, metadataRefreshOptions.DirectoryService, cancellationToken);
}
private Dictionary<Guid, BaseItem> GetActualChildrenDictionary()
@@ -279,13 +326,13 @@ namespace MediaBrowser.Controller.Entities
/// Validates the children internal.
/// </summary>
/// <param name="progress">The progress.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param>
/// <param name="refreshOptions">The refresh options.</param>
/// <param name="directoryService">The directory service.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- protected virtual async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
+ protected virtual async Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{
if (recursive)
{
@@ -294,7 +341,7 @@ namespace MediaBrowser.Controller.Entities
try
{
- await ValidateChildrenInternal2(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService).ConfigureAwait(false);
+ await ValidateChildrenInternal2(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken).ConfigureAwait(false);
}
finally
{
@@ -305,7 +352,7 @@ namespace MediaBrowser.Controller.Entities
}
}
- private async Task ValidateChildrenInternal2(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
+ private async Task ValidateChildrenInternal2(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -527,7 +574,7 @@ namespace MediaBrowser.Controller.Entities
private Task ValidateSubFolders(IList<Folder> children, IDirectoryService directoryService, IProgress<double> progress, CancellationToken cancellationToken)
{
return RunTasks(
- (folder, innerProgress) => folder.ValidateChildrenInternal(innerProgress, cancellationToken, true, false, null, directoryService),
+ (folder, innerProgress) => folder.ValidateChildrenInternal(innerProgress, true, false, null, directoryService, cancellationToken),
children,
progress,
cancellationToken);
@@ -940,7 +987,13 @@ namespace MediaBrowser.Controller.Entities
}
else
{
- items = GetChildren(user, true).Where(filter);
+ // need to pass this param to the children.
+ var childQuery = new InternalItemsQuery
+ {
+ DisplayAlbumFolders = query.DisplayAlbumFolders
+ };
+
+ items = GetChildren(user, true, childQuery).Where(filter);
}
return PostFilterAndSort(items, query, true);
@@ -965,7 +1018,7 @@ namespace MediaBrowser.Controller.Entities
if (!string.IsNullOrEmpty(query.NameStartsWith))
{
- items = items.Where(i => i.SortName.StartsWith(query.NameStartsWith, StringComparison.OrdinalIgnoreCase));
+ items = items.Where(i => i.SortName.StartsWith(query.NameStartsWith, StringComparison.CurrentCultureIgnoreCase));
}
if (!string.IsNullOrEmpty(query.NameLessThan))
@@ -1276,10 +1329,23 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Adds the children to list.
/// </summary>
- /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, InternalItemsQuery query)
{
- foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
+ // If Query.AlbumFolders is set, then enforce the format as per the db in that it permits sub-folders in music albums.
+ IEnumerable<BaseItem> children = null;
+ if ((query?.DisplayAlbumFolders ?? false) && (this is MusicAlbum))
+ {
+ children = Children;
+ query = null;
+ }
+
+ // If there are not sub-folders, proceed as normal.
+ if (children == null)
+ {
+ children = GetEligibleChildrenForRecursiveChildren(user);
+ }
+
+ foreach (var child in children)
{
bool? isVisibleToUser = null;
@@ -1428,8 +1494,6 @@ namespace MediaBrowser.Controller.Entities
return list;
}
- protected virtual bool FilterLinkedChildrenPerUser => false;
-
public bool ContainsLinkedChildByItemId(Guid itemId)
{
var linkedChildren = LinkedChildren;
@@ -1530,9 +1594,6 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i.Item2 != null);
}
- [JsonIgnore]
- protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren;
-
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
{
var changesFound = false;
@@ -1553,7 +1614,8 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Refreshes the linked children.
/// </summary>
- /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
+ /// <param name="fileSystemChildren">The enumerable of file system metadata.</param>
+ /// <returns><c>true</c> if the linked children were updated, <c>false</c> otherwise.</returns>
protected virtual bool RefreshLinkedChildren(IEnumerable<FileSystemMetadata> fileSystemChildren)
{
if (SupportsShortcutChildren)
@@ -1696,51 +1758,6 @@ namespace MediaBrowser.Controller.Entities
return !IsPlayed(user);
}
- [JsonIgnore]
- public virtual bool SupportsUserDataFromChildren
- {
- get
- {
- // These are just far too slow.
- if (this is ICollectionFolder)
- {
- return false;
- }
-
- if (this is UserView)
- {
- return false;
- }
-
- if (this is UserRootFolder)
- {
- return false;
- }
-
- if (this is Channel)
- {
- return false;
- }
-
- if (SourceType != SourceType.Library)
- {
- return false;
- }
-
- var iItemByName = this as IItemByName;
- if (iItemByName != null)
- {
- var hasDualAccess = this as IHasDualAccess;
- if (hasDualAccess == null || hasDualAccess.IsAccessedByName)
- {
- return false;
- }
- }
-
- return true;
- }
- }
-
public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, DtoOptions fields)
{
if (!SupportsUserDataFromChildren)
diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs
index 7987f38a0..b80a5be3b 100644
--- a/MediaBrowser.Controller/Entities/Genre.cs
+++ b/MediaBrowser.Controller/Entities/Genre.cs
@@ -16,6 +16,23 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public class Genre : BaseItem, IItemByName
{
+ /// <summary>
+ /// Gets the folder containing the item.
+ /// If the item is a folder, it returns the folder itself.
+ /// </summary>
+ /// <value>The containing folder path.</value>
+ [JsonIgnore]
+ public override string ContainingFolderPath => Path;
+
+ [JsonIgnore]
+ public override bool IsDisplayedAsFolder => true;
+
+ [JsonIgnore]
+ public override bool SupportsAncestors => false;
+
+ [JsonIgnore]
+ public override bool SupportsPeople => false;
+
public override List<string> GetUserDataKeys()
{
var list = base.GetUserDataKeys();
@@ -34,20 +51,6 @@ namespace MediaBrowser.Controller.Entities
return 1;
}
- /// <summary>
- /// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself.
- /// </summary>
- /// <value>The containing folder path.</value>
- [JsonIgnore]
- public override string ContainingFolderPath => Path;
-
- [JsonIgnore]
- public override bool IsDisplayedAsFolder => true;
-
- [JsonIgnore]
- public override bool SupportsAncestors => false;
-
public override bool IsSaveLocalMetadataEnabled()
{
return true;
@@ -72,9 +75,6 @@ namespace MediaBrowser.Controller.Entities
return LibraryManager.GetItemList(query);
}
- [JsonIgnore]
- public override bool SupportsPeople => false;
-
public static string GetPath(string name)
{
return GetPath(name, true);
@@ -108,11 +108,13 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// This is called before any metadata refresh and returns true or false indicating if changes were made.
+ /// This is called before any metadata refresh and returns true if changes were made.
/// </summary>
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ /// <param name="replaceAllMetadata">Whether to replace all metadata.</param>
+ /// <returns>true if the item has change, else false.</returns>
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
var newPath = GetRebasedPath();
if (!string.Equals(Path, newPath, StringComparison.Ordinal))
diff --git a/MediaBrowser.Controller/Entities/IHasScreenshots.cs b/MediaBrowser.Controller/Entities/IHasScreenshots.cs
index b027a0cb1..ae01c223e 100644
--- a/MediaBrowser.Controller/Entities/IHasScreenshots.cs
+++ b/MediaBrowser.Controller/Entities/IHasScreenshots.cs
@@ -1,7 +1,7 @@
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Interface IHasScreenshots.
+ /// The item has screenshots.
/// </summary>
public interface IHasScreenshots
{
diff --git a/MediaBrowser.Controller/Entities/IHasSeries.cs b/MediaBrowser.Controller/Entities/IHasSeries.cs
index 64d769d5b..5f774bbde 100644
--- a/MediaBrowser.Controller/Entities/IHasSeries.cs
+++ b/MediaBrowser.Controller/Entities/IHasSeries.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Entities
public interface IHasSeries
{
/// <summary>
- /// Gets the name of the series.
+ /// Gets or sets the name of the series.
/// </summary>
/// <value>The name of the series.</value>
string SeriesName { get; set; }
diff --git a/MediaBrowser.Controller/Entities/IHasShares.cs b/MediaBrowser.Controller/Entities/IHasShares.cs
new file mode 100644
index 000000000..bdde744a3
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/IHasShares.cs
@@ -0,0 +1,11 @@
+#nullable disable
+
+#pragma warning disable CS1591
+
+namespace MediaBrowser.Controller.Entities
+{
+ public interface IHasShares
+ {
+ Share[] Shares { get; set; }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index c06021029..ebaf5506d 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
#pragma warning disable CS1591
using System;
@@ -20,9 +18,9 @@ namespace MediaBrowser.Controller.Entities
public int? Limit { get; set; }
- public User User { get; set; }
+ public User? User { get; set; }
- public BaseItem SimilarTo { get; set; }
+ public BaseItem? SimilarTo { get; set; }
public bool? IsFolder { get; set; }
@@ -58,23 +56,23 @@ namespace MediaBrowser.Controller.Entities
public bool? CollapseBoxSetItems { get; set; }
- public string NameStartsWithOrGreater { get; set; }
+ public string? NameStartsWithOrGreater { get; set; }
- public string NameStartsWith { get; set; }
+ public string? NameStartsWith { get; set; }
- public string NameLessThan { get; set; }
+ public string? NameLessThan { get; set; }
- public string NameContains { get; set; }
+ public string? NameContains { get; set; }
- public string MinSortName { get; set; }
+ public string? MinSortName { get; set; }
- public string PresentationUniqueKey { get; set; }
+ public string? PresentationUniqueKey { get; set; }
- public string Path { get; set; }
+ public string? Path { get; set; }
- public string Name { get; set; }
+ public string? Name { get; set; }
- public string Person { get; set; }
+ public string? Person { get; set; }
public Guid[] PersonIds { get; set; }
@@ -82,7 +80,7 @@ namespace MediaBrowser.Controller.Entities
public Guid[] ExcludeItemIds { get; set; }
- public string AdjacentTo { get; set; }
+ public string? AdjacentTo { get; set; }
public string[] PersonTypes { get; set; }
@@ -182,13 +180,13 @@ namespace MediaBrowser.Controller.Entities
public Guid ParentId { get; set; }
- public string ParentType { get; set; }
+ public string? ParentType { get; set; }
public Guid[] AncestorIds { get; set; }
public Guid[] TopParentIds { get; set; }
- public BaseItem Parent
+ public BaseItem? Parent
{
set
{
@@ -213,9 +211,9 @@ namespace MediaBrowser.Controller.Entities
public SeriesStatus[] SeriesStatuses { get; set; }
- public string ExternalSeriesId { get; set; }
+ public string? ExternalSeriesId { get; set; }
- public string ExternalId { get; set; }
+ public string? ExternalId { get; set; }
public Guid[] AlbumIds { get; set; }
@@ -223,9 +221,9 @@ namespace MediaBrowser.Controller.Entities
public Guid[] ExcludeArtistIds { get; set; }
- public string AncestorWithPresentationUniqueKey { get; set; }
+ public string? AncestorWithPresentationUniqueKey { get; set; }
- public string SeriesPresentationUniqueKey { get; set; }
+ public string? SeriesPresentationUniqueKey { get; set; }
public bool GroupByPresentationUniqueKey { get; set; }
@@ -235,7 +233,7 @@ namespace MediaBrowser.Controller.Entities
public bool ForceDirect { get; set; }
- public Dictionary<string, string> ExcludeProviderIds { get; set; }
+ public Dictionary<string, string>? ExcludeProviderIds { get; set; }
public bool EnableGroupByMetadataKey { get; set; }
@@ -253,13 +251,13 @@ namespace MediaBrowser.Controller.Entities
public int MinSimilarityScore { get; set; }
- public string HasNoAudioTrackWithLanguage { get; set; }
+ public string? HasNoAudioTrackWithLanguage { get; set; }
- public string HasNoInternalSubtitleTrackWithLanguage { get; set; }
+ public string? HasNoInternalSubtitleTrackWithLanguage { get; set; }
- public string HasNoExternalSubtitleTrackWithLanguage { get; set; }
+ public string? HasNoExternalSubtitleTrackWithLanguage { get; set; }
- public string HasNoSubtitleTrackWithLanguage { get; set; }
+ public string? HasNoSubtitleTrackWithLanguage { get; set; }
public bool? IsDeadArtist { get; set; }
@@ -267,6 +265,11 @@ namespace MediaBrowser.Controller.Entities
public bool? IsDeadPerson { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether album sub-folders should be returned if they exist.
+ /// </summary>
+ public bool? DisplayAlbumFolders { get; set; }
+
public InternalItemsQuery()
{
AlbumArtistIds = Array.Empty<Guid>();
@@ -283,12 +286,10 @@ namespace MediaBrowser.Controller.Entities
ExcludeInheritedTags = Array.Empty<string>();
ExcludeItemIds = Array.Empty<Guid>();
ExcludeItemTypes = Array.Empty<string>();
- ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
ExcludeTags = Array.Empty<string>();
GenreIds = Array.Empty<Guid>();
Genres = Array.Empty<string>();
GroupByPresentationUniqueKey = true;
- HasAnyProviderId = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
ImageTypes = Array.Empty<ImageType>();
IncludeItemTypes = Array.Empty<string>();
ItemIds = Array.Empty<Guid>();
@@ -309,32 +310,33 @@ namespace MediaBrowser.Controller.Entities
Years = Array.Empty<int>();
}
- public InternalItemsQuery(User user)
+ public InternalItemsQuery(User? user)
: this()
{
- SetUser(user);
+ if (user != null)
+ {
+ SetUser(user);
+ }
}
public void SetUser(User user)
{
- if (user != null)
- {
- MaxParentalRating = user.MaxParentalAgeRating;
+ MaxParentalRating = user.MaxParentalAgeRating;
- if (MaxParentalRating.HasValue)
- {
- BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
- .Where(i => i != UnratedItem.Other.ToString())
- .Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
- }
+ if (MaxParentalRating.HasValue)
+ {
+ string other = UnratedItem.Other.ToString();
+ BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
+ .Where(i => i != other)
+ .Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
+ }
- ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
+ ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
- User = user;
- }
+ User = user;
}
- public Dictionary<string, string> HasAnyProviderId { get; set; }
+ public Dictionary<string, string>? HasAnyProviderId { get; set; }
public Guid[] AlbumArtistIds { get; set; }
@@ -356,8 +358,8 @@ namespace MediaBrowser.Controller.Entities
public int? MinWidth { get; set; }
- public string SearchTerm { get; set; }
+ public string? SearchTerm { get; set; }
- public string SeriesTimerId { get; set; }
+ public string? SeriesTimerId { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
index b2d6a4609..3e1d89274 100644
--- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
@@ -3,12 +3,24 @@
#pragma warning disable CS1591
using System;
+using System.Collections.Generic;
using Jellyfin.Data.Entities;
namespace MediaBrowser.Controller.Entities
{
public class InternalPeopleQuery
{
+ public InternalPeopleQuery()
+ : this(Array.Empty<string>(), Array.Empty<string>())
+ {
+ }
+
+ public InternalPeopleQuery(IReadOnlyList<string> personTypes, IReadOnlyList<string> excludePersonTypes)
+ {
+ PersonTypes = personTypes;
+ ExcludePersonTypes = excludePersonTypes;
+ }
+
/// <summary>
/// Gets or sets the maximum number of items the query should return.
/// </summary>
@@ -16,9 +28,9 @@ namespace MediaBrowser.Controller.Entities
public Guid ItemId { get; set; }
- public string[] PersonTypes { get; set; }
+ public IReadOnlyList<string> PersonTypes { get; }
- public string[] ExcludePersonTypes { get; set; }
+ public IReadOnlyList<string> ExcludePersonTypes { get; }
public int? MaxListOrder { get; set; }
@@ -29,11 +41,5 @@ namespace MediaBrowser.Controller.Entities
public User User { get; set; }
public bool? IsFavorite { get; set; }
-
- public InternalPeopleQuery()
- {
- PersonTypes = Array.Empty<string>();
- ExcludePersonTypes = Array.Empty<string>();
- }
}
}
diff --git a/MediaBrowser.Controller/Entities/LinkedChild.cs b/MediaBrowser.Controller/Entities/LinkedChild.cs
index 01c0a9339..fd5fef3dc 100644
--- a/MediaBrowser.Controller/Entities/LinkedChild.cs
+++ b/MediaBrowser.Controller/Entities/LinkedChild.cs
@@ -3,15 +3,18 @@
#pragma warning disable CS1591
using System;
-using System.Collections.Generic;
using System.Globalization;
using System.Text.Json.Serialization;
-using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.Entities
{
public class LinkedChild
{
+ public LinkedChild()
+ {
+ Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
+ }
+
public string Path { get; set; }
public LinkedChildType Type { get; set; }
@@ -22,7 +25,7 @@ namespace MediaBrowser.Controller.Entities
public string Id { get; set; }
/// <summary>
- /// Serves as a cache.
+ /// Gets or sets the linked item id.
/// </summary>
public Guid? ItemId { get; set; }
@@ -41,41 +44,5 @@ namespace MediaBrowser.Controller.Entities
return child;
}
-
- public LinkedChild()
- {
- Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
- }
- }
-
- public enum LinkedChildType
- {
- Manual = 0,
- Shortcut = 1
- }
-
- public class LinkedChildComparer : IEqualityComparer<LinkedChild>
- {
- private readonly IFileSystem _fileSystem;
-
- public LinkedChildComparer(IFileSystem fileSystem)
- {
- _fileSystem = fileSystem;
- }
-
- public bool Equals(LinkedChild x, LinkedChild y)
- {
- if (x.Type == y.Type)
- {
- return _fileSystem.AreEqual(x.Path, y.Path);
- }
-
- return false;
- }
-
- public int GetHashCode(LinkedChild obj)
- {
- return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode();
- }
}
}
diff --git a/MediaBrowser.Controller/Entities/LinkedChildComparer.cs b/MediaBrowser.Controller/Entities/LinkedChildComparer.cs
new file mode 100644
index 000000000..4e58e2942
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/LinkedChildComparer.cs
@@ -0,0 +1,35 @@
+#nullable disable
+
+#pragma warning disable CS1591
+
+using System;
+using System.Collections.Generic;
+using MediaBrowser.Model.IO;
+
+namespace MediaBrowser.Controller.Entities
+{
+ public class LinkedChildComparer : IEqualityComparer<LinkedChild>
+ {
+ private readonly IFileSystem _fileSystem;
+
+ public LinkedChildComparer(IFileSystem fileSystem)
+ {
+ _fileSystem = fileSystem;
+ }
+
+ public bool Equals(LinkedChild x, LinkedChild y)
+ {
+ if (x.Type == y.Type)
+ {
+ return _fileSystem.AreEqual(x.Path, y.Path);
+ }
+
+ return false;
+ }
+
+ public int GetHashCode(LinkedChild obj)
+ {
+ return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode(StringComparison.Ordinal);
+ }
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Entities/LinkedChildType.cs b/MediaBrowser.Controller/Entities/LinkedChildType.cs
new file mode 100644
index 000000000..9ddb7b620
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/LinkedChildType.cs
@@ -0,0 +1,18 @@
+namespace MediaBrowser.Controller.Entities
+{
+ /// <summary>
+ /// The linked child type.
+ /// </summary>
+ public enum LinkedChildType
+ {
+ /// <summary>
+ /// Manually linked child.
+ /// </summary>
+ Manual = 0,
+
+ /// <summary>
+ /// Shortcut linked child.
+ /// </summary>
+ Shortcut = 1
+ }
+} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index 64d60c2e9..b54bbf5eb 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -144,9 +144,9 @@ namespace MediaBrowser.Controller.Entities.Movies
}
/// <inheritdoc />
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
if (!ProductionYear.HasValue)
{
diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs
index f42e7723c..237ad5198 100644
--- a/MediaBrowser.Controller/Entities/MusicVideo.cs
+++ b/MediaBrowser.Controller/Entities/MusicVideo.cs
@@ -13,15 +13,15 @@ namespace MediaBrowser.Controller.Entities
{
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasLookupInfo<MusicVideoInfo>
{
- /// <inheritdoc />
- [JsonIgnore]
- public IReadOnlyList<string> Artists { get; set; }
-
public MusicVideo()
{
Artists = Array.Empty<string>();
}
+ /// <inheritdoc />
+ [JsonIgnore]
+ public IReadOnlyList<string> Artists { get; set; }
+
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.Music;
@@ -36,9 +36,9 @@ namespace MediaBrowser.Controller.Entities
return info;
}
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
if (!ProductionYear.HasValue)
{
diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs
index d9ff55362..913f76d3b 100644
--- a/MediaBrowser.Controller/Entities/Person.cs
+++ b/MediaBrowser.Controller/Entities/Person.cs
@@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Returns the folder containing the item.
+ /// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
@@ -67,6 +67,9 @@ namespace MediaBrowser.Controller.Entities
return true;
}
+ /// <summary>
+ /// Gets a value indicating whether to enable alpha numeric sorting.
+ /// </summary>
[JsonIgnore]
public override bool EnableAlphaNumericSorting => false;
@@ -126,9 +129,9 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary>
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
var newPath = GetRebasedPath();
if (!string.Equals(Path, newPath, StringComparison.Ordinal))
diff --git a/MediaBrowser.Controller/Entities/Share.cs b/MediaBrowser.Controller/Entities/Share.cs
index 7e4ec1830..64f446eef 100644
--- a/MediaBrowser.Controller/Entities/Share.cs
+++ b/MediaBrowser.Controller/Entities/Share.cs
@@ -4,11 +4,6 @@
namespace MediaBrowser.Controller.Entities
{
- public interface IHasShares
- {
- Share[] Shares { get; set; }
- }
-
public class Share
{
public string UserId { get; set; }
diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs
index ae1d10447..6fd0a6c6c 100644
--- a/MediaBrowser.Controller/Entities/Studio.cs
+++ b/MediaBrowser.Controller/Entities/Studio.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Returns the folder containing the item.
+ /// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
@@ -105,9 +105,9 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary>
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
var newPath = GetRebasedPath();
if (!string.Equals(Path, newPath, StringComparison.Ordinal))
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index 2724bd9b3..31c179bca 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Entities.TV
public IReadOnlyList<Guid> RemoteTrailerIds { get; set; }
/// <summary>
- /// Gets the season in which it aired.
+ /// Gets or sets the season in which it aired.
/// </summary>
/// <value>The aired season.</value>
public int? AirsBeforeSeasonNumber { get; set; }
@@ -44,7 +44,7 @@ namespace MediaBrowser.Controller.Entities.TV
public int? AirsBeforeEpisodeNumber { get; set; }
/// <summary>
- /// This is the ending episode number for double episodes.
+ /// Gets or sets the ending episode number for double episodes.
/// </summary>
/// <value>The index number.</value>
public int? IndexNumberEnd { get; set; }
@@ -116,7 +116,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
/// <summary>
- /// This Episode's Series Instance.
+ /// Gets the Episode's Series Instance.
/// </summary>
/// <value>The series.</value>
[JsonIgnore]
@@ -218,8 +218,8 @@ namespace MediaBrowser.Controller.Entities.TV
/// <returns>System.String.</returns>
protected override string CreateSortName()
{
- return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "")
- + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
+ return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ", CultureInfo.InvariantCulture) : string.Empty)
+ + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
}
/// <summary>
@@ -261,6 +261,7 @@ namespace MediaBrowser.Controller.Entities.TV
[JsonIgnore]
public Guid SeasonId { get; set; }
+
[JsonIgnore]
public Guid SeriesId { get; set; }
@@ -286,7 +287,8 @@ namespace MediaBrowser.Controller.Entities.TV
public override IEnumerable<FileSystemMetadata> GetDeletePaths()
{
- return new[] {
+ return new[]
+ {
new FileSystemMetadata
{
FullName = Path,
@@ -318,9 +320,9 @@ namespace MediaBrowser.Controller.Entities.TV
return id;
}
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
if (!IsLocked)
{
@@ -328,7 +330,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
try
{
- if (LibraryManager.FillMissingEpisodeNumbersFromPath(this, replaceAllMetdata))
+ if (LibraryManager.FillMissingEpisodeNumbersFromPath(this, replaceAllMetadata))
{
hasChanges = true;
}
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index ad3e0fe8d..aa62bb35b 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
/// <summary>
- /// This Episode's Series Instance.
+ /// Gets this Episode's Series Instance.
/// </summary>
/// <value>The series.</value>
[JsonIgnore]
@@ -122,7 +122,7 @@ namespace MediaBrowser.Controller.Entities.TV
var series = Series;
if (series != null)
{
- return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000");
+ return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);
}
}
@@ -135,7 +135,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// <returns>System.String.</returns>
protected override string CreateSortName()
{
- return IndexNumber != null ? IndexNumber.Value.ToString("0000") : Name;
+ return IndexNumber != null ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : Name;
}
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
@@ -242,9 +242,9 @@ namespace MediaBrowser.Controller.Entities.TV
/// This is called before any metadata refresh and returns true or false indicating if changes were made.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
if (!IndexNumber.HasValue && !string.IsNullOrEmpty(Path))
{
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index ded825abc..44d07b4a4 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -59,8 +59,11 @@ namespace MediaBrowser.Controller.Entities.TV
public IReadOnlyList<Guid> RemoteTrailerIds { get; set; }
/// <summary>
- /// airdate, dvd or absolute.
+ /// Gets or sets the display order.
/// </summary>
+ /// <remarks>
+ /// Valid options are airdate, dvd or absolute.
+ /// </remarks>
public string DisplayOrder { get; set; }
/// <summary>
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index b086b5906..732b45521 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -45,9 +45,9 @@ namespace MediaBrowser.Controller.Entities
return info;
}
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
if (!ProductionYear.HasValue)
{
diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs
index f60359c01..6ab2116d7 100644
--- a/MediaBrowser.Controller/Entities/UserItemData.cs
+++ b/MediaBrowser.Controller/Entities/UserItemData.cs
@@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Entities
public const double MinLikeValue = 6.5;
/// <summary>
- /// This is an interpreted property to indicate likes or dislikes
+ /// Gets or sets a value indicating whether the item is liked or not.
/// This should never be serialized.
/// </summary>
/// <value><c>null</c> if [likes] contains no value, <c>true</c> if [likes]; otherwise, <c>false</c>.</value>
diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs
index e492740ed..2b15a52f0 100644
--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs
+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs
@@ -23,6 +23,7 @@ namespace MediaBrowser.Controller.Entities
{
private List<Guid> _childrenIds = null;
private readonly object _childIdsLock = new object();
+
protected override List<BaseItem> LoadChildren()
{
lock (_childIdsLock)
@@ -87,10 +88,10 @@ namespace MediaBrowser.Controller.Entities
return list;
}
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
ClearCache();
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
if (string.Equals("default", Name, StringComparison.OrdinalIgnoreCase))
{
@@ -108,11 +109,11 @@ namespace MediaBrowser.Controller.Entities
return base.GetNonCachedChildren(directoryService);
}
- protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
+ protected override async Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
{
ClearCache();
- await base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService)
+ await base.ValidateChildrenInternal(progress, recursive, refreshChildMetadata, refreshOptions, directoryService, cancellationToken)
.ConfigureAwait(false);
ClearCache();
diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs
index 0dfde2766..57dc9b59b 100644
--- a/MediaBrowser.Controller/Entities/UserView.cs
+++ b/MediaBrowser.Controller/Entities/UserView.cs
@@ -15,13 +15,19 @@ namespace MediaBrowser.Controller.Entities
{
public class UserView : Folder, IHasCollectionType
{
- /// <inheritdoc />
+ /// <summary>
+ /// Gets or sets the view type.
+ /// </summary>
public string ViewType { get; set; }
- /// <inheritdoc />
+ /// <summary>
+ /// Gets or sets the display parent id.
+ /// </summary>
public new Guid DisplayParentId { get; set; }
- /// <inheritdoc />
+ /// <summary>
+ /// Gets or sets the user id.
+ /// </summary>
public Guid? UserId { get; set; }
public static ITVSeriesManager TVSeriesManager;
@@ -110,10 +116,10 @@ namespace MediaBrowser.Controller.Entities
return GetChildren(user, false);
}
- private static string[] UserSpecificViewTypes = new string[]
- {
- Model.Entities.CollectionType.Playlists
- };
+ private static readonly string[] UserSpecificViewTypes = new string[]
+ {
+ Model.Entities.CollectionType.Playlists
+ };
public static bool IsUserSpecific(Folder folder)
{
@@ -166,7 +172,7 @@ namespace MediaBrowser.Controller.Entities
return OriginalFolderViewTypes.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
}
- protected override Task ValidateChildrenInternal(IProgress<double> progress, System.Threading.CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService)
+ protected override Task ValidateChildrenInternal(IProgress<double> progress, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService, System.Threading.CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index 15a4573c2..add734f62 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -55,12 +55,12 @@ namespace MediaBrowser.Controller.Entities
// if (query.IncludeItemTypes != null &&
// query.IncludeItemTypes.Length == 1 &&
// string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))
- //{
+ // {
// if (!string.Equals(viewType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase))
// {
// return await FindPlaylists(queryParent, user, query).ConfigureAwait(false);
// }
- //}
+ // }
switch (viewType)
{
@@ -344,12 +344,14 @@ namespace MediaBrowser.Controller.Entities
var parentFolders = GetMediaFolders(parent, query.User, new[] { CollectionType.TvShows, string.Empty });
var result = _tvSeriesManager.GetNextUp(
- new NextUpQuery
- {
- Limit = query.Limit,
- StartIndex = query.StartIndex,
- UserId = query.User.Id
- }, parentFolders, query.DtoOptions);
+ new NextUpQuery
+ {
+ Limit = query.Limit,
+ StartIndex = query.StartIndex,
+ UserId = query.User.Id
+ },
+ parentFolders,
+ query.DtoOptions);
return result;
}
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 723027a88..d05b5df2f 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -482,7 +482,8 @@ namespace MediaBrowser.Controller.Entities
{
if (!IsInMixedFolder)
{
- return new[] {
+ return new[]
+ {
new FileSystemMetadata
{
FullName = ContainingFolderPath,
diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs
index 4d84a151a..f268bc939 100644
--- a/MediaBrowser.Controller/Entities/Year.cs
+++ b/MediaBrowser.Controller/Entities/Year.cs
@@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Returns the folder containing the item.
+ /// Gets the folder containing the item.
/// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
@@ -112,11 +112,13 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// This is called before any metadata refresh and returns true or false indicating if changes were made.
+ /// This is called before any metadata refresh and returns true if changes were made.
/// </summary>
- public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
+ /// <param name="replaceAllMetadata">Whether to replace all metadata.</param>
+ /// <returns>true if the item has change, else false.</returns>
+ public override bool BeforeMetadataRefresh(bool replaceAllMetadata)
{
- var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
+ var hasChanges = base.BeforeMetadataRefresh(replaceAllMetadata);
var newPath = GetRebasedPath();
if (!string.Equals(Path, newPath, StringComparison.Ordinal))