aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/AggregateFolder.cs6
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs9
-rw-r--r--MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs18
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicArtist.cs27
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicGenre.cs10
-rw-r--r--MediaBrowser.Controller/Entities/AudioBook.cs8
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs269
-rw-r--r--MediaBrowser.Controller/Entities/BaseItemExtensions.cs5
-rw-r--r--MediaBrowser.Controller/Entities/BasePluginFolder.cs10
-rw-r--r--MediaBrowser.Controller/Entities/Book.cs15
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs11
-rw-r--r--MediaBrowser.Controller/Entities/DayOfWeekHelper.cs71
-rw-r--r--MediaBrowser.Controller/Entities/Extensions.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs92
-rw-r--r--MediaBrowser.Controller/Entities/Genre.cs10
-rw-r--r--MediaBrowser.Controller/Entities/ICollectionFolder.cs4
-rw-r--r--MediaBrowser.Controller/Entities/IHasAspectRatio.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasDisplayOrder.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasMediaSources.cs12
-rw-r--r--MediaBrowser.Controller/Entities/IHasProgramAttributes.cs10
-rw-r--r--MediaBrowser.Controller/Entities/IHasScreenshots.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasSeries.cs12
-rw-r--r--MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs5
-rw-r--r--MediaBrowser.Controller/Entities/IHasStartDate.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IHasTrailers.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IItemByName.cs2
-rw-r--r--MediaBrowser.Controller/Entities/IMetadataContainer.cs2
-rw-r--r--MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs2
-rw-r--r--MediaBrowser.Controller/Entities/InternalItemsQuery.cs119
-rw-r--r--MediaBrowser.Controller/Entities/InternalPeopleQuery.cs2
-rw-r--r--MediaBrowser.Controller/Entities/ItemImageInfo.cs8
-rw-r--r--MediaBrowser.Controller/Entities/LinkedChild.cs7
-rw-r--r--MediaBrowser.Controller/Entities/Movies/BoxSet.cs14
-rw-r--r--MediaBrowser.Controller/Entities/Movies/Movie.cs25
-rw-r--r--MediaBrowser.Controller/Entities/MusicVideo.cs4
-rw-r--r--MediaBrowser.Controller/Entities/PeopleHelper.cs3
-rw-r--r--MediaBrowser.Controller/Entities/Person.cs8
-rw-r--r--MediaBrowser.Controller/Entities/PersonInfo.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Photo.cs14
-rw-r--r--MediaBrowser.Controller/Entities/PhotoAlbum.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Share.cs3
-rw-r--r--MediaBrowser.Controller/Entities/SourceType.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Studio.cs10
-rw-r--r--MediaBrowser.Controller/Entities/TV/Episode.cs14
-rw-r--r--MediaBrowser.Controller/Entities/TV/Season.cs19
-rw-r--r--MediaBrowser.Controller/Entities/TV/Series.cs46
-rw-r--r--MediaBrowser.Controller/Entities/TagExtensions.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Trailer.cs11
-rw-r--r--MediaBrowser.Controller/Entities/User.cs262
-rw-r--r--MediaBrowser.Controller/Entities/UserItemData.cs12
-rw-r--r--MediaBrowser.Controller/Entities/UserRootFolder.cs3
-rw-r--r--MediaBrowser.Controller/Entities/UserView.cs21
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs95
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs30
-rw-r--r--MediaBrowser.Controller/Entities/Year.cs9
57 files changed, 736 insertions, 637 deletions
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs
index 54540e892..6ebea5f44 100644
--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs
+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -35,7 +37,7 @@ namespace MediaBrowser.Controller.Entities
public override bool SupportsPlayedStatus => false;
/// <summary>
- /// The _virtual children
+ /// The _virtual children.
/// </summary>
private readonly ConcurrentBag<BaseItem> _virtualChildren = new ConcurrentBag<BaseItem>();
@@ -57,6 +59,7 @@ namespace MediaBrowser.Controller.Entities
private Guid[] _childrenIds = null;
private readonly object _childIdsLock = new object();
+
protected override List<BaseItem> LoadChildren()
{
lock (_childIdsLock)
@@ -195,6 +198,7 @@ namespace MediaBrowser.Controller.Entities
return child;
}
}
+
return null;
}
}
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index a700d0be4..8220464b3 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -1,17 +1,19 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities.Audio
{
/// <summary>
- /// Class Audio
+ /// Class Audio.
/// </summary>
public class Audio : BaseItem,
IHasAlbumArtist,
@@ -88,11 +90,11 @@ namespace MediaBrowser.Controller.Entities.Audio
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
-
if (ParentIndexNumber.HasValue)
{
songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey;
}
+
songKey += Name;
if (!string.IsNullOrEmpty(Album))
@@ -117,6 +119,7 @@ namespace MediaBrowser.Controller.Entities.Audio
{
return UnratedItem.Music;
}
+
return base.GetBlockUnratedType();
}
diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
index 056f31f78..f6d3cd6cc 100644
--- a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities.Audio
diff --git a/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs b/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs
index 5ae056050..ac4dd1688 100644
--- a/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs
+++ b/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Controller.Entities.Audio
{
public interface IHasMusicGenres
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
index c216176e7..48cd9371a 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
@@ -1,20 +1,23 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Users;
+using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
namespace MediaBrowser.Controller.Entities.Audio
{
/// <summary>
- /// Class MusicAlbum
+ /// Class MusicAlbum.
/// </summary>
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<AlbumInfo>, IMetadataContainer
{
@@ -55,6 +58,7 @@ namespace MediaBrowser.Controller.Entities.Audio
{
return LibraryManager.GetArtist(name, options);
}
+
return null;
}
@@ -97,14 +101,14 @@ namespace MediaBrowser.Controller.Entities.Audio
list.Insert(0, albumArtist + "-" + Name);
}
- var id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);
+ var id = this.GetProviderId(MetadataProvider.MusicBrainzAlbum);
if (!string.IsNullOrEmpty(id))
{
list.Insert(0, "MusicAlbum-Musicbrainz-" + id);
}
- id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
+ id = this.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup);
if (!string.IsNullOrEmpty(id))
{
@@ -114,9 +118,9 @@ namespace MediaBrowser.Controller.Entities.Audio
return list;
}
- protected override bool GetBlockUnratedValue(UserPolicy config)
+ protected override bool GetBlockUnratedValue(User user)
{
- return config.BlockUnratedItems.Contains(UnratedItem.Music);
+ return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music.ToString());
}
public override UnratedItem GetBlockUnratedType()
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
index 5e3056ccb..397a68ff7 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
@@ -1,20 +1,23 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Users;
using Microsoft.Extensions.Logging;
+using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
namespace MediaBrowser.Controller.Entities.Audio
{
/// <summary>
- /// Class MusicArtist
+ /// Class MusicArtist.
/// </summary>
public class MusicArtist : Folder, IItemByName, IHasMusicGenres, IHasDualAccess, IHasLookupInfo<ArtistInfo>
{
@@ -76,11 +79,7 @@ namespace MediaBrowser.Controller.Entities.Audio
public override int GetChildCount(User user)
{
- if (IsAccessedByName)
- {
- return 0;
- }
- return base.GetChildCount(user);
+ return IsAccessedByName ? 0 : base.GetChildCount(user);
}
public override bool IsSaveLocalMetadataEnabled()
@@ -114,7 +113,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself
+ /// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
@@ -128,7 +127,7 @@ namespace MediaBrowser.Controller.Entities.Audio
private static List<string> GetUserDataKeys(MusicArtist item)
{
var list = new List<string>();
- var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
+ var id = item.GetProviderId(MetadataProvider.MusicBrainzArtist);
if (!string.IsNullOrEmpty(id))
{
@@ -138,13 +137,15 @@ namespace MediaBrowser.Controller.Entities.Audio
list.Add("Artist-" + (item.Name ?? string.Empty).RemoveDiacritics());
return list;
}
+
public override string CreatePresentationUniqueKey()
{
return "Artist-" + (Name ?? string.Empty).RemoveDiacritics();
}
- protected override bool GetBlockUnratedValue(UserPolicy config)
+
+ protected override bool GetBlockUnratedValue(User user)
{
- return config.BlockUnratedItems.Contains(UnratedItem.Music);
+ return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Music.ToString());
}
public override UnratedItem GetBlockUnratedType()
@@ -203,7 +204,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
/// <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 or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
{
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
index 537e9630b..5a117a6b1 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
@@ -7,7 +9,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities.Audio
{
/// <summary>
- /// Class MusicGenre
+ /// Class MusicGenre.
/// </summary>
public class MusicGenre : BaseItem, IItemByName
{
@@ -18,6 +20,7 @@ namespace MediaBrowser.Controller.Entities.Audio
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
+
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
@@ -34,7 +37,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself
+ /// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
@@ -94,11 +97,12 @@ namespace MediaBrowser.Controller.Entities.Audio
Logger.LogDebug("{0} path has changed from {1} to {2}", GetType().Name, Path, newPath);
return true;
}
+
return base.RequiresRefresh();
}
/// <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 or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
{
diff --git a/MediaBrowser.Controller/Entities/AudioBook.cs b/MediaBrowser.Controller/Entities/AudioBook.cs
index a13873bf9..f4bd851e1 100644
--- a/MediaBrowser.Controller/Entities/AudioBook.cs
+++ b/MediaBrowser.Controller/Entities/AudioBook.cs
@@ -1,7 +1,9 @@
+#pragma warning disable CS1591
+
using System;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Entities
{
@@ -15,8 +17,10 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public string SeriesPresentationUniqueKey { get; set; }
+
[JsonIgnore]
public string SeriesName { get; set; }
+
[JsonIgnore]
public Guid SeriesId { get; set; }
@@ -24,10 +28,12 @@ namespace MediaBrowser.Controller.Entities
{
return SeriesName;
}
+
public string FindSeriesName()
{
return SeriesName;
}
+
public string FindSeriesPresentationUniqueKey()
{
return SeriesPresentationUniqueKey;
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 7ed8fa767..2fc7d45c9 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -7,6 +9,8 @@ using System.Text;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
@@ -24,18 +28,17 @@ using MediaBrowser.Model.Library;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Providers;
-using MediaBrowser.Model.Users;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class BaseItem
+ /// Class BaseItem.
/// </summary>
public abstract class BaseItem : IHasProviderIds, IHasLookupInfo<ItemLookupInfo>, IEquatable<BaseItem>
{
/// <summary>
- /// The supported image extensions
+ /// The supported image extensions.
/// </summary>
public static readonly string[] SupportedImageExtensions
= new[] { ".png", ".jpg", ".jpeg", ".tbn", ".gif" };
@@ -57,13 +60,11 @@ namespace MediaBrowser.Controller.Entities
protected BaseItem()
{
- ThemeSongIds = Array.Empty<Guid>();
- ThemeVideoIds = Array.Empty<Guid>();
Tags = Array.Empty<string>();
Genres = Array.Empty<string>();
Studios = Array.Empty<string>();
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- LockedFields = Array.Empty<MetadataFields>();
+ LockedFields = Array.Empty<MetadataField>();
ImageInfos = Array.Empty<ItemImageInfo>();
ProductionLocations = Array.Empty<string>();
RemoteTrailers = Array.Empty<MediaUrl>();
@@ -74,7 +75,7 @@ namespace MediaBrowser.Controller.Entities
public static char SlugChar = '-';
/// <summary>
- /// The trailer folder name
+ /// The trailer folder name.
/// </summary>
public const string TrailerFolderName = "trailers";
public const string ThemeSongsFolderName = "theme-music";
@@ -97,16 +98,57 @@ namespace MediaBrowser.Controller.Entities
};
[JsonIgnore]
- public Guid[] ThemeSongIds { get; set; }
+ public Guid[] ThemeSongIds
+ {
+ get
+ {
+ if (_themeSongIds == null)
+ {
+ _themeSongIds = GetExtras()
+ .Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeSong)
+ .Select(song => song.Id)
+ .ToArray();
+ }
+
+ return _themeSongIds;
+ }
+
+ private set
+ {
+ _themeSongIds = value;
+ }
+ }
+
[JsonIgnore]
- public Guid[] ThemeVideoIds { get; set; }
+ public Guid[] ThemeVideoIds
+ {
+ get
+ {
+ if (_themeVideoIds == null)
+ {
+ _themeVideoIds = GetExtras()
+ .Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeVideo)
+ .Select(song => song.Id)
+ .ToArray();
+ }
+
+ return _themeVideoIds;
+ }
+
+ private set
+ {
+ _themeVideoIds = value;
+ }
+ }
[JsonIgnore]
public string PreferredMetadataCountryCode { get; set; }
+
[JsonIgnore]
public string PreferredMetadataLanguage { get; set; }
public long? Size { get; set; }
+
public string Container { get; set; }
[JsonIgnore]
@@ -155,6 +197,7 @@ namespace MediaBrowser.Controller.Entities
public virtual bool SupportsRemoteImageDownloading => true;
private string _name;
+
/// <summary>
/// Gets or sets the name.
/// </summary>
@@ -242,7 +285,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself
+ /// If the item is a folder, it returns the folder itself.
/// </summary>
[JsonIgnore]
public virtual string ContainingFolderPath
@@ -266,7 +309,7 @@ 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
+ /// If this content came from an external service, the id of the content on that service.
/// </summary>
[JsonIgnore]
public string ExternalId { get; set; }
@@ -299,7 +342,7 @@ namespace MediaBrowser.Controller.Entities
{
get
{
- //if (IsOffline)
+ // if (IsOffline)
//{
// return LocationType.Offline;
//}
@@ -410,7 +453,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// This is just a helper for convenience
+ /// This is just a helper for convenience.
/// </summary>
/// <value>The primary image path.</value>
[JsonIgnore]
@@ -447,6 +490,7 @@ namespace MediaBrowser.Controller.Entities
// hack alert
return true;
}
+
if (SourceType == SourceType.Channel)
{
// hack alert
@@ -481,12 +525,12 @@ namespace MediaBrowser.Controller.Entities
public virtual bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders)
{
- if (user.Policy.EnableContentDeletion)
+ if (user.HasPermission(PermissionKind.EnableContentDeletion))
{
return true;
}
- var allowed = user.Policy.EnableContentDeletionFromFolders;
+ var allowed = user.GetPreference(PreferenceKind.EnableContentDeletionFromFolders);
if (SourceType == SourceType.Channel)
{
@@ -527,7 +571,7 @@ namespace MediaBrowser.Controller.Entities
public virtual bool IsAuthorizedToDownload(User user)
{
- return user.Policy.EnableContentDownloading;
+ return user.HasPermission(PermissionKind.EnableContentDownloading);
}
public bool CanDownload(User user)
@@ -555,17 +599,26 @@ namespace MediaBrowser.Controller.Entities
public DateTime DateLastRefreshed { get; set; }
/// <summary>
- /// The logger
+ /// The logger.
/// </summary>
- public static ILogger Logger { get; set; }
+ public static ILogger<BaseItem> Logger { get; set; }
+
public static ILibraryManager LibraryManager { get; set; }
+
public static IServerConfigurationManager ConfigurationManager { get; set; }
+
public static IProviderManager ProviderManager { get; set; }
+
public static ILocalizationManager LocalizationManager { get; set; }
+
public static IItemRepository ItemRepository { get; set; }
+
public static IFileSystem FileSystem { get; set; }
+
public static IUserDataManager UserDataManager { get; set; }
+
public static IChannelManager ChannelManager { get; set; }
+
public static IMediaSourceManager MediaSourceManager { get; set; }
/// <summary>
@@ -585,7 +638,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The locked fields.</value>
[JsonIgnore]
- public MetadataFields[] LockedFields { get; set; }
+ public MetadataField[] LockedFields { get; set; }
/// <summary>
/// Gets the type of the media.
@@ -601,7 +654,7 @@ namespace MediaBrowser.Controller.Entities
{
if (!IsFileProtocol)
{
- return new string[] { };
+ return Array.Empty<string>();
}
return new[] { Path };
@@ -609,6 +662,7 @@ namespace MediaBrowser.Controller.Entities
}
private string _forcedSortName;
+
/// <summary>
/// Gets or sets the name of the forced sort.
/// </summary>
@@ -621,6 +675,9 @@ namespace MediaBrowser.Controller.Entities
}
private string _sortName;
+ private Guid[] _themeSongIds;
+ private Guid[] _themeVideoIds;
+
/// <summary>
/// Gets the name of the sort.
/// </summary>
@@ -642,8 +699,10 @@ namespace MediaBrowser.Controller.Entities
_sortName = CreateSortName();
}
}
+
return _sortName;
}
+
set => _sortName = value;
}
@@ -661,11 +720,11 @@ namespace MediaBrowser.Controller.Entities
return System.IO.Path.Combine(basePath, "channels", ChannelId.ToString("N", CultureInfo.InvariantCulture), Id.ToString("N", CultureInfo.InvariantCulture));
}
- var idString = Id.ToString("N", CultureInfo.InvariantCulture);
+ ReadOnlySpan<char> idString = Id.ToString("N", CultureInfo.InvariantCulture);
basePath = System.IO.Path.Combine(basePath, "library");
- return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);
+ return System.IO.Path.Join(basePath, idString.Slice(0, 2), idString);
}
/// <summary>
@@ -674,7 +733,10 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
protected virtual string CreateSortName()
{
- if (Name == null) return null; //some items may not have name filled in properly
+ if (Name == null)
+ {
+ return null; // some items may not have name filled in properly
+ }
if (!EnableAlphaNumericSorting)
{
@@ -685,26 +747,27 @@ namespace MediaBrowser.Controller.Entities
foreach (var removeChar in ConfigurationManager.Configuration.SortRemoveCharacters)
{
- sortable = sortable.Replace(removeChar, string.Empty);
+ sortable = sortable.Replace(removeChar, string.Empty, StringComparison.Ordinal);
}
foreach (var replaceChar in ConfigurationManager.Configuration.SortReplaceCharacters)
{
- sortable = sortable.Replace(replaceChar, " ");
+ sortable = sortable.Replace(replaceChar, " ", StringComparison.Ordinal);
}
foreach (var search in ConfigurationManager.Configuration.SortRemoveWords)
{
// Remove from beginning if a space follows
- if (sortable.StartsWith(search + " "))
+ if (sortable.StartsWith(search + " ", StringComparison.Ordinal))
{
sortable = sortable.Remove(0, search.Length + 1);
}
+
// Remove from middle if surrounded by spaces
- sortable = sortable.Replace(" " + search + " ", " ");
+ sortable = sortable.Replace(" " + search + " ", " ", StringComparison.Ordinal);
// Remove from end if followed by a space
- if (sortable.EndsWith(" " + search))
+ if (sortable.EndsWith(" " + search, StringComparison.Ordinal))
{
sortable = sortable.Remove(sortable.Length - (search.Length + 1));
}
@@ -734,7 +797,8 @@ namespace MediaBrowser.Controller.Entities
builder.Append(chunkBuilder);
}
- //logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
+
+ // logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
return builder.ToString().RemoveDiacritics();
}
@@ -765,7 +829,6 @@ namespace MediaBrowser.Controller.Entities
get => GetParent() as Folder;
set
{
-
}
}
@@ -798,7 +861,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Finds a parent of a given type
+ /// Finds a parent of a given type.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns>``0.</returns>
@@ -813,6 +876,7 @@ namespace MediaBrowser.Controller.Entities
return item;
}
}
+
return null;
}
@@ -836,6 +900,7 @@ namespace MediaBrowser.Controller.Entities
{
return null;
}
+
return LibraryManager.GetItemById(id);
}
}
@@ -1004,12 +1069,12 @@ namespace MediaBrowser.Controller.Entities
/// <returns>PlayAccess.</returns>
public PlayAccess GetPlayAccess(User user)
{
- if (!user.Policy.EnableMediaPlayback)
+ if (!user.HasPermission(PermissionKind.EnableMediaPlayback))
{
return PlayAccess.None;
}
- //if (!user.IsParentalScheduleAllowed())
+ // if (!user.IsParentalScheduleAllowed())
//{
// return PlayAccess.None;
//}
@@ -1062,7 +1127,6 @@ namespace MediaBrowser.Controller.Entities
}
return 1;
-
}).ThenBy(i => i.Video3DFormat.HasValue ? 1 : 0)
.ThenByDescending(i =>
{
@@ -1213,11 +1277,11 @@ namespace MediaBrowser.Controller.Entities
{
if (video.IsoType.HasValue)
{
- if (video.IsoType.Value == Model.Entities.IsoType.BluRay)
+ if (video.IsoType.Value == IsoType.BluRay)
{
terms.Add("Bluray");
}
- else if (video.IsoType.Value == Model.Entities.IsoType.Dvd)
+ else if (video.IsoType.Value == IsoType.Dvd)
{
terms.Add("DVD");
}
@@ -1245,8 +1309,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 && string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase)));
return LibraryManager.ResolvePaths(files, directoryService, null, new LibraryOptions())
.OfType<Audio.Audio>()
@@ -1345,20 +1408,18 @@ namespace MediaBrowser.Controller.Entities
protected virtual void TriggerOnRefreshStart()
{
-
}
protected virtual void TriggerOnRefreshComplete()
{
-
}
/// <summary>
- /// Overrides the base implementation to refresh metadata for local trailers
+ /// Overrides the base implementation to refresh metadata for local trailers.
/// </summary>
/// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>true if a provider reports we changed</returns>
+ /// <returns>true if a provider reports we changed.</returns>
public async Task<ItemUpdateType> RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
{
TriggerOnRefreshStart();
@@ -1374,6 +1435,7 @@ namespace MediaBrowser.Controller.Entities
new List<FileSystemMetadata>();
var ownedItemsChanged = await RefreshedOwnedItems(options, files, cancellationToken).ConfigureAwait(false);
+ await LibraryManager.UpdateImagesAsync(this).ConfigureAwait(false); // ensure all image properties in DB are fresh
if (ownedItemsChanged)
{
@@ -1563,7 +1625,8 @@ namespace MediaBrowser.Controller.Entities
await Task.WhenAll(tasks).ConfigureAwait(false);
- item.ThemeVideoIds = newThemeVideoIds;
+ // They are expected to be sorted by SortName
+ item.ThemeVideoIds = newThemeVideos.OrderBy(i => i.SortName).Select(i => i.Id).ToArray();
return themeVideosChanged;
}
@@ -1600,7 +1663,8 @@ namespace MediaBrowser.Controller.Entities
await Task.WhenAll(tasks).ConfigureAwait(false);
- item.ThemeSongIds = newThemeSongIds;
+ // They are expected to be sorted by SortName
+ item.ThemeSongIds = newThemeSongs.OrderBy(i => i.SortName).Select(i => i.Id).ToArray();
return themeSongsChanged;
}
@@ -1755,7 +1819,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Determines if a given user has access to this item
+ /// Determines if a given user has access to this item.
/// </summary>
/// <param name="user">The user.</param>
/// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns>
@@ -1772,7 +1836,7 @@ namespace MediaBrowser.Controller.Entities
return false;
}
- var maxAllowedRating = user.Policy.MaxParentalRating;
+ var maxAllowedRating = user.MaxParentalAgeRating;
if (maxAllowedRating == null)
{
@@ -1788,7 +1852,7 @@ namespace MediaBrowser.Controller.Entities
if (string.IsNullOrEmpty(rating))
{
- return !GetBlockUnratedValue(user.Policy);
+ return !GetBlockUnratedValue(user);
}
var value = LocalizationManager.GetRatingLevel(rating);
@@ -1796,7 +1860,7 @@ namespace MediaBrowser.Controller.Entities
// Could not determine the integer value
if (!value.HasValue)
{
- var isAllowed = !GetBlockUnratedValue(user.Policy);
+ var isAllowed = !GetBlockUnratedValue(user);
if (!isAllowed)
{
@@ -1858,8 +1922,7 @@ namespace MediaBrowser.Controller.Entities
private bool IsVisibleViaTags(User user)
{
- var policy = user.Policy;
- if (policy.BlockedTags.Any(i => Tags.Contains(i, StringComparer.OrdinalIgnoreCase)))
+ if (user.GetPreference(PreferenceKind.BlockedTags).Any(i => Tags.Contains(i, StringComparer.OrdinalIgnoreCase)))
{
return false;
}
@@ -1885,22 +1948,18 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Gets the block unrated value.
/// </summary>
- /// <param name="config">The configuration.</param>
+ /// <param name="user">The configuration.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
- protected virtual bool GetBlockUnratedValue(UserPolicy config)
+ protected virtual bool GetBlockUnratedValue(User user)
{
// Don't block plain folders that are unrated. Let the media underneath get blocked
// Special folders like series and albums will override this method.
- if (IsFolder)
- {
- return false;
- }
- if (this is IItemByName)
+ if (IsFolder || this is IItemByName)
{
return false;
}
- return config.BlockUnratedItems.Contains(GetBlockUnratedType());
+ return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(GetBlockUnratedType().ToString());
}
/// <summary>
@@ -2066,7 +2125,7 @@ namespace MediaBrowser.Controller.Entities
public virtual bool EnableRememberingTrackSelections => true;
/// <summary>
- /// Adds a studio to the item
+ /// Adds a studio to the item.
/// </summary>
/// <param name="name">The name.</param>
/// <exception cref="ArgumentNullException"></exception>
@@ -2102,7 +2161,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Adds a genre to the item
+ /// Adds a genre to the item.
/// </summary>
/// <param name="name">The name.</param>
/// <exception cref="ArgumentNullException"></exception>
@@ -2130,7 +2189,8 @@ namespace MediaBrowser.Controller.Entities
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
/// <returns>Task.</returns>
/// <exception cref="ArgumentNullException"></exception>
- public virtual void MarkPlayed(User user,
+ public virtual void MarkPlayed(
+ User user,
DateTime? datePlayed,
bool resetPosition)
{
@@ -2176,7 +2236,7 @@ namespace MediaBrowser.Controller.Entities
var data = UserDataManager.GetUserData(user, this);
- //I think it is okay to do this here.
+ // I think it is okay to do this here.
// if this is only called when a user is manually forcing something to un-played
// then it probably is what we want to do...
data.PlayCount = 0;
@@ -2196,7 +2256,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Gets an image
+ /// Gets an image.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="imageIndex">Index of the image.</param>
@@ -2222,6 +2282,7 @@ namespace MediaBrowser.Controller.Entities
existingImage.DateModified = image.DateModified;
existingImage.Width = image.Width;
existingImage.Height = image.Height;
+ existingImage.BlurHash = image.BlurHash;
}
else
{
@@ -2265,7 +2326,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="type">The type.</param>
/// <param name="index">The index.</param>
- public void DeleteImage(ImageType type, int index)
+ public async Task DeleteImageAsync(ImageType type, int index)
{
var info = GetImageInfo(type, index);
@@ -2283,7 +2344,7 @@ namespace MediaBrowser.Controller.Entities
FileSystem.DeleteFile(info.Path);
}
- UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
+ await UpdateToRepositoryAsync(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false);
}
public void RemoveImage(ItemImageInfo image)
@@ -2296,10 +2357,8 @@ namespace MediaBrowser.Controller.Entities
ImageInfos = ImageInfos.Except(deletedImages).ToArray();
}
- public virtual void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
- {
- LibraryManager.UpdateItem(this, GetParent(), updateReason, cancellationToken);
- }
+ public virtual Task UpdateToRepositoryAsync(ItemUpdateType updateReason, CancellationToken cancellationToken)
+ => LibraryManager.UpdateItemAsync(this, GetParent(), updateReason, cancellationToken);
/// <summary>
/// Validates that images within the item are still on the filesystem.
@@ -2373,6 +2432,46 @@ namespace MediaBrowser.Controller.Entities
.ElementAtOrDefault(imageIndex);
}
+ /// <summary>
+ /// Computes image index for given image or raises if no matching image found.
+ /// </summary>
+ /// <param name="image">Image to compute index for.</param>
+ /// <exception cref="ArgumentException">Image index cannot be computed as no matching image found.
+ /// </exception>
+ /// <returns>Image index.</returns>
+ public int GetImageIndex(ItemImageInfo image)
+ {
+ if (image == null)
+ {
+ throw new ArgumentNullException(nameof(image));
+ }
+
+ if (image.Type == ImageType.Chapter)
+ {
+ var chapters = ItemRepository.GetChapters(this);
+ for (var i = 0; i < chapters.Count; i++)
+ {
+ if (chapters[i].ImagePath == image.Path)
+ {
+ return i;
+ }
+ }
+
+ throw new ArgumentException("No chapter index found for image path", image.Path);
+ }
+
+ var images = GetImages(image.Type).ToArray();
+ for (var i = 0; i < images.Length; i++)
+ {
+ if (images[i].Path == image.Path)
+ {
+ return i;
+ }
+ }
+
+ throw new ArgumentException("No image index found for image path", image.Path);
+ }
+
public IEnumerable<ItemImageInfo> GetImages(ImageType imageType)
{
if (imageType == ImageType.Chapter)
@@ -2471,7 +2570,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Gets the file system path to delete when the item is to be deleted
+ /// Gets the file system path to delete when the item is to be deleted.
/// </summary>
/// <returns></returns>
public virtual IEnumerable<FileSystemMetadata> GetDeletePaths()
@@ -2504,7 +2603,7 @@ namespace MediaBrowser.Controller.Entities
return type == ImageType.Backdrop || type == ImageType.Screenshot || type == ImageType.Chapter;
}
- public void SwapImages(ImageType type, int index1, int index2)
+ public Task SwapImagesAsync(ImageType type, int index1, int index2)
{
if (!AllowsMultipleImages(type))
{
@@ -2517,13 +2616,13 @@ namespace MediaBrowser.Controller.Entities
if (info1 == null || info2 == null)
{
// Nothing to do
- return;
+ return Task.CompletedTask;
}
if (!info1.IsLocalFile || !info2.IsLocalFile)
{
// TODO: Not supported yet
- return;
+ return Task.CompletedTask;
}
var path1 = info1.Path;
@@ -2540,7 +2639,7 @@ namespace MediaBrowser.Controller.Entities
info2.Width = 0;
info2.Height = 0;
- UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
+ return UpdateToRepositoryAsync(ItemUpdateType.ImageUpdate, CancellationToken.None);
}
public virtual bool IsPlayed(User user)
@@ -2579,6 +2678,7 @@ namespace MediaBrowser.Controller.Entities
{
return new T
{
+ Path = Path,
MetadataCountryCode = GetPreferredMetadataCountryCode(),
MetadataLanguage = GetPreferredMetadataLanguage(),
Name = GetNameForMetadataLookup(),
@@ -2720,8 +2820,8 @@ namespace MediaBrowser.Controller.Entities
newOptions.ForceSave = true;
}
- //var parentId = Id;
- //if (!video.IsOwnedItem || video.ParentId != parentId)
+ // var parentId = Id;
+ // if (!video.IsOwnedItem || video.ParentId != parentId)
//{
// video.IsOwnedItem = true;
// video.ParentId = parentId;
@@ -2763,14 +2863,7 @@ namespace MediaBrowser.Controller.Entities
return this;
}
- foreach (var parent in GetParents())
- {
- if (parent.IsTopParent)
- {
- return parent;
- }
- }
- return null;
+ return GetParents().FirstOrDefault(parent => parent.IsTopParent);
}
[JsonIgnore]
@@ -2862,12 +2955,12 @@ namespace MediaBrowser.Controller.Entities
public IEnumerable<BaseItem> GetThemeSongs()
{
- return ThemeVideoIds.Select(LibraryManager.GetItemById).Where(i => i.ExtraType.Equals(Model.Entities.ExtraType.ThemeSong)).OrderBy(i => i.SortName);
+ return ThemeSongIds.Select(LibraryManager.GetItemById);
}
public IEnumerable<BaseItem> GetThemeVideos()
{
- return ThemeVideoIds.Select(LibraryManager.GetItemById).Where(i => i.ExtraType.Equals(Model.Entities.ExtraType.ThemeVideo)).OrderBy(i => i.SortName);
+ return ThemeVideoIds.Select(LibraryManager.GetItemById);
}
/// <summary>
@@ -2904,9 +2997,13 @@ namespace MediaBrowser.Controller.Entities
public IEnumerable<BaseItem> GetTrailers()
{
if (this is IHasTrailers)
+ {
return ((IHasTrailers)this).LocalTrailerIds.Select(LibraryManager.GetItemById).Where(i => i != null).OrderBy(i => i.SortName);
+ }
else
+ {
return Array.Empty<BaseItem>();
+ }
}
public virtual bool IsHD => Height >= 720;
diff --git a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
index 815239be2..c65477d39 100644
--- a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
+++ b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Linq;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
@@ -43,7 +45,8 @@ namespace MediaBrowser.Controller.Entities
{
if (file.StartsWith("http", System.StringComparison.OrdinalIgnoreCase))
{
- item.SetImage(new ItemImageInfo
+ item.SetImage(
+ new ItemImageInfo
{
Path = file,
Type = imageType
diff --git a/MediaBrowser.Controller/Entities/BasePluginFolder.cs b/MediaBrowser.Controller/Entities/BasePluginFolder.cs
index 62d172fcc..ef5a5a734 100644
--- a/MediaBrowser.Controller/Entities/BasePluginFolder.cs
+++ b/MediaBrowser.Controller/Entities/BasePluginFolder.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Text.Json.Serialization;
namespace MediaBrowser.Controller.Entities
@@ -26,13 +28,5 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public override bool SupportsPeople => false;
-
- //public override double? GetDefaultPrimaryImageAspectRatio()
- //{
- // double value = 16;
- // value /= 9;
-
- // return value;
- //}
}
}
diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs
index dcad2554b..55945283c 100644
--- a/MediaBrowser.Controller/Entities/Book.cs
+++ b/MediaBrowser.Controller/Entities/Book.cs
@@ -1,8 +1,10 @@
+#pragma warning disable CS1591
+
using System;
using System.Linq;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Entities
{
@@ -11,6 +13,10 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public override string MediaType => Model.Entities.MediaType.Book;
+ public override bool SupportsPlayedStatus => true;
+
+ public override bool SupportsPositionTicksResume => true;
+
[JsonIgnore]
public string SeriesPresentationUniqueKey { get; set; }
@@ -20,6 +26,11 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public Guid SeriesId { get; set; }
+ public Book()
+ {
+ this.RunTimeTicks = TimeSpan.TicksPerSecond;
+ }
+
public string FindSeriesSortName()
{
return SeriesName;
@@ -40,11 +51,13 @@ namespace MediaBrowser.Controller.Entities
return SeriesId;
}
+ /// <inheritdoc />
public override bool CanDownload()
{
return IsFileProtocol;
}
+ /// <inheritdoc />
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.Book;
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index e5adf88d1..d25545a2f 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.IO;
@@ -18,12 +20,14 @@ namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// Specialized Folder class that points to a subset of the physical folders in the system.
- /// It is created from the user-specific folders within the system root
+ /// It is created from the user-specific folders within the system root.
/// </summary>
public class CollectionFolder : Folder, ICollectionFolder
{
public static IXmlSerializer XmlSerializer { get; set; }
+
public static IJsonSerializer JsonSerializer { get; set; }
+
public static IServerApplicationHost ApplicationHost { get; set; }
public CollectionFolder()
@@ -140,7 +144,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Allow different display preferences for each collection folder
+ /// Allow different display preferences for each collection folder.
/// </summary>
/// <value>The display prefs id.</value>
[JsonIgnore]
@@ -155,6 +159,7 @@ namespace MediaBrowser.Controller.Entities
}
public string[] PhysicalLocationsList { get; set; }
+
public Guid[] PhysicalFolderIds { get; set; }
protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService)
@@ -222,7 +227,7 @@ namespace MediaBrowser.Controller.Entities
return null;
}
- return (totalProgresses / foldersWithProgress);
+ return totalProgresses / foldersWithProgress;
}
protected override bool RefreshLinkedChildren(IEnumerable<FileSystemMetadata> fileSystemChildren)
diff --git a/MediaBrowser.Controller/Entities/DayOfWeekHelper.cs b/MediaBrowser.Controller/Entities/DayOfWeekHelper.cs
deleted file mode 100644
index 8a79e0783..000000000
--- a/MediaBrowser.Controller/Entities/DayOfWeekHelper.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Collections.Generic;
-using MediaBrowser.Model.Configuration;
-
-namespace MediaBrowser.Controller.Entities
-{
- public static class DayOfWeekHelper
- {
- public static List<DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day)
- {
- return GetDaysOfWeek(new List<DynamicDayOfWeek> { day });
- }
-
- public static List<DayOfWeek> GetDaysOfWeek(List<DynamicDayOfWeek> days)
- {
- var list = new List<DayOfWeek>();
-
- if (days.Contains(DynamicDayOfWeek.Sunday) ||
- days.Contains(DynamicDayOfWeek.Weekend) ||
- days.Contains(DynamicDayOfWeek.Everyday))
- {
- list.Add(DayOfWeek.Sunday);
- }
-
- if (days.Contains(DynamicDayOfWeek.Saturday) ||
- days.Contains(DynamicDayOfWeek.Weekend) ||
- days.Contains(DynamicDayOfWeek.Everyday))
- {
- list.Add(DayOfWeek.Saturday);
- }
-
- if (days.Contains(DynamicDayOfWeek.Monday) ||
- days.Contains(DynamicDayOfWeek.Weekday) ||
- days.Contains(DynamicDayOfWeek.Everyday))
- {
- list.Add(DayOfWeek.Monday);
- }
-
- if (days.Contains(DynamicDayOfWeek.Tuesday) ||
- days.Contains(DynamicDayOfWeek.Weekday) ||
- days.Contains(DynamicDayOfWeek.Everyday))
- {
- list.Add(DayOfWeek.Tuesday
- );
- }
-
- if (days.Contains(DynamicDayOfWeek.Wednesday) ||
- days.Contains(DynamicDayOfWeek.Weekday) ||
- days.Contains(DynamicDayOfWeek.Everyday))
- {
- list.Add(DayOfWeek.Wednesday);
- }
-
- if (days.Contains(DynamicDayOfWeek.Thursday) ||
- days.Contains(DynamicDayOfWeek.Weekday) ||
- days.Contains(DynamicDayOfWeek.Everyday))
- {
- list.Add(DayOfWeek.Thursday);
- }
-
- if (days.Contains(DynamicDayOfWeek.Friday) ||
- days.Contains(DynamicDayOfWeek.Weekday) ||
- days.Contains(DynamicDayOfWeek.Everyday))
- {
- list.Add(DayOfWeek.Friday);
- }
-
- return list;
- }
- }
-}
diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.cs
index d2ca11740..3a34c668c 100644
--- a/MediaBrowser.Controller/Entities/Extensions.cs
+++ b/MediaBrowser.Controller/Entities/Extensions.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class Extensions
+ /// Class Extensions.
/// </summary>
public static class Extensions
{
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index a468e0c35..35ddaffad 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -8,6 +8,8 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Collections;
@@ -15,18 +17,21 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
-using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
+using Episode = MediaBrowser.Controller.Entities.TV.Episode;
+using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
+using Season = MediaBrowser.Controller.Entities.TV.Season;
+using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class Folder
+ /// Class Folder.
/// </summary>
public class Folder : BaseItem
{
@@ -121,10 +126,12 @@ namespace MediaBrowser.Controller.Entities
{
return false;
}
+
if (this is UserView)
{
return false;
}
+
return true;
}
@@ -151,6 +158,7 @@ namespace MediaBrowser.Controller.Entities
{
item.DateCreated = DateTime.UtcNow;
}
+
if (item.DateModified == DateTime.MinValue)
{
item.DateModified = DateTime.UtcNow;
@@ -167,7 +175,7 @@ namespace MediaBrowser.Controller.Entities
public virtual IEnumerable<BaseItem> Children => LoadChildren();
/// <summary>
- /// thread-safe access to all recursive children of this folder - without regard to user
+ /// thread-safe access to all recursive children of this folder - without regard to user.
/// </summary>
/// <value>The recursive children.</value>
[JsonIgnore]
@@ -177,19 +185,22 @@ namespace MediaBrowser.Controller.Entities
{
if (this is ICollectionFolder && !(this is BasePluginFolder))
{
- if (user.Policy.BlockedMediaFolders != null)
+ var blockedMediaFolders = user.GetPreference(PreferenceKind.BlockedMediaFolders);
+ if (blockedMediaFolders.Length > 0)
{
- if (user.Policy.BlockedMediaFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase) ||
+ if (blockedMediaFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase) ||
// Backwards compatibility
- user.Policy.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
+ blockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
{
return false;
}
}
else
{
- if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
+ if (!user.HasPermission(PermissionKind.EnableAllFolders)
+ && !user.GetPreference(PreferenceKind.EnabledFolders)
+ .Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
{
return false;
}
@@ -205,8 +216,8 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
protected virtual List<BaseItem> LoadChildren()
{
- //logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
- //just load our children from the repo - the library will be validated and maintained in other processes
+ // logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
+ // just load our children from the repo - the library will be validated and maintained in other processes
return GetCachedChildren();
}
@@ -221,7 +232,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Validates that the children of the folder still exist
+ /// Validates that the children of the folder still exist.
/// </summary>
/// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
@@ -244,7 +255,8 @@ namespace MediaBrowser.Controller.Entities
var id = child.Id;
if (dictionary.ContainsKey(id))
{
- Logger.LogError("Found folder containing items with duplicate id. Path: {path}, Child Name: {ChildName}",
+ Logger.LogError(
+ "Found folder containing items with duplicate id. Path: {path}, Child Name: {ChildName}",
Path ?? Name,
child.Path ?? child.Name);
}
@@ -339,7 +351,12 @@ namespace MediaBrowser.Controller.Entities
if (currentChild.UpdateFromResolvedItem(child) > ItemUpdateType.None)
{
- currentChild.UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken);
+ await currentChild.UpdateToRepositoryAsync(ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ // metadata is up-to-date; make sure DB has correct images dimensions and hash
+ await LibraryManager.UpdateImagesAsync(currentChild).ConfigureAwait(false);
}
continue;
@@ -464,7 +481,7 @@ namespace MediaBrowser.Controller.Entities
innerProgress.RegisterAction(p =>
{
double innerPercent = currentInnerPercent;
- innerPercent += p / (count);
+ innerPercent += p / count;
progress.Report(innerPercent);
});
@@ -487,8 +504,8 @@ namespace MediaBrowser.Controller.Entities
if (series != null)
{
await series.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
-
}
+
await container.RefreshAllMetadata(refreshOptions, progress, cancellationToken).ConfigureAwait(false);
}
@@ -540,7 +557,7 @@ namespace MediaBrowser.Controller.Entities
innerProgress.RegisterAction(p =>
{
double innerPercent = currentInnerPercent;
- innerPercent += p / (count);
+ innerPercent += p / count;
progress.Report(innerPercent);
});
@@ -558,7 +575,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Get the children of this folder from the actual file system
+ /// Get the children of this folder from the actual file system.
/// </summary>
/// <returns>IEnumerable{BaseItem}.</returns>
protected virtual IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
@@ -570,7 +587,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Get our children from the repo - stubbed for now
+ /// Get our children from the repo - stubbed for now.
/// </summary>
/// <returns>IEnumerable{BaseItem}.</returns>
protected List<BaseItem> GetCachedChildren()
@@ -602,7 +619,6 @@ namespace MediaBrowser.Controller.Entities
{
EnableImages = false
}
-
});
return result.TotalRecordCount;
@@ -877,7 +893,7 @@ namespace MediaBrowser.Controller.Entities
try
{
query.Parent = this;
- query.ChannelIds = new Guid[] { ChannelId };
+ query.ChannelIds = new[] { ChannelId };
// Don't blow up here because it could cause parent screens with other content to fail
return ChannelManager.GetChannelItemsInternal(query, new SimpleProgress<double>(), CancellationToken.None).Result;
@@ -928,6 +944,7 @@ namespace MediaBrowser.Controller.Entities
{
items = items.Where(i => string.Compare(query.NameStartsWithOrGreater, i.SortName, StringComparison.CurrentCultureIgnoreCase) < 1);
}
+
if (!string.IsNullOrEmpty(query.NameStartsWith))
{
items = items.Where(i => i.SortName.StartsWith(query.NameStartsWith, StringComparison.OrdinalIgnoreCase));
@@ -947,11 +964,13 @@ namespace MediaBrowser.Controller.Entities
return UserViewBuilder.SortAndPage(items, null, query, LibraryManager, enableSorting);
}
- private static IEnumerable<BaseItem> CollapseBoxSetItemsIfNeeded(IEnumerable<BaseItem> items,
+ private static IEnumerable<BaseItem> CollapseBoxSetItemsIfNeeded(
+ IEnumerable<BaseItem> items,
InternalItemsQuery query,
BaseItem queryParent,
User user,
- IServerConfigurationManager configurationManager, ICollectionManager collectionManager)
+ IServerConfigurationManager configurationManager,
+ ICollectionManager collectionManager)
{
if (items == null)
{
@@ -966,7 +985,8 @@ namespace MediaBrowser.Controller.Entities
return items;
}
- private static bool CollapseBoxSetItems(InternalItemsQuery query,
+ private static bool CollapseBoxSetItems(
+ InternalItemsQuery query,
BaseItem queryParent,
User user,
IServerConfigurationManager configurationManager)
@@ -976,18 +996,22 @@ namespace MediaBrowser.Controller.Entities
{
return false;
}
+
if (queryParent is Series)
{
return false;
}
+
if (queryParent is Season)
{
return false;
}
+
if (queryParent is MusicAlbum)
{
return false;
}
+
if (queryParent is MusicArtist)
{
return false;
@@ -1017,22 +1041,27 @@ namespace MediaBrowser.Controller.Entities
{
return false;
}
+
if (request.IsFavoriteOrLiked.HasValue)
{
return false;
}
+
if (request.IsLiked.HasValue)
{
return false;
}
+
if (request.IsPlayed.HasValue)
{
return false;
}
+
if (request.IsResumable.HasValue)
{
return false;
}
+
if (request.IsFolder.HasValue)
{
return false;
@@ -1208,7 +1237,7 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentNullException(nameof(user));
}
- //the true root should return our users root folder children
+ // the true root should return our users root folder children
if (IsPhysicalRoot)
{
return LibraryManager.GetUserRootFolder().GetChildren(user, includeLinkedChildren);
@@ -1273,7 +1302,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Gets allowed recursive children of an item
+ /// Gets allowed recursive children of an item.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
@@ -1359,7 +1388,6 @@ namespace MediaBrowser.Controller.Entities
}
}
-
/// <summary>
/// Gets the linked children.
/// </summary>
@@ -1378,6 +1406,7 @@ namespace MediaBrowser.Controller.Entities
list.Add(child);
}
}
+
return list;
}
@@ -1400,6 +1429,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
}
+
return false;
}
@@ -1565,7 +1595,8 @@ namespace MediaBrowser.Controller.Entities
/// <param name="datePlayed">The date played.</param>
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
/// <returns>Task.</returns>
- public override void MarkPlayed(User user,
+ public override void MarkPlayed(
+ User user,
DateTime? datePlayed,
bool resetPosition)
{
@@ -1577,7 +1608,7 @@ namespace MediaBrowser.Controller.Entities
EnableTotalRecordCount = false
};
- if (!user.Configuration.DisplayMissingEpisodes)
+ if (!user.DisplayMissingEpisodes)
{
query.IsVirtualItem = false;
}
@@ -1614,7 +1645,6 @@ namespace MediaBrowser.Controller.Entities
Recursive = true,
IsFolder = false,
EnableTotalRecordCount = false
-
});
// Sweep through recursively and update status
@@ -1632,7 +1662,6 @@ namespace MediaBrowser.Controller.Entities
IsFolder = false,
IsVirtualItem = false,
EnableTotalRecordCount = false
-
});
return itemsResult
@@ -1654,22 +1683,27 @@ namespace MediaBrowser.Controller.Entities
{
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)
{
diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs
index 773c7df34..db6c85caf 100644
--- a/MediaBrowser.Controller/Entities/Genre.cs
+++ b/MediaBrowser.Controller/Entities/Genre.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
@@ -8,7 +10,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class Genre
+ /// Class Genre.
/// </summary>
public class Genre : BaseItem, IItemByName
{
@@ -19,6 +21,7 @@ namespace MediaBrowser.Controller.Entities
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
+
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
@@ -31,7 +34,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself
+ /// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
@@ -92,11 +95,12 @@ namespace MediaBrowser.Controller.Entities
Logger.LogDebug("{0} path has changed from {1} to {2}", GetType().Name, Path, newPath);
return true;
}
+
return base.RequiresRefresh();
}
/// <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 or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
{
diff --git a/MediaBrowser.Controller/Entities/ICollectionFolder.cs b/MediaBrowser.Controller/Entities/ICollectionFolder.cs
index 4f0760746..b84a9fa6f 100644
--- a/MediaBrowser.Controller/Entities/ICollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/ICollectionFolder.cs
@@ -1,9 +1,11 @@
+#pragma warning disable CS1591
+
using System;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// This is just a marker interface to denote top level folders
+ /// This is just a marker interface to denote top level folders.
/// </summary>
public interface ICollectionFolder : IHasCollectionType
{
diff --git a/MediaBrowser.Controller/Entities/IHasAspectRatio.cs b/MediaBrowser.Controller/Entities/IHasAspectRatio.cs
index 149c1e5ab..d7d007668 100644
--- a/MediaBrowser.Controller/Entities/IHasAspectRatio.cs
+++ b/MediaBrowser.Controller/Entities/IHasAspectRatio.cs
@@ -1,7 +1,7 @@
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Interface IHasAspectRatio
+ /// Interface IHasAspectRatio.
/// </summary>
public interface IHasAspectRatio
{
diff --git a/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs b/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs
index abee75a28..13226b234 100644
--- a/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs
+++ b/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs
@@ -1,7 +1,7 @@
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Interface IHasDisplayOrder
+ /// Interface IHasDisplayOrder.
/// </summary>
public interface IHasDisplayOrder
{
diff --git a/MediaBrowser.Controller/Entities/IHasMediaSources.cs b/MediaBrowser.Controller/Entities/IHasMediaSources.cs
index 4635b9062..0f612262a 100644
--- a/MediaBrowser.Controller/Entities/IHasMediaSources.cs
+++ b/MediaBrowser.Controller/Entities/IHasMediaSources.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Dto;
@@ -7,13 +9,17 @@ namespace MediaBrowser.Controller.Entities
{
public interface IHasMediaSources
{
+ Guid Id { get; set; }
+
+ long? RunTimeTicks { get; set; }
+
+ string Path { get; }
+
/// <summary>
/// Gets the media sources.
/// </summary>
List<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution);
+
List<MediaStream> GetMediaStreams();
- Guid Id { get; set; }
- long? RunTimeTicks { get; set; }
- string Path { get; }
}
}
diff --git a/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs b/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs
index 777b40828..f747b5149 100644
--- a/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs
+++ b/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using MediaBrowser.Model.LiveTv;
namespace MediaBrowser.Controller.Entities
@@ -5,13 +7,21 @@ namespace MediaBrowser.Controller.Entities
public interface IHasProgramAttributes
{
bool IsMovie { get; set; }
+
bool IsSports { get; }
+
bool IsNews { get; }
+
bool IsKids { get; }
+
bool IsRepeat { get; set; }
+
bool IsSeries { get; set; }
+
ProgramAudio? Audio { get; set; }
+
string EpisodeTitle { get; set; }
+
string ServiceName { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/IHasScreenshots.cs b/MediaBrowser.Controller/Entities/IHasScreenshots.cs
index 0975242f5..b027a0cb1 100644
--- a/MediaBrowser.Controller/Entities/IHasScreenshots.cs
+++ b/MediaBrowser.Controller/Entities/IHasScreenshots.cs
@@ -1,7 +1,7 @@
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Interface IHasScreenshots
+ /// Interface IHasScreenshots.
/// </summary>
public interface IHasScreenshots
{
diff --git a/MediaBrowser.Controller/Entities/IHasSeries.cs b/MediaBrowser.Controller/Entities/IHasSeries.cs
index 7da53f730..5444f1f52 100644
--- a/MediaBrowser.Controller/Entities/IHasSeries.cs
+++ b/MediaBrowser.Controller/Entities/IHasSeries.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
namespace MediaBrowser.Controller.Entities
@@ -9,11 +11,17 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The name of the series.</value>
string SeriesName { get; set; }
+
+ Guid SeriesId { get; set; }
+
+ string SeriesPresentationUniqueKey { get; set; }
+
string FindSeriesName();
+
string FindSeriesSortName();
- Guid SeriesId { get; set; }
+
Guid FindSeriesId();
- string SeriesPresentationUniqueKey { get; set; }
+
string FindSeriesPresentationUniqueKey();
}
}
diff --git a/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs b/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs
index 688439e6c..6a350212b 100644
--- a/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs
+++ b/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs
@@ -1,4 +1,7 @@
+#pragma warning disable CS1591
+
using System;
+using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities
{
@@ -8,6 +11,6 @@ namespace MediaBrowser.Controller.Entities
/// Gets or sets the special feature ids.
/// </summary>
/// <value>The special feature ids.</value>
- Guid[] SpecialFeatureIds { get; set; }
+ IReadOnlyList<Guid> SpecialFeatureIds { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/IHasStartDate.cs b/MediaBrowser.Controller/Entities/IHasStartDate.cs
index 1ecde9af4..dab15eb01 100644
--- a/MediaBrowser.Controller/Entities/IHasStartDate.cs
+++ b/MediaBrowser.Controller/Entities/IHasStartDate.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
namespace MediaBrowser.Controller.Entities
diff --git a/MediaBrowser.Controller/Entities/IHasTrailers.cs b/MediaBrowser.Controller/Entities/IHasTrailers.cs
index dd8e3c45f..d1f6f2b7e 100644
--- a/MediaBrowser.Controller/Entities/IHasTrailers.cs
+++ b/MediaBrowser.Controller/Entities/IHasTrailers.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
diff --git a/MediaBrowser.Controller/Entities/IItemByName.cs b/MediaBrowser.Controller/Entities/IItemByName.cs
index 8ef5c8d96..cac8aa61a 100644
--- a/MediaBrowser.Controller/Entities/IItemByName.cs
+++ b/MediaBrowser.Controller/Entities/IItemByName.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities
diff --git a/MediaBrowser.Controller/Entities/IMetadataContainer.cs b/MediaBrowser.Controller/Entities/IMetadataContainer.cs
index a384c0df3..77f5cfb79 100644
--- a/MediaBrowser.Controller/Entities/IMetadataContainer.cs
+++ b/MediaBrowser.Controller/Entities/IMetadataContainer.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs
index 3e96771c3..cdda8ea39 100644
--- a/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs
+++ b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Controller.Entities
{
public interface ISupportsPlaceHolders
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index bd96059e3..904752a22 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -1,8 +1,11 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities
@@ -20,100 +23,167 @@ namespace MediaBrowser.Controller.Entities
public BaseItem SimilarTo { get; set; }
public bool? IsFolder { get; set; }
+
public bool? IsFavorite { get; set; }
+
public bool? IsFavoriteOrLiked { get; set; }
+
public bool? IsLiked { get; set; }
+
public bool? IsPlayed { get; set; }
+
public bool? IsResumable { get; set; }
+
public bool? IncludeItemsByName { get; set; }
public string[] MediaTypes { get; set; }
+
public string[] IncludeItemTypes { get; set; }
+
public string[] ExcludeItemTypes { get; set; }
+
public string[] ExcludeTags { get; set; }
+
public string[] ExcludeInheritedTags { get; set; }
+
public string[] Genres { get; set; }
public bool? IsSpecialSeason { get; set; }
+
public bool? IsMissing { get; set; }
+
public bool? IsUnaired { get; set; }
+
public bool? CollapseBoxSetItems { get; set; }
public string NameStartsWithOrGreater { get; set; }
+
public string NameStartsWith { get; set; }
+
public string NameLessThan { get; set; }
+
public string NameContains { get; set; }
+
public string MinSortName { get; set; }
public string PresentationUniqueKey { get; set; }
+
public string Path { get; set; }
+
public string Name { get; set; }
public string Person { get; set; }
+
public Guid[] PersonIds { get; set; }
+
public Guid[] ItemIds { get; set; }
+
public Guid[] ExcludeItemIds { get; set; }
+
public string AdjacentTo { get; set; }
+
public string[] PersonTypes { get; set; }
public bool? Is3D { get; set; }
+
public bool? IsHD { get; set; }
+
public bool? IsLocked { get; set; }
+
public bool? IsPlaceHolder { get; set; }
public bool? HasImdbId { get; set; }
+
public bool? HasOverview { get; set; }
+
public bool? HasTmdbId { get; set; }
+
public bool? HasOfficialRating { get; set; }
+
public bool? HasTvdbId { get; set; }
+
public bool? HasThemeSong { get; set; }
+
public bool? HasThemeVideo { get; set; }
+
public bool? HasSubtitles { get; set; }
+
public bool? HasSpecialFeature { get; set; }
+
public bool? HasTrailer { get; set; }
+
public bool? HasParentalRating { get; set; }
public Guid[] StudioIds { get; set; }
+
public Guid[] GenreIds { get; set; }
+
public ImageType[] ImageTypes { get; set; }
+
public VideoType[] VideoTypes { get; set; }
+
public UnratedItem[] BlockUnratedItems { get; set; }
+
public int[] Years { get; set; }
+
public string[] Tags { get; set; }
+
public string[] OfficialRatings { get; set; }
public DateTime? MinPremiereDate { get; set; }
+
public DateTime? MaxPremiereDate { get; set; }
+
public DateTime? MinStartDate { get; set; }
+
public DateTime? MaxStartDate { get; set; }
+
public DateTime? MinEndDate { get; set; }
+
public DateTime? MaxEndDate { get; set; }
+
public bool? IsAiring { get; set; }
public bool? IsMovie { get; set; }
+
public bool? IsSports { get; set; }
+
public bool? IsKids { get; set; }
+
public bool? IsNews { get; set; }
+
public bool? IsSeries { get; set; }
+
public int? MinIndexNumber { get; set; }
+
public int? AiredDuringSeason { get; set; }
+
public double? MinCriticRating { get; set; }
+
public double? MinCommunityRating { get; set; }
public Guid[] ChannelIds { get; set; }
public int? ParentIndexNumber { get; set; }
+
public int? ParentIndexNumberNotEquals { get; set; }
+
public int? IndexNumber { get; set; }
+
public int? MinParentalRating { get; set; }
+
public int? MaxParentalRating { get; set; }
public bool? HasDeadParentId { get; set; }
+
public bool? IsVirtualItem { get; set; }
public Guid ParentId { get; set; }
+
public string ParentType { get; set; }
+
public Guid[] AncestorIds { get; set; }
+
public Guid[] TopParentIds { get; set; }
public BaseItem Parent
@@ -134,41 +204,65 @@ namespace MediaBrowser.Controller.Entities
}
public string[] PresetViews { get; set; }
+
public TrailerType[] TrailerTypes { get; set; }
+
public SourceType[] SourceTypes { get; set; }
public SeriesStatus[] SeriesStatuses { get; set; }
+
public string ExternalSeriesId { get; set; }
+
public string ExternalId { get; set; }
public Guid[] AlbumIds { get; set; }
+
public Guid[] ArtistIds { get; set; }
+
public Guid[] ExcludeArtistIds { get; set; }
+
public string AncestorWithPresentationUniqueKey { get; set; }
+
public string SeriesPresentationUniqueKey { get; set; }
public bool GroupByPresentationUniqueKey { get; set; }
+
public bool GroupBySeriesPresentationUniqueKey { get; set; }
+
public bool EnableTotalRecordCount { get; set; }
+
public bool ForceDirect { get; set; }
+
public Dictionary<string, string> ExcludeProviderIds { get; set; }
+
public bool EnableGroupByMetadataKey { get; set; }
+
public bool? HasChapterImages { get; set; }
public IReadOnlyList<(string, SortOrder)> OrderBy { get; set; }
public DateTime? MinDateCreated { get; set; }
+
public DateTime? MinDateLastSaved { get; set; }
+
public DateTime? MinDateLastSavedForUser { get; set; }
public DtoOptions DtoOptions { get; set; }
+
public int MinSimilarityScore { get; set; }
+
public string HasNoAudioTrackWithLanguage { get; set; }
+
public string HasNoInternalSubtitleTrackWithLanguage { get; set; }
+
public string HasNoExternalSubtitleTrackWithLanguage { get; set; }
+
public string HasNoSubtitleTrackWithLanguage { get; set; }
+
public bool? IsDeadArtist { get; set; }
+
public bool? IsDeadStudio { get; set; }
+
public bool? IsDeadPerson { get; set; }
public InternalItemsQuery()
@@ -223,32 +317,45 @@ namespace MediaBrowser.Controller.Entities
{
if (user != null)
{
- var policy = user.Policy;
- MaxParentalRating = policy.MaxParentalRating;
+ MaxParentalRating = user.MaxParentalAgeRating;
- if (policy.MaxParentalRating.HasValue)
+ if (MaxParentalRating.HasValue)
{
- BlockUnratedItems = policy.BlockUnratedItems.Where(i => i != UnratedItem.Other).ToArray();
+ BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
+ .Where(i => i != UnratedItem.Other.ToString())
+ .Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
}
- ExcludeInheritedTags = policy.BlockedTags;
+ ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
User = user;
}
}
public Dictionary<string, string> HasAnyProviderId { get; set; }
+
public Guid[] AlbumArtistIds { get; set; }
+
public Guid[] BoxSetLibraryFolders { get; set; }
+
public Guid[] ContributingArtistIds { get; set; }
+
public bool? HasAired { get; set; }
+
public bool? HasOwnerId { get; set; }
+
public bool? Is4K { get; set; }
+
public int? MaxHeight { get; set; }
+
public int? MaxWidth { get; set; }
+
public int? MinHeight { get; set; }
+
public int? MinWidth { get; set; }
+
public string SearchTerm { get; set; }
+
public string SeriesTimerId { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
index 011975dd2..4e09ee573 100644
--- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
namespace MediaBrowser.Controller.Entities
diff --git a/MediaBrowser.Controller/Entities/ItemImageInfo.cs b/MediaBrowser.Controller/Entities/ItemImageInfo.cs
index fc46dec2e..570d8eec0 100644
--- a/MediaBrowser.Controller/Entities/ItemImageInfo.cs
+++ b/MediaBrowser.Controller/Entities/ItemImageInfo.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Text.Json.Serialization;
using MediaBrowser.Model.Entities;
@@ -28,6 +30,12 @@ namespace MediaBrowser.Controller.Entities
public int Height { get; set; }
+ /// <summary>
+ /// Gets or sets the blurhash.
+ /// </summary>
+ /// <value>The blurhash.</value>
+ public string BlurHash { get; set; }
+
[JsonIgnore]
public bool IsLocalFile => Path == null || !Path.StartsWith("http", StringComparison.OrdinalIgnoreCase);
}
diff --git a/MediaBrowser.Controller/Entities/LinkedChild.cs b/MediaBrowser.Controller/Entities/LinkedChild.cs
index d88c31007..8e0f721e7 100644
--- a/MediaBrowser.Controller/Entities/LinkedChild.cs
+++ b/MediaBrowser.Controller/Entities/LinkedChild.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -9,14 +11,16 @@ namespace MediaBrowser.Controller.Entities
public class LinkedChild
{
public string Path { get; set; }
+
public LinkedChildType Type { get; set; }
+
public string LibraryItemId { get; set; }
[JsonIgnore]
public string Id { get; set; }
/// <summary>
- /// Serves as a cache
+ /// Serves as a cache.
/// </summary>
public Guid? ItemId { get; set; }
@@ -63,6 +67,7 @@ namespace MediaBrowser.Controller.Entities
{
return _fileSystem.AreEqual(x.Path, y.Path);
}
+
return false;
}
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index feaf8c45a..8de88cc1b 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -1,17 +1,19 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
-using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Entities.Movies
{
/// <summary>
- /// Class BoxSet
+ /// Class BoxSet.
/// </summary>
public class BoxSet : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<BoxSetInfo>
{
@@ -45,9 +47,9 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <value>The display order.</value>
public string DisplayOrder { get; set; }
- protected override bool GetBlockUnratedValue(UserPolicy config)
+ protected override bool GetBlockUnratedValue(User user)
{
- return config.BlockUnratedItems.Contains(UnratedItem.Movie);
+ return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Movie.ToString());
}
public override double GetDefaultPrimaryImageAspectRatio()
@@ -198,7 +200,7 @@ namespace MediaBrowser.Controller.Entities.Movies
public Guid[] GetLibraryFolderIds()
{
- var expandedFolders = new List<Guid>() { };
+ var expandedFolders = new List<Guid>();
return FlattenItems(this, expandedFolders)
.SelectMany(i => LibraryManager.GetCollectionFolders(i))
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index 11dc472b6..8b67aaccc 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -1,11 +1,14 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
@@ -13,12 +16,10 @@ using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities.Movies
{
/// <summary>
- /// Class Movie
+ /// Class Movie.
/// </summary>
public class Movie : Video, IHasSpecialFeatures, IHasTrailers, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
{
- public Guid[] SpecialFeatureIds { get; set; }
-
public Movie()
{
SpecialFeatureIds = Array.Empty<Guid>();
@@ -28,6 +29,9 @@ namespace MediaBrowser.Controller.Entities.Movies
}
/// <inheritdoc />
+ public IReadOnlyList<Guid> SpecialFeatureIds { get; set; }
+
+ /// <inheritdoc />
public IReadOnlyList<Guid> LocalTrailerIds { get; set; }
/// <inheritdoc />
@@ -46,6 +50,9 @@ namespace MediaBrowser.Controller.Entities.Movies
set => TmdbCollectionName = value;
}
+ [JsonIgnore]
+ public override bool StopRefreshIfLocalMetadataFound => false;
+
public override double GetDefaultPrimaryImageAspectRatio()
{
// hack for tv plugins
@@ -105,6 +112,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return itemsChanged;
}
+ /// <inheritdoc />
public override UnratedItem GetBlockUnratedType()
{
return UnratedItem.Movie;
@@ -133,6 +141,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return info;
}
+ /// <inheritdoc />
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
{
var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata);
@@ -169,24 +178,22 @@ namespace MediaBrowser.Controller.Entities.Movies
return hasChanges;
}
+ /// <inheritdoc />
public override List<ExternalUrl> GetRelatedUrls()
{
var list = base.GetRelatedUrls();
- var imdbId = this.GetProviderId(MetadataProviders.Imdb);
+ var imdbId = this.GetProviderId(MetadataProvider.Imdb);
if (!string.IsNullOrEmpty(imdbId))
{
list.Add(new ExternalUrl
{
Name = "Trakt",
- Url = string.Format("https://trakt.tv/movies/{0}", imdbId)
+ Url = string.Format(CultureInfo.InvariantCulture, "https://trakt.tv/movies/{0}", imdbId)
});
}
return list;
}
-
- [JsonIgnore]
- public override bool StopRefreshIfLocalMetadataFound => false;
}
}
diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs
index 603242063..b278a0142 100644
--- a/MediaBrowser.Controller/Entities/MusicVideo.cs
+++ b/MediaBrowser.Controller/Entities/MusicVideo.cs
@@ -1,9 +1,11 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Entities
{
diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.cs
index 2fb613768..1f3758a73 100644
--- a/MediaBrowser.Controller/Entities/PeopleHelper.cs
+++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -113,6 +115,7 @@ namespace MediaBrowser.Controller.Entities
return true;
}
}
+
return false;
}
}
diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs
index 9e4f9d47e..c4fcb0267 100644
--- a/MediaBrowser.Controller/Entities/Person.cs
+++ b/MediaBrowser.Controller/Entities/Person.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
@@ -19,6 +21,7 @@ namespace MediaBrowser.Controller.Entities
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
+
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
@@ -46,7 +49,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself
+ /// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
@@ -114,11 +117,12 @@ namespace MediaBrowser.Controller.Entities
Logger.LogDebug("{0} path has changed from {1} to {2}", GetType().Name, Path, newPath);
return true;
}
+
return base.RequiresRefresh();
}
/// <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 or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
{
diff --git a/MediaBrowser.Controller/Entities/PersonInfo.cs b/MediaBrowser.Controller/Entities/PersonInfo.cs
index f3ec73b32..4ff9b0955 100644
--- a/MediaBrowser.Controller/Entities/PersonInfo.cs
+++ b/MediaBrowser.Controller/Entities/PersonInfo.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs
index 5ebc9f16a..2fc66176f 100644
--- a/MediaBrowser.Controller/Entities/Photo.cs
+++ b/MediaBrowser.Controller/Entities/Photo.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Text.Json.Serialization;
using MediaBrowser.Model.Drawing;
@@ -14,7 +16,6 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public override Folder LatestItemsIndexContainer => AlbumEntity;
-
[JsonIgnore]
public PhotoAlbum AlbumEntity
{
@@ -29,6 +30,7 @@ namespace MediaBrowser.Controller.Entities
return photoAlbum;
}
}
+
return null;
}
}
@@ -68,17 +70,27 @@ namespace MediaBrowser.Controller.Entities
}
public string CameraMake { get; set; }
+
public string CameraModel { get; set; }
+
public string Software { get; set; }
+
public double? ExposureTime { get; set; }
+
public double? FocalLength { get; set; }
+
public ImageOrientation? Orientation { get; set; }
+
public double? Aperture { get; set; }
+
public double? ShutterSpeed { get; set; }
public double? Latitude { get; set; }
+
public double? Longitude { get; set; }
+
public double? Altitude { get; set; }
+
public int? IsoSpeedRating { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/PhotoAlbum.cs b/MediaBrowser.Controller/Entities/PhotoAlbum.cs
index b86f1ac2a..a7ecb9061 100644
--- a/MediaBrowser.Controller/Entities/PhotoAlbum.cs
+++ b/MediaBrowser.Controller/Entities/PhotoAlbum.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System.Text.Json.Serialization;
namespace MediaBrowser.Controller.Entities
diff --git a/MediaBrowser.Controller/Entities/Share.cs b/MediaBrowser.Controller/Entities/Share.cs
index c17789ccc..50f1655f3 100644
--- a/MediaBrowser.Controller/Entities/Share.cs
+++ b/MediaBrowser.Controller/Entities/Share.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Controller.Entities
{
public interface IHasShares
@@ -8,6 +10,7 @@ namespace MediaBrowser.Controller.Entities
public class Share
{
public string UserId { get; set; }
+
public bool CanEdit { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/SourceType.cs b/MediaBrowser.Controller/Entities/SourceType.cs
index 927483b93..be19e1bda 100644
--- a/MediaBrowser.Controller/Entities/SourceType.cs
+++ b/MediaBrowser.Controller/Entities/SourceType.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Controller.Entities
{
public enum SourceType
diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs
index 068032317..9018ddb75 100644
--- a/MediaBrowser.Controller/Entities/Studio.cs
+++ b/MediaBrowser.Controller/Entities/Studio.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
@@ -7,7 +9,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class Studio
+ /// Class Studio.
/// </summary>
public class Studio : BaseItem, IItemByName
{
@@ -18,6 +20,7 @@ namespace MediaBrowser.Controller.Entities
list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
return list;
}
+
public override string CreatePresentationUniqueKey()
{
return GetUserDataKeys()[0];
@@ -25,7 +28,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself
+ /// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
@@ -93,11 +96,12 @@ namespace MediaBrowser.Controller.Entities
Logger.LogDebug("{0} path has changed from {1} to {2}", GetType().Name, Path, newPath);
return true;
}
+
return base.RequiresRefresh();
}
/// <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 or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
{
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index 49229fa4b..dc12fbbea 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -1,10 +1,12 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
@@ -12,7 +14,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities.TV
{
/// <summary>
- /// Class Episode
+ /// Class Episode.
/// </summary>
public class Episode : Video, IHasTrailers, IHasLookupInfo<EpisodeInfo>, IHasSeries
{
@@ -34,7 +36,9 @@ namespace MediaBrowser.Controller.Entities.TV
/// </summary>
/// <value>The aired season.</value>
public int? AirsBeforeSeasonNumber { get; set; }
+
public int? AirsAfterSeasonNumber { get; set; }
+
public int? AirsBeforeEpisodeNumber { get; set; }
/// <summary>
@@ -94,6 +98,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
take--;
}
+
list.InsertRange(0, seriesUserDataKeys.Take(take).Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000")));
}
@@ -101,7 +106,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
/// <summary>
- /// This Episode's Series Instance
+ /// This Episode's Series Instance.
/// </summary>
/// <value>The series.</value>
[JsonIgnore]
@@ -114,6 +119,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
seriesId = FindSeriesId();
}
+
return !seriesId.Equals(Guid.Empty) ? (LibraryManager.GetItemById(seriesId) as Series) : null;
}
}
@@ -128,6 +134,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
seasonId = FindSeasonId();
}
+
return !seasonId.Equals(Guid.Empty) ? (LibraryManager.GetItemById(seasonId) as Season) : null;
}
}
@@ -160,6 +167,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture);
}
+
return "Season Unknown";
}
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index 9c8a469e2..93bdd6e70 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -1,17 +1,19 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Querying;
-using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Entities.TV
{
/// <summary>
- /// Class Season
+ /// Class Season.
/// </summary>
public class Season : Folder, IHasSeries, IHasLookupInfo<SeasonInfo>
{
@@ -68,7 +70,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
/// <summary>
- /// This Episode's Series Instance
+ /// This Episode's Series Instance.
/// </summary>
/// <value>The series.</value>
[JsonIgnore]
@@ -81,6 +83,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
seriesId = FindSeriesId();
}
+
return seriesId == Guid.Empty ? null : (LibraryManager.GetItemById(seriesId) as Series);
}
}
@@ -168,7 +171,7 @@ namespace MediaBrowser.Controller.Entities.TV
return GetEpisodes(user, new DtoOptions(true));
}
- protected override bool GetBlockUnratedValue(UserPolicy config)
+ protected override bool GetBlockUnratedValue(User user)
{
// Don't block. Let either the entire series rating or episode rating determine it
return false;
@@ -203,7 +206,7 @@ namespace MediaBrowser.Controller.Entities.TV
public Guid FindSeriesId()
{
var series = FindParent<Series>();
- return series == null ? Guid.Empty : series.Id;
+ return series?.Id ?? Guid.Empty;
}
/// <summary>
@@ -225,7 +228,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
/// <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 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)
@@ -234,7 +237,7 @@ namespace MediaBrowser.Controller.Entities.TV
if (!IndexNumber.HasValue && !string.IsNullOrEmpty(Path))
{
- IndexNumber = IndexNumber ?? LibraryManager.GetSeasonNumberFromPath(Path);
+ IndexNumber ??= LibraryManager.GetSeasonNumberFromPath(Path);
// If a change was made record it
if (IndexNumber.HasValue)
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 2475b2b7e..75a746bfb 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -5,18 +7,19 @@ using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Querying;
-using MediaBrowser.Model.Users;
+using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
namespace MediaBrowser.Controller.Entities.TV
{
/// <summary>
- /// Class Series
+ /// Class Series.
/// </summary>
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer
{
@@ -29,6 +32,7 @@ namespace MediaBrowser.Controller.Entities.TV
}
public DayOfWeek[] AirDays { get; set; }
+
public string AirTime { get; set; }
[JsonIgnore]
@@ -53,7 +57,7 @@ namespace MediaBrowser.Controller.Entities.TV
public IReadOnlyList<Guid> RemoteTrailerIds { get; set; }
/// <summary>
- /// airdate, dvd or absolute
+ /// airdate, dvd or absolute.
/// </summary>
public string DisplayOrder { get; set; }
@@ -119,7 +123,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
AncestorWithPresentationUniqueKey = null,
SeriesPresentationUniqueKey = seriesKey,
- IncludeItemTypes = new[] { typeof(Season).Name },
+ IncludeItemTypes = new[] { nameof(Season) },
IsVirtualItem = false,
Limit = 0,
DtoOptions = new DtoOptions(false)
@@ -149,6 +153,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
query.IncludeItemTypes = new[] { typeof(Episode).Name };
}
+
query.IsVirtualItem = false;
query.Limit = 0;
var totalRecordCount = LibraryManager.GetCount(query);
@@ -164,13 +169,13 @@ namespace MediaBrowser.Controller.Entities.TV
{
var list = base.GetUserDataKeys();
- var key = this.GetProviderId(MetadataProviders.Imdb);
+ var key = this.GetProviderId(MetadataProvider.Imdb);
if (!string.IsNullOrEmpty(key))
{
list.Insert(0, key);
}
- key = this.GetProviderId(MetadataProviders.Tvdb);
+ key = this.GetProviderId(MetadataProvider.Tvdb);
if (!string.IsNullOrEmpty(key))
{
list.Insert(0, key);
@@ -205,14 +210,9 @@ namespace MediaBrowser.Controller.Entities.TV
query.IncludeItemTypes = new[] { typeof(Season).Name };
query.OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray();
- if (user != null)
+ if (user != null && !user.DisplayMissingEpisodes)
{
- var config = user.Configuration;
-
- if (!config.DisplayMissingEpisodes)
- {
- query.IsMissing = false;
- }
+ query.IsMissing = false;
}
}
@@ -257,8 +257,8 @@ namespace MediaBrowser.Controller.Entities.TV
OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
DtoOptions = options
};
- var config = user.Configuration;
- if (!config.DisplayMissingEpisodes)
+
+ if (!user.DisplayMissingEpisodes)
{
query.IsMissing = false;
}
@@ -311,7 +311,7 @@ namespace MediaBrowser.Controller.Entities.TV
// Refresh episodes and other children
foreach (var item in items)
{
- if ((item is Season))
+ if (item is Season)
{
continue;
}
@@ -370,8 +370,7 @@ namespace MediaBrowser.Controller.Entities.TV
};
if (user != null)
{
- var config = user.Configuration;
- if (!config.DisplayMissingEpisodes)
+ if (!user.DisplayMissingEpisodes)
{
query.IsMissing = false;
}
@@ -451,10 +450,9 @@ namespace MediaBrowser.Controller.Entities.TV
});
}
-
- protected override bool GetBlockUnratedValue(UserPolicy config)
+ protected override bool GetBlockUnratedValue(User user)
{
- return config.BlockUnratedItems.Contains(UnratedItem.Series);
+ return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Series.ToString());
}
public override UnratedItem GetBlockUnratedType()
@@ -493,13 +491,13 @@ namespace MediaBrowser.Controller.Entities.TV
{
var list = base.GetRelatedUrls();
- var imdbId = this.GetProviderId(MetadataProviders.Imdb);
+ var imdbId = this.GetProviderId(MetadataProvider.Imdb);
if (!string.IsNullOrEmpty(imdbId))
{
list.Add(new ExternalUrl
{
Name = "Trakt",
- Url = string.Format("https://trakt.tv/shows/{0}", imdbId)
+ Url = string.Format(CultureInfo.InvariantCulture, "https://trakt.tv/shows/{0}", imdbId)
});
}
diff --git a/MediaBrowser.Controller/Entities/TagExtensions.cs b/MediaBrowser.Controller/Entities/TagExtensions.cs
index 97f590635..2ce396daf 100644
--- a/MediaBrowser.Controller/Entities/TagExtensions.cs
+++ b/MediaBrowser.Controller/Entities/TagExtensions.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Linq;
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index 0b8be90cd..9ae8ad708 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -1,15 +1,18 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class Trailer
+ /// Class Trailer.
/// </summary>
public class Trailer : Video, IHasLookupInfo<TrailerInfo>
{
@@ -80,13 +83,13 @@ namespace MediaBrowser.Controller.Entities
{
var list = base.GetRelatedUrls();
- var imdbId = this.GetProviderId(MetadataProviders.Imdb);
+ var imdbId = this.GetProviderId(MetadataProvider.Imdb);
if (!string.IsNullOrEmpty(imdbId))
{
list.Add(new ExternalUrl
{
Name = "Trakt",
- Url = string.Format("https://trakt.tv/movies/{0}", imdbId)
+ Url = string.Format(CultureInfo.InvariantCulture, "https://trakt.tv/movies/{0}", imdbId)
});
}
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
deleted file mode 100644
index 53601a610..000000000
--- a/MediaBrowser.Controller/Entities/User.cs
+++ /dev/null
@@ -1,262 +0,0 @@
-using System;
-using System.Globalization;
-using System.IO;
-using System.Text.Json.Serialization;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Configuration;
-using MediaBrowser.Model.Users;
-
-namespace MediaBrowser.Controller.Entities
-{
- /// <summary>
- /// Class User
- /// </summary>
- public class User : BaseItem
- {
- public static IUserManager UserManager { get; set; }
-
- /// <summary>
- /// Gets or sets the password.
- /// </summary>
- /// <value>The password.</value>
- public string Password { get; set; }
- public string EasyPassword { get; set; }
-
- // Strictly to remove JsonIgnore
- public override ItemImageInfo[] ImageInfos
- {
- get => base.ImageInfos;
- set => base.ImageInfos = value;
- }
-
- /// <summary>
- /// Gets or sets the path.
- /// </summary>
- /// <value>The path.</value>
- [JsonIgnore]
- public override string Path
- {
- get => ConfigurationDirectoryPath;
- set => base.Path = value;
- }
-
- private string _name;
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- /// <value>The name.</value>
- public override string Name
- {
- get => _name;
- set
- {
- _name = value;
-
- // lazy load this again
- SortName = null;
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Gets the root folder.
- /// </summary>
- /// <value>The root folder.</value>
- [JsonIgnore]
- public Folder RootFolder => LibraryManager.GetUserRootFolder();
-
- /// <summary>
- /// Gets or sets the last login date.
- /// </summary>
- /// <value>The last login date.</value>
- public DateTime? LastLoginDate { get; set; }
- /// <summary>
- /// Gets or sets the last activity date.
- /// </summary>
- /// <value>The last activity date.</value>
- public DateTime? LastActivityDate { get; set; }
-
- private volatile UserConfiguration _config;
- private readonly object _configSyncLock = new object();
- [JsonIgnore]
- public UserConfiguration Configuration
- {
- get
- {
- if (_config == null)
- {
- lock (_configSyncLock)
- {
- if (_config == null)
- {
- _config = UserManager.GetUserConfiguration(this);
- }
- }
- }
-
- return _config;
- }
- set => _config = value;
- }
-
- private volatile UserPolicy _policy;
- private readonly object _policySyncLock = new object();
- [JsonIgnore]
- public UserPolicy Policy
- {
- get
- {
- if (_policy == null)
- {
- lock (_policySyncLock)
- {
- if (_policy == null)
- {
- _policy = UserManager.GetUserPolicy(this);
- }
- }
- }
-
- return _policy;
- }
- set => _policy = value;
- }
-
- /// <summary>
- /// Renames the user.
- /// </summary>
- /// <param name="newName">The new name.</param>
- /// <returns>Task.</returns>
- /// <exception cref="ArgumentNullException"></exception>
- public Task Rename(string newName)
- {
- if (string.IsNullOrWhiteSpace(newName))
- {
- throw new ArgumentException("Username can't be empty", nameof(newName));
- }
-
- Name = newName;
-
- return RefreshMetadata(
- new MetadataRefreshOptions(new DirectoryService(FileSystem))
- {
- ReplaceAllMetadata = true,
- ImageRefreshMode = MetadataRefreshMode.FullRefresh,
- MetadataRefreshMode = MetadataRefreshMode.FullRefresh,
- ForceSave = true
-
- },
- CancellationToken.None);
- }
-
- public override void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
- {
- UserManager.UpdateUser(this);
- }
-
- /// <summary>
- /// Gets the path to the user's configuration directory
- /// </summary>
- /// <value>The configuration directory path.</value>
- [JsonIgnore]
- public string ConfigurationDirectoryPath => GetConfigurationDirectoryPath(Name);
-
- public override double GetDefaultPrimaryImageAspectRatio()
- {
- return 1;
- }
-
- /// <summary>
- /// Gets the configuration directory path.
- /// </summary>
- /// <param name="username">The username.</param>
- /// <returns>System.String.</returns>
- private string GetConfigurationDirectoryPath(string username)
- {
- var parentPath = ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath;
-
- // TODO: Remove idPath and just use usernamePath for future releases
- var usernamePath = System.IO.Path.Combine(parentPath, username);
- var idPath = System.IO.Path.Combine(parentPath, Id.ToString("N", CultureInfo.InvariantCulture));
- if (!Directory.Exists(usernamePath) && Directory.Exists(idPath))
- {
- Directory.Move(idPath, usernamePath);
- }
-
- return usernamePath;
- }
-
- public bool IsParentalScheduleAllowed()
- {
- return IsParentalScheduleAllowed(DateTime.UtcNow);
- }
-
- public bool IsParentalScheduleAllowed(DateTime date)
- {
- var schedules = Policy.AccessSchedules;
-
- if (schedules.Length == 0)
- {
- return true;
- }
-
- foreach (var i in schedules)
- {
- if (IsParentalScheduleAllowed(i, date))
- {
- return true;
- }
- }
- return false;
- }
-
- private bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date)
- {
- if (date.Kind != DateTimeKind.Utc)
- {
- throw new ArgumentException("Utc date expected");
- }
-
- var localTime = date.ToLocalTime();
-
- return DayOfWeekHelper.GetDaysOfWeek(schedule.DayOfWeek).Contains(localTime.DayOfWeek) &&
- IsWithinTime(schedule, localTime);
- }
-
- private bool IsWithinTime(AccessSchedule schedule, DateTime localTime)
- {
- var hour = localTime.TimeOfDay.TotalHours;
-
- return hour >= schedule.StartHour && hour <= schedule.EndHour;
- }
-
- public bool IsFolderGrouped(Guid id)
- {
- foreach (var i in Configuration.GroupedFolders)
- {
- if (new Guid(i) == id)
- {
- return true;
- }
- }
- return false;
- }
-
- [JsonIgnore]
- public override bool SupportsPeople => false;
-
- public long InternalId { get; set; }
-
-
- }
-}
diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs
index ab425ee0f..db63c42e4 100644
--- a/MediaBrowser.Controller/Entities/UserItemData.cs
+++ b/MediaBrowser.Controller/Entities/UserItemData.cs
@@ -1,10 +1,12 @@
+#pragma warning disable CS1591
+
using System;
using System.Text.Json.Serialization;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class UserItemData
+ /// Class UserItemData.
/// </summary>
public class UserItemData
{
@@ -21,11 +23,12 @@ namespace MediaBrowser.Controller.Entities
public string Key { get; set; }
/// <summary>
- /// The _rating
+ /// The _rating.
/// </summary>
private double? _rating;
+
/// <summary>
- /// Gets or sets the users 0-10 rating
+ /// Gets or sets the users 0-10 rating.
/// </summary>
/// <value>The rating.</value>
/// <exception cref="ArgumentOutOfRangeException">Rating;A 0 to 10 rating is required for UserItemData.</exception>
@@ -75,11 +78,13 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value><c>true</c> if played; otherwise, <c>false</c>.</value>
public bool Played { get; set; }
+
/// <summary>
/// Gets or sets the index of the audio stream.
/// </summary>
/// <value>The index of the audio stream.</value>
public int? AudioStreamIndex { get; set; }
+
/// <summary>
/// Gets or sets the index of the subtitle stream.
/// </summary>
@@ -105,6 +110,7 @@ namespace MediaBrowser.Controller.Entities
return null;
}
+
set
{
if (value.HasValue)
diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs
index 8a68f830c..7f7224ae0 100644
--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs
+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs
@@ -1,9 +1,12 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs
index 4ce9ec6f8..b1da4d64c 100644
--- a/MediaBrowser.Controller/Entities/UserView.cs
+++ b/MediaBrowser.Controller/Entities/UserView.cs
@@ -1,8 +1,11 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Querying;
@@ -110,7 +113,7 @@ namespace MediaBrowser.Controller.Entities
private static string[] UserSpecificViewTypes = new string[]
{
- MediaBrowser.Model.Entities.CollectionType.Playlists
+ Model.Entities.CollectionType.Playlists
};
public static bool IsUserSpecific(Folder folder)
@@ -139,8 +142,8 @@ namespace MediaBrowser.Controller.Entities
private static string[] ViewTypesEligibleForGrouping = new string[]
{
- MediaBrowser.Model.Entities.CollectionType.Movies,
- MediaBrowser.Model.Entities.CollectionType.TvShows,
+ Model.Entities.CollectionType.Movies,
+ Model.Entities.CollectionType.TvShows,
string.Empty
};
@@ -151,12 +154,12 @@ namespace MediaBrowser.Controller.Entities
private static string[] OriginalFolderViewTypes = new string[]
{
- MediaBrowser.Model.Entities.CollectionType.Books,
- MediaBrowser.Model.Entities.CollectionType.MusicVideos,
- MediaBrowser.Model.Entities.CollectionType.HomeVideos,
- MediaBrowser.Model.Entities.CollectionType.Photos,
- MediaBrowser.Model.Entities.CollectionType.Music,
- MediaBrowser.Model.Entities.CollectionType.BoxSets
+ Model.Entities.CollectionType.Books,
+ Model.Entities.CollectionType.MusicVideos,
+ Model.Entities.CollectionType.HomeVideos,
+ Model.Entities.CollectionType.Photos,
+ Model.Entities.CollectionType.Music,
+ Model.Entities.CollectionType.BoxSets
};
public static bool EnableOriginalFolder(string viewType)
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index 435a1e8da..7bb311900 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -1,15 +1,23 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
+using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.Movies;
-using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
+using Episode = MediaBrowser.Controller.Entities.TV.Episode;
+using MetadataProvider = MediaBrowser.Model.Entities.MetadataProvider;
+using Movie = MediaBrowser.Controller.Entities.Movies.Movie;
+using Season = MediaBrowser.Controller.Entities.TV.Season;
+using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace MediaBrowser.Controller.Entities
{
@@ -17,7 +25,7 @@ namespace MediaBrowser.Controller.Entities
{
private readonly IUserViewManager _userViewManager;
private readonly ILibraryManager _libraryManager;
- private readonly ILogger _logger;
+ private readonly ILogger<BaseItem> _logger;
private readonly IUserDataManager _userDataManager;
private readonly ITVSeriesManager _tvSeriesManager;
private readonly IServerConfigurationManager _config;
@@ -25,7 +33,7 @@ namespace MediaBrowser.Controller.Entities
public UserViewBuilder(
IUserViewManager userViewManager,
ILibraryManager libraryManager,
- ILogger logger,
+ ILogger<BaseItem> logger,
IUserDataManager userDataManager,
ITVSeriesManager tvSeriesManager,
IServerConfigurationManager config)
@@ -42,7 +50,7 @@ namespace MediaBrowser.Controller.Entities
{
var user = query.User;
- //if (query.IncludeItemTypes != null &&
+ // if (query.IncludeItemTypes != null &&
// query.IncludeItemTypes.Length == 1 &&
// string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))
//{
@@ -140,14 +148,15 @@ namespace MediaBrowser.Controller.Entities
return parent.QueryRecursive(query);
}
- var list = new List<BaseItem>();
-
- list.Add(GetUserView(SpecialFolder.MovieResume, "HeaderContinueWatching", "0", parent));
- list.Add(GetUserView(SpecialFolder.MovieLatest, "Latest", "1", parent));
- list.Add(GetUserView(SpecialFolder.MovieMovies, "Movies", "2", parent));
- list.Add(GetUserView(SpecialFolder.MovieCollections, "Collections", "3", parent));
- list.Add(GetUserView(SpecialFolder.MovieFavorites, "Favorites", "4", parent));
- list.Add(GetUserView(SpecialFolder.MovieGenres, "Genres", "5", parent));
+ var list = new List<BaseItem>
+ {
+ GetUserView(SpecialFolder.MovieResume, "HeaderContinueWatching", "0", parent),
+ GetUserView(SpecialFolder.MovieLatest, "Latest", "1", parent),
+ GetUserView(SpecialFolder.MovieMovies, "Movies", "2", parent),
+ GetUserView(SpecialFolder.MovieCollections, "Collections", "3", parent),
+ GetUserView(SpecialFolder.MovieFavorites, "Favorites", "4", parent),
+ GetUserView(SpecialFolder.MovieGenres, "Genres", "5", parent)
+ };
return GetResult(list, parent, query);
}
@@ -249,7 +258,6 @@ namespace MediaBrowser.Controller.Entities
IncludeItemTypes = new[] { typeof(Movie).Name },
Recursive = true,
EnableTotalRecordCount = false
-
}).Items
.SelectMany(i => i.Genres)
.DistinctNames()
@@ -264,7 +272,6 @@ namespace MediaBrowser.Controller.Entities
_logger.LogError(ex, "Error getting genre");
return null;
}
-
})
.Where(i => i != null)
.Select(i => GetUserViewWithName(i.Name, SpecialFolder.MovieGenre, i.SortName, parent));
@@ -293,21 +300,27 @@ namespace MediaBrowser.Controller.Entities
if (query.IncludeItemTypes.Length == 0)
{
- query.IncludeItemTypes = new[] { typeof(Series).Name, typeof(Season).Name, typeof(Episode).Name };
+ query.IncludeItemTypes = new[]
+ {
+ nameof(Series),
+ nameof(Season),
+ nameof(Episode)
+ };
}
return parent.QueryRecursive(query);
}
- var list = new List<BaseItem>();
-
- list.Add(GetUserView(SpecialFolder.TvResume, "HeaderContinueWatching", "0", parent));
- list.Add(GetUserView(SpecialFolder.TvNextUp, "HeaderNextUp", "1", parent));
- list.Add(GetUserView(SpecialFolder.TvLatest, "Latest", "2", parent));
- list.Add(GetUserView(SpecialFolder.TvShowSeries, "Shows", "3", parent));
- list.Add(GetUserView(SpecialFolder.TvFavoriteSeries, "HeaderFavoriteShows", "4", parent));
- list.Add(GetUserView(SpecialFolder.TvFavoriteEpisodes, "HeaderFavoriteEpisodes", "5", parent));
- list.Add(GetUserView(SpecialFolder.TvGenres, "Genres", "6", parent));
+ var list = new List<BaseItem>
+ {
+ GetUserView(SpecialFolder.TvResume, "HeaderContinueWatching", "0", parent),
+ GetUserView(SpecialFolder.TvNextUp, "HeaderNextUp", "1", parent),
+ GetUserView(SpecialFolder.TvLatest, "Latest", "2", parent),
+ GetUserView(SpecialFolder.TvShowSeries, "Shows", "3", parent),
+ GetUserView(SpecialFolder.TvFavoriteSeries, "HeaderFavoriteShows", "4", parent),
+ GetUserView(SpecialFolder.TvFavoriteEpisodes, "HeaderFavoriteEpisodes", "5", parent),
+ GetUserView(SpecialFolder.TvGenres, "Genres", "6", parent)
+ };
return GetResult(list, parent, query);
}
@@ -330,12 +343,12 @@ namespace MediaBrowser.Controller.Entities
{
var parentFolders = GetMediaFolders(parent, query.User, new[] { CollectionType.TvShows, string.Empty });
- var result = _tvSeriesManager.GetNextUp(new NextUpQuery
+ var result = _tvSeriesManager.GetNextUp(
+ new NextUpQuery
{
Limit = query.Limit,
StartIndex = query.StartIndex,
UserId = query.User.Id
-
}, parentFolders, query.DtoOptions);
return result;
@@ -372,7 +385,6 @@ namespace MediaBrowser.Controller.Entities
IncludeItemTypes = new[] { typeof(Series).Name },
Recursive = true,
EnableTotalRecordCount = false
-
}).Items
.SelectMany(i => i.Genres)
.DistinctNames()
@@ -387,7 +399,6 @@ namespace MediaBrowser.Controller.Entities
_logger.LogError(ex, "Error getting genre");
return null;
}
-
})
.Where(i => i != null)
.Select(i => GetUserViewWithName(i.Name, SpecialFolder.TvGenre, i.SortName, parent));
@@ -412,12 +423,13 @@ namespace MediaBrowser.Controller.Entities
{
return new QueryResult<BaseItem>
{
- Items = result.Items, //TODO Fix The co-variant conversion between T[] and BaseItem[], this can generate runtime issues if T is not BaseItem.
+ Items = result.Items, // TODO Fix The co-variant conversion between T[] and BaseItem[], this can generate runtime issues if T is not BaseItem.
TotalRecordCount = result.TotalRecordCount
};
}
- private QueryResult<BaseItem> GetResult<T>(IEnumerable<T> items,
+ private QueryResult<BaseItem> GetResult<T>(
+ IEnumerable<T> items,
BaseItem queryParent,
InternalItemsQuery query)
where T : BaseItem
@@ -432,7 +444,8 @@ namespace MediaBrowser.Controller.Entities
return Filter(item, query.User, query, BaseItem.UserDataManager, BaseItem.LibraryManager);
}
- public static QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items,
+ public static QueryResult<BaseItem> PostFilterAndSort(
+ IEnumerable<BaseItem> items,
BaseItem queryParent,
int? totalRecordLimit,
InternalItemsQuery query,
@@ -611,7 +624,7 @@ namespace MediaBrowser.Controller.Entities
{
var filterValue = query.HasImdbId.Value;
- var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Imdb));
+ var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProvider.Imdb));
if (hasValue != filterValue)
{
@@ -623,7 +636,7 @@ namespace MediaBrowser.Controller.Entities
{
var filterValue = query.HasTmdbId.Value;
- var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Tmdb));
+ var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProvider.Tmdb));
if (hasValue != filterValue)
{
@@ -635,7 +648,7 @@ namespace MediaBrowser.Controller.Entities
{
var filterValue = query.HasTvdbId.Value;
- var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Tvdb));
+ var hasValue = !string.IsNullOrEmpty(item.GetProviderId(MetadataProvider.Tvdb));
if (hasValue != filterValue)
{
@@ -661,9 +674,7 @@ namespace MediaBrowser.Controller.Entities
var isPlaceHolder = false;
- var hasPlaceHolder = item as ISupportsPlaceHolders;
-
- if (hasPlaceHolder != null)
+ if (item is ISupportsPlaceHolders hasPlaceHolder)
{
isPlaceHolder = hasPlaceHolder.IsPlaceHolder;
}
@@ -678,13 +689,11 @@ namespace MediaBrowser.Controller.Entities
{
var filterValue = query.HasSpecialFeature.Value;
- var movie = item as IHasSpecialFeatures;
-
- if (movie != null)
+ if (item is IHasSpecialFeatures movie)
{
var ok = filterValue
- ? movie.SpecialFeatureIds.Length > 0
- : movie.SpecialFeatureIds.Length == 0;
+ ? movie.SpecialFeatureIds.Count > 0
+ : movie.SpecialFeatureIds.Count == 0;
if (!ok)
{
@@ -951,6 +960,7 @@ namespace MediaBrowser.Controller.Entities
.OfType<Folder>()
.Where(UserView.IsEligibleForGrouping);
}
+
return _libraryManager.GetUserRootFolder()
.GetChildren(user, true)
.OfType<Folder>()
@@ -969,6 +979,7 @@ namespace MediaBrowser.Controller.Entities
return folder != null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
}).ToArray();
}
+
return GetMediaFolders(user)
.Where(i =>
{
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index c3ea7f347..07f381881 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -17,7 +19,7 @@ using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class Video
+ /// Class Video.
/// </summary>
public class Video : BaseItem,
IHasAspectRatio,
@@ -28,7 +30,9 @@ namespace MediaBrowser.Controller.Entities
public string PrimaryVersionId { get; set; }
public string[] AdditionalParts { get; set; }
+
public string[] LocalAlternateVersions { get; set; }
+
public LinkedChild[] LinkedAlternateVersions { get; set; }
[JsonIgnore]
@@ -52,15 +56,18 @@ namespace MediaBrowser.Controller.Entities
{
return false;
}
+
if (extraType.Value == Model.Entities.ExtraType.ThemeVideo)
{
return false;
}
+
if (extraType.Value == Model.Entities.ExtraType.Trailer)
{
return false;
}
}
+
return true;
}
}
@@ -196,6 +203,7 @@ namespace MediaBrowser.Controller.Entities
return video.MediaSourceCount;
}
}
+
return LinkedAlternateVersions.Length + LocalAlternateVersions.Length + 1;
}
}
@@ -272,13 +280,13 @@ namespace MediaBrowser.Controller.Entities
{
if (ExtraType.HasValue)
{
- var key = this.GetProviderId(MetadataProviders.Tmdb);
+ var key = this.GetProviderId(MetadataProvider.Tmdb);
if (!string.IsNullOrEmpty(key))
{
list.Insert(0, GetUserDataKey(key));
}
- key = this.GetProviderId(MetadataProviders.Imdb);
+ key = this.GetProviderId(MetadataProvider.Imdb);
if (!string.IsNullOrEmpty(key))
{
list.Insert(0, GetUserDataKey(key));
@@ -286,13 +294,13 @@ namespace MediaBrowser.Controller.Entities
}
else
{
- var key = this.GetProviderId(MetadataProviders.Imdb);
+ var key = this.GetProviderId(MetadataProvider.Imdb);
if (!string.IsNullOrEmpty(key))
{
list.Insert(0, key);
}
- key = this.GetProviderId(MetadataProviders.Tmdb);
+ key = this.GetProviderId(MetadataProvider.Tmdb);
if (!string.IsNullOrEmpty(key))
{
list.Insert(0, key);
@@ -390,11 +398,13 @@ namespace MediaBrowser.Controller.Entities
AdditionalParts = newVideo.AdditionalParts;
updateType |= ItemUpdateType.MetadataImport;
}
+
if (!LocalAlternateVersions.SequenceEqual(newVideo.LocalAlternateVersions, StringComparer.Ordinal))
{
LocalAlternateVersions = newVideo.LocalAlternateVersions;
updateType |= ItemUpdateType.MetadataImport;
}
+
if (VideoType != newVideo.VideoType)
{
VideoType = newVideo.VideoType;
@@ -416,6 +426,7 @@ namespace MediaBrowser.Controller.Entities
.Select(i => i.FullName)
.ToArray();
}
+
if (videoType == VideoType.BluRay)
{
return FileSystem.GetFiles(rootPath, new[] { ".m2ts" }, false, true)
@@ -425,6 +436,7 @@ namespace MediaBrowser.Controller.Entities
.Select(i => i.FullName)
.ToArray();
}
+
return Array.Empty<string>();
}
@@ -485,9 +497,10 @@ namespace MediaBrowser.Controller.Entities
}
}
- public override void UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
+ /// <inheritdoc />
+ public override async Task UpdateToRepositoryAsync(ItemUpdateType updateReason, CancellationToken cancellationToken)
{
- base.UpdateToRepository(updateReason, cancellationToken);
+ await base.UpdateToRepositoryAsync(updateReason, cancellationToken).ConfigureAwait(false);
var localAlternates = GetLocalAlternateVersionIds()
.Select(i => LibraryManager.GetItemById(i))
@@ -504,7 +517,7 @@ namespace MediaBrowser.Controller.Entities
item.Genres = Genres;
item.ProviderIds = ProviderIds;
- item.UpdateToRepository(ItemUpdateType.MetadataDownload, cancellationToken);
+ await item.UpdateToRepositoryAsync(ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false);
}
}
@@ -535,7 +548,6 @@ namespace MediaBrowser.Controller.Entities
{
ItemId = Id,
Index = DefaultVideoStreamIndex.Value
-
}).FirstOrDefault();
}
diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs
index a01ef5c31..b2e4d307a 100644
--- a/MediaBrowser.Controller/Entities/Year.cs
+++ b/MediaBrowser.Controller/Entities/Year.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -7,7 +9,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
- /// Class Year
+ /// Class Year.
/// </summary>
public class Year : BaseItem, IItemByName
{
@@ -21,7 +23,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Returns the folder containing the item.
- /// If the item is a folder, it returns the folder itself
+ /// If the item is a folder, it returns the folder itself.
/// </summary>
/// <value>The containing folder path.</value>
[JsonIgnore]
@@ -103,11 +105,12 @@ namespace MediaBrowser.Controller.Entities
Logger.LogDebug("{0} path has changed from {1} to {2}", GetType().Name, Path, newPath);
return true;
}
+
return base.RequiresRefresh();
}
/// <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 or false indicating if changes were made.
/// </summary>
public override bool BeforeMetadataRefresh(bool replaceAllMetdata)
{