aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs6
-rw-r--r--MediaBrowser.Controller/Chapters/IChapterManager.cs7
-rw-r--r--MediaBrowser.Controller/Collections/CollectionCreationOptions.cs4
-rw-r--r--MediaBrowser.Controller/Connect/IConnectManager.cs45
-rw-r--r--MediaBrowser.Controller/Dto/IDtoService.cs1
-rw-r--r--MediaBrowser.Controller/Entities/AggregateFolder.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs9
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs4
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicArtist.cs3
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs40
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs14
-rw-r--r--MediaBrowser.Controller/Entities/Game.cs12
-rw-r--r--MediaBrowser.Controller/Entities/InternalItemsQuery.cs66
-rw-r--r--MediaBrowser.Controller/Entities/InternalPeopleQuery.cs4
-rw-r--r--MediaBrowser.Controller/Entities/Movies/BoxSet.cs19
-rw-r--r--MediaBrowser.Controller/Entities/Movies/Movie.cs9
-rw-r--r--MediaBrowser.Controller/Entities/MusicVideo.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Photo.cs5
-rw-r--r--MediaBrowser.Controller/Entities/TV/Episode.cs12
-rw-r--r--MediaBrowser.Controller/Entities/TV/Season.cs7
-rw-r--r--MediaBrowser.Controller/Entities/TV/Series.cs8
-rw-r--r--MediaBrowser.Controller/Entities/Trailer.cs9
-rw-r--r--MediaBrowser.Controller/Entities/UserView.cs19
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs28
-rw-r--r--MediaBrowser.Controller/Library/IUserDataManager.cs1
-rw-r--r--MediaBrowser.Controller/Library/ItemResolveArgs.cs8
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvProgram.cs43
-rw-r--r--MediaBrowser.Controller/LiveTv/TimerInfo.cs4
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs33
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs10
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs1
-rw-r--r--MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs2
-rw-r--r--MediaBrowser.Controller/Net/AuthorizationInfo.cs8
-rw-r--r--MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs2
-rw-r--r--MediaBrowser.Controller/Playlists/IPlaylistManager.cs1
-rw-r--r--MediaBrowser.Controller/Playlists/Playlist.cs29
-rw-r--r--MediaBrowser.Controller/Providers/AlbumInfo.cs4
-rw-r--r--MediaBrowser.Controller/Providers/ImageRefreshOptions.cs4
-rw-r--r--MediaBrowser.Controller/Providers/ItemLookupInfo.cs2
-rw-r--r--MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs4
-rw-r--r--MediaBrowser.Controller/Providers/MetadataResult.cs2
-rw-r--r--MediaBrowser.Controller/Providers/SongInfo.cs7
-rw-r--r--MediaBrowser.Controller/Session/AuthenticationRequest.cs2
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs1
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs8
-rw-r--r--MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs6
46 files changed, 167 insertions, 350 deletions
diff --git a/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs
index becb3ea62..82308296f 100644
--- a/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs
+++ b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Users;
diff --git a/MediaBrowser.Controller/Chapters/IChapterManager.cs b/MediaBrowser.Controller/Chapters/IChapterManager.cs
index 2a20eb365..161e87094 100644
--- a/MediaBrowser.Controller/Chapters/IChapterManager.cs
+++ b/MediaBrowser.Controller/Chapters/IChapterManager.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Threading.Tasks;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Chapters
@@ -10,12 +9,6 @@ namespace MediaBrowser.Controller.Chapters
public interface IChapterManager
{
/// <summary>
- /// Gets the chapters.
- /// </summary>
- /// <param name="itemId">The item identifier.</param>
- /// <returns>List{ChapterInfo}.</returns>
-
- /// <summary>
/// Saves the chapters.
/// </summary>
void SaveChapters(string itemId, List<ChapterInfo> chapters);
diff --git a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs
index 727b487a7..5363e035c 100644
--- a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs
+++ b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs
@@ -20,8 +20,8 @@ namespace MediaBrowser.Controller.Collections
public CollectionCreationOptions()
{
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- ItemIdList = new string[] {};
- UserIds = new Guid[] {};
+ ItemIdList = Array.Empty<string>();
+ UserIds = Array.Empty<Guid>();
}
}
}
diff --git a/MediaBrowser.Controller/Connect/IConnectManager.cs b/MediaBrowser.Controller/Connect/IConnectManager.cs
deleted file mode 100644
index 8ac61bf2b..000000000
--- a/MediaBrowser.Controller/Connect/IConnectManager.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Model.Connect;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Controller.Connect
-{
- public interface IConnectManager
- {
- /// <summary>
- /// Gets the wan API address.
- /// </summary>
- /// <value>The wan API address.</value>
- string WanApiAddress { get; }
-
- /// <summary>
- /// Links the user.
- /// </summary>
- /// <param name="userId">The user identifier.</param>
- /// <param name="connectUsername">The connect username.</param>
- /// <returns>Task.</returns>
- Task<UserLinkResult> LinkUser(string userId, string connectUsername);
-
- /// <summary>
- /// Removes the link.
- /// </summary>
- /// <param name="userId">The user identifier.</param>
- /// <returns>Task.</returns>
- Task RemoveConnect(string userId);
-
- User GetUserFromExchangeToken(string token);
-
- /// <summary>
- /// Authenticates the specified username.
- /// </summary>
- Task<ConnectAuthenticationResult> Authenticate(string username, string password, string passwordMd5);
-
- /// <summary>
- /// Determines whether [is authorization token valid] [the specified token].
- /// </summary>
- /// <param name="token">The token.</param>
- /// <returns><c>true</c> if [is authorization token valid] [the specified token]; otherwise, <c>false</c>.</returns>
- bool IsAuthorizationTokenValid(string token);
- }
-}
diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs
index 219b36789..37e83e45a 100644
--- a/MediaBrowser.Controller/Dto/IDtoService.cs
+++ b/MediaBrowser.Controller/Dto/IDtoService.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using System.Collections.Generic;
-using MediaBrowser.Controller.Sync;
namespace MediaBrowser.Controller.Dto
{
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs
index 4f4b3483c..a4601c270 100644
--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs
+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs
@@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Entities
{
public AggregateFolder()
{
- PhysicalLocationsList = new string[] { };
+ PhysicalLocationsList = Array.Empty<string>();
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index d07e31d8a..1aeae6052 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -2,13 +2,8 @@
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Threading;
-using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Serialization;
@@ -36,8 +31,8 @@ namespace MediaBrowser.Controller.Entities.Audio
public Audio()
{
- Artists = new string[] {};
- AlbumArtists = new string[] {};
+ Artists = Array.Empty<string>();
+ AlbumArtists = Array.Empty<string>();
}
public override double GetDefaultPrimaryImageAspectRatio()
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
index 48b5c64b2..870e6e07e 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
@@ -23,8 +23,8 @@ namespace MediaBrowser.Controller.Entities.Audio
public MusicAlbum()
{
- Artists = new string[] {};
- AlbumArtists = new string[] {};
+ Artists = Array.Empty<string>();
+ AlbumArtists = Array.Empty<string>();
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
index 2774dc944..56ed10ced 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
@@ -129,13 +129,12 @@ namespace MediaBrowser.Controller.Entities.Audio
return base.IsSaveLocalMetadataEnabled();
}
- private readonly Task _cachedTask = Task.FromResult(true);
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
if (IsAccessedByName)
{
// Should never get in here anyway
- return _cachedTask;
+ return Task.CompletedTask;
}
return base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService);
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index e80fe3387..a268e6d76 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -35,24 +35,24 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public abstract class BaseItem : IHasProviderIds, IHasLookupInfo<ItemLookupInfo>
{
- protected static MetadataFields[] EmptyMetadataFieldsArray = new MetadataFields[] { };
- protected static MediaUrl[] EmptyMediaUrlArray = new MediaUrl[] { };
- protected static ItemImageInfo[] EmptyItemImageInfoArray = new ItemImageInfo[] { };
- public static readonly LinkedChild[] EmptyLinkedChildArray = new LinkedChild[] { };
+ protected static MetadataFields[] EmptyMetadataFieldsArray = Array.Empty<MetadataFields>();
+ protected static MediaUrl[] EmptyMediaUrlArray = Array.Empty<MediaUrl>();
+ protected static ItemImageInfo[] EmptyItemImageInfoArray = Array.Empty<ItemImageInfo>();
+ public static readonly LinkedChild[] EmptyLinkedChildArray = Array.Empty<LinkedChild>();
protected BaseItem()
{
- ThemeSongIds = new Guid[] {};
- ThemeVideoIds = new Guid[] {};
- Tags = new string[] {};
- Genres = new string[] {};
- Studios = new string[] {};
+ 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 = EmptyMetadataFieldsArray;
ImageInfos = EmptyItemImageInfoArray;
- ProductionLocations = new string[] {};
- RemoteTrailers = new MediaUrl[] { };
- ExtraIds = new Guid[] {};
+ ProductionLocations = Array.Empty<string>();
+ RemoteTrailers = Array.Empty<MediaUrl>();
+ ExtraIds = Array.Empty<Guid>();
}
public static readonly char[] SlugReplaceChars = { '?', '/', '&' };
@@ -62,7 +62,6 @@ namespace MediaBrowser.Controller.Entities
/// The supported image extensions
/// </summary>
public static readonly string[] SupportedImageExtensions = { ".png", ".jpg", ".jpeg", ".tbn", ".gif" };
- public static readonly List<string> SupportedImageExtensionsList = SupportedImageExtensions.ToList();
/// <summary>
/// The trailer folder name
@@ -2895,6 +2894,10 @@ namespace MediaBrowser.Controller.Entities
return ThemeVideoIds.Select(LibraryManager.GetItemById).Where(i => i.ExtraType.Equals(Model.Entities.ExtraType.ThemeVideo)).OrderBy(i => i.SortName);
}
+ /// <summary>
+ /// Gets or sets the remote trailers.
+ /// </summary>
+ /// <value>The remote trailers.</value>
public MediaUrl[] RemoteTrailers { get; set; }
public IEnumerable<BaseItem> GetExtras()
@@ -2913,21 +2916,24 @@ namespace MediaBrowser.Controller.Entities
}
public virtual bool IsHD {
- get{
+ get
+ {
return Height >= 720;
- }
+ }
}
public bool IsShortcut{ get; set;}
public string ShortcutPath{ get; set;}
public int Width { get; set; }
public int Height { get; set; }
public Guid[] ExtraIds { get; set; }
- public virtual long GetRunTimeTicksForPlayState() {
+ public virtual long GetRunTimeTicksForPlayState()
+ {
return RunTimeTicks ?? 0;
}
// what does this do?
public static ExtraType[] DisplayExtraTypes = new[] {Model.Entities.ExtraType.ThemeSong, Model.Entities.ExtraType.ThemeVideo };
- public virtual bool SupportsExternalTransfer {
+ public virtual bool SupportsExternalTransfer
+ {
get {
return false;
}
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 7292b166a..75d6b9381 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -31,18 +31,10 @@ namespace MediaBrowser.Controller.Entities
public CollectionFolder()
{
- PhysicalLocationsList = new string[] { };
- PhysicalFolderIds = new Guid[] { };
+ PhysicalLocationsList = Array.Empty<string>();
+ PhysicalFolderIds = Array.Empty<Guid>();
}
- //public override double? GetDefaultPrimaryImageAspectRatio()
- //{
- // double value = 16;
- // value /= 9;
-
- // return value;
- //}
-
[IgnoreDataMember]
public override bool SupportsPlayedStatus
{
@@ -339,7 +331,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>Task.</returns>
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
- return Task.FromResult(true);
+ return Task.CompletedTask;
}
/// <summary>
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index 3d006a699..4efc5648e 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -12,10 +12,10 @@ namespace MediaBrowser.Controller.Entities
{
public Game()
{
- MultiPartGameFiles = new string[] {};
+ MultiPartGameFiles = Array.Empty<string>();
RemoteTrailers = EmptyMediaUrlArray;
- LocalTrailerIds = new Guid[] {};
- RemoteTrailerIds = new Guid[] {};
+ LocalTrailerIds = Array.Empty<Guid>();
+ RemoteTrailerIds = Array.Empty<Guid>();
}
public Guid[] LocalTrailerIds { get; set; }
@@ -39,12 +39,6 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
- /// Gets or sets the remote trailers.
- /// </summary>
- /// <value>The remote trailers.</value>
- public MediaUrl[] RemoteTrailers { get; set; }
-
- /// <summary>
/// Gets the type of the media.
/// </summary>
/// <value>The type of the media.</value>
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index ff57c2471..bb99c0a84 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -4,7 +4,6 @@ using System.Collections.Generic;
using MediaBrowser.Model.Configuration;
using System.Linq;
using MediaBrowser.Controller.Dto;
-using MediaBrowser.Model.Querying;
namespace MediaBrowser.Controller.Entities
{
@@ -48,7 +47,6 @@ namespace MediaBrowser.Controller.Entities
public string PresentationUniqueKey { get; set; }
public string Path { get; set; }
- public string PathNotStartsWith { get; set; }
public string Name { get; set; }
public string Person { get; set; }
@@ -160,8 +158,6 @@ namespace MediaBrowser.Controller.Entities
public bool EnableGroupByMetadataKey { get; set; }
public bool? HasChapterImages { get; set; }
- // why tuple vs value tuple?
- //public Tuple<string, SortOrder>[] OrderBy { get; set; }
public ValueTuple<string, SortOrder>[] OrderBy { get; set; }
public DateTime? MinDateCreated { get; set; }
@@ -180,44 +176,44 @@ namespace MediaBrowser.Controller.Entities
public InternalItemsQuery()
{
- AlbumArtistIds = new Guid[] {};
- AlbumIds = new Guid[] {};
- AncestorIds = new Guid[] {};
- ArtistIds = new Guid[] {};
- BlockUnratedItems = new UnratedItem[] { };
- BoxSetLibraryFolders = new Guid[] {};
- ChannelIds = new Guid[] {};
- ContributingArtistIds = new Guid[] {};
+ AlbumArtistIds = Array.Empty<Guid>();
+ AlbumIds = Array.Empty<Guid>();
+ AncestorIds = Array.Empty<Guid>();
+ ArtistIds = Array.Empty<Guid>();
+ BlockUnratedItems = Array.Empty<UnratedItem>();
+ BoxSetLibraryFolders = Array.Empty<Guid>();
+ ChannelIds = Array.Empty<Guid>();
+ ContributingArtistIds = Array.Empty<Guid>();
DtoOptions = new DtoOptions();
EnableTotalRecordCount = true;
- ExcludeArtistIds = new Guid[] {};
- ExcludeInheritedTags = new string[] {};
- ExcludeItemIds = new Guid[] {};
- ExcludeItemTypes = new string[] {};
+ ExcludeArtistIds = Array.Empty<Guid>();
+ ExcludeInheritedTags = Array.Empty<string>();
+ ExcludeItemIds = Array.Empty<Guid>();
+ ExcludeItemTypes = Array.Empty<string>();
ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- ExcludeTags = new string[] {};
- GenreIds = new Guid[] {};
- Genres = new string[] {};
+ ExcludeTags = Array.Empty<string>();
+ GenreIds = Array.Empty<Guid>();
+ Genres = Array.Empty<string>();
GroupByPresentationUniqueKey = true;
HasAnyProviderId = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- ImageTypes = new ImageType[] { };
- IncludeItemTypes = new string[] {};
- ItemIds = new Guid[] {};
- MediaTypes = new string[] {};
+ ImageTypes = Array.Empty<ImageType>();
+ IncludeItemTypes = Array.Empty<string>();
+ ItemIds = Array.Empty<Guid>();
+ MediaTypes = Array.Empty<string>();
MinSimilarityScore = 20;
- OfficialRatings = new string[] {};
+ OfficialRatings = Array.Empty<string>();
OrderBy = Array.Empty<ValueTuple<string, SortOrder>>();
- PersonIds = new Guid[] {};
- PersonTypes = new string[] {};
- PresetViews = new string[] {};
- SeriesStatuses = new SeriesStatus[] { };
- SourceTypes = new SourceType[] { };
- StudioIds = new Guid[] {};
- Tags = new string[] {};
- TopParentIds = new Guid[] {};
- TrailerTypes = new TrailerType[] { };
- VideoTypes = new VideoType[] { };
- Years = new int[] { };
+ PersonIds = Array.Empty<Guid>();
+ PersonTypes = Array.Empty<string>();
+ PresetViews = Array.Empty<string>();
+ SeriesStatuses = Array.Empty<SeriesStatus>();
+ SourceTypes = Array.Empty<SourceType>();
+ StudioIds = Array.Empty<Guid>();
+ Tags = Array.Empty<string>();
+ TopParentIds = Array.Empty<Guid>();
+ TrailerTypes = Array.Empty<TrailerType>();
+ VideoTypes = Array.Empty<VideoType>();
+ Years = Array.Empty<int>();
}
public InternalItemsQuery(User user)
diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
index 7e00834e3..ce3e9e070 100644
--- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
@@ -14,8 +14,8 @@ namespace MediaBrowser.Controller.Entities
public InternalPeopleQuery()
{
- PersonTypes = new string[] { };
- ExcludePersonTypes = new string[] { };
+ PersonTypes = Array.Empty<string>();
+ ExcludePersonTypes = Array.Empty<string>();
}
}
}
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index 5918bf981..e888a5582 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -19,8 +19,8 @@ namespace MediaBrowser.Controller.Entities.Movies
public BoxSet()
{
RemoteTrailers = EmptyMediaUrlArray;
- LocalTrailerIds = new Guid[] { };
- RemoteTrailerIds = new Guid[] { };
+ LocalTrailerIds = Array.Empty<Guid>();
+ RemoteTrailerIds = Array.Empty<Guid>();
DisplayOrder = ItemSortBy.PremiereDate;
}
@@ -53,12 +53,6 @@ namespace MediaBrowser.Controller.Entities.Movies
public Guid[] RemoteTrailerIds { get; set; }
/// <summary>
- /// Gets or sets the remote trailers.
- /// </summary>
- /// <value>The remote trailers.</value>
- public MediaUrl[] RemoteTrailers { get; set; }
-
- /// <summary>
/// Gets or sets the display order.
/// </summary>
/// <value>The display order.</value>
@@ -70,12 +64,7 @@ namespace MediaBrowser.Controller.Entities.Movies
}
public override double GetDefaultPrimaryImageAspectRatio()
- {
- double value = 2;
- value /= 3;
-
- return value;
- }
+ => 2 / 3;
public override UnratedItem GetBlockUnratedType()
{
@@ -254,7 +243,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return FlattenItems(boxset.GetLinkedChildren(), expandedFolders);
}
- return new BaseItem[] { };
+ return Array.Empty<BaseItem>();
}
return new[] { item };
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index 878b1b860..4f743991b 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -6,8 +6,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-
-using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
@@ -32,8 +30,6 @@ namespace MediaBrowser.Controller.Entities.Movies
public Guid[] LocalTrailerIds { get; set; }
public Guid[] RemoteTrailerIds { get; set; }
- public MediaUrl[] RemoteTrailers { get; set; }
-
/// <summary>
/// Gets or sets the name of the TMDB collection.
/// </summary>
@@ -55,10 +51,7 @@ namespace MediaBrowser.Controller.Entities.Movies
return 0;
}
- double value = 2;
- value /= 3;
-
- return value;
+ return 2 / 3;
}
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs
index 78f9d0671..4015a1178 100644
--- a/MediaBrowser.Controller/Entities/MusicVideo.cs
+++ b/MediaBrowser.Controller/Entities/MusicVideo.cs
@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities
public MusicVideo()
{
- Artists = new string[] {};
+ Artists = Array.Empty<string>();
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs
index 01c10831d..662aa4249 100644
--- a/MediaBrowser.Controller/Entities/Photo.cs
+++ b/MediaBrowser.Controller/Entities/Photo.cs
@@ -58,6 +58,7 @@ namespace MediaBrowser.Controller.Entities
public override double GetDefaultPrimaryImageAspectRatio()
{
+ // REVIEW: @bond
if (Width.HasValue && Height.HasValue)
{
double width = Width.Value;
@@ -85,8 +86,8 @@ namespace MediaBrowser.Controller.Entities
return base.GetDefaultPrimaryImageAspectRatio();
}
- public int? Width { get; set; }
- public int? Height { get; set; }
+ public new int? Width { get; set; }
+ public new int? Height { get; set; }
public string CameraMake { get; set; }
public string CameraModel { get; set; }
public string Software { get; set; }
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index 3a3a902a3..00e055c51 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Providers;
+using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
@@ -19,13 +19,12 @@ namespace MediaBrowser.Controller.Entities.TV
public Episode()
{
RemoteTrailers = EmptyMediaUrlArray;
- LocalTrailerIds = new Guid[] {};
- RemoteTrailerIds = new Guid[] {};
+ LocalTrailerIds = Array.Empty<Guid>();
+ RemoteTrailerIds = Array.Empty<Guid>();
}
public Guid[] LocalTrailerIds { get; set; }
public Guid[] RemoteTrailerIds { get; set; }
- public MediaUrl[] RemoteTrailers { get; set; }
/// <summary>
/// Gets the season in which it aired.
@@ -112,10 +111,7 @@ namespace MediaBrowser.Controller.Entities.TV
return 0;
}
- double value = 16;
- value /= 9;
-
- return value;
+ return 16 / 9;
}
public override List<string> GetUserDataKeys()
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index b5f77df55..cb3a7f345 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -102,10 +102,11 @@ namespace MediaBrowser.Controller.Entities.TV
get
{
var seriesId = SeriesId;
- if (seriesId.Equals(Guid.Empty)) {
+ if (seriesId == Guid.Empty)
+ {
seriesId = FindSeriesId();
}
- return !seriesId.Equals(Guid.Empty) ? (LibraryManager.GetItemById(seriesId) as Series) : null;
+ return seriesId == Guid.Empty ? null : (LibraryManager.GetItemById(seriesId) as Series);
}
}
@@ -227,7 +228,7 @@ namespace MediaBrowser.Controller.Entities.TV
public Guid FindSeriesId()
{
var series = FindParent<Series>();
- return series == null ? Guid.Empty: series.Id;
+ return series == null ? Guid.Empty : series.Id;
}
/// <summary>
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 88fde1760..d4a62626e 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -23,9 +23,9 @@ namespace MediaBrowser.Controller.Entities.TV
public Series()
{
RemoteTrailers = EmptyMediaUrlArray;
- LocalTrailerIds = new Guid[] {};
- RemoteTrailerIds = new Guid[] {};
- AirDays = new DayOfWeek[] { };
+ LocalTrailerIds = Array.Empty<Guid>();
+ RemoteTrailerIds = Array.Empty<Guid>();
+ AirDays = Array.Empty<DayOfWeek>();
}
public DayOfWeek[] AirDays { get; set; }
@@ -73,8 +73,6 @@ namespace MediaBrowser.Controller.Entities.TV
public Guid[] LocalTrailerIds { get; set; }
public Guid[] RemoteTrailerIds { get; set; }
- public MediaUrl[] RemoteTrailers { get; set; }
-
/// <summary>
/// airdate, dvd or absolute
/// </summary>
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index 4f2a5631b..2ef268ed1 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -15,18 +15,13 @@ namespace MediaBrowser.Controller.Entities
{
public Trailer()
{
- TrailerTypes = new TrailerType[] { };
+ TrailerTypes = Array.Empty<TrailerType>();
}
public TrailerType[] TrailerTypes { get; set; }
public override double GetDefaultPrimaryImageAspectRatio()
- {
- double value = 2;
- value /= 3;
-
- return value;
- }
+ => 2 / 3;
public override UnratedItem GetBlockUnratedType()
{
diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs
index 984cad481..b7c9884ff 100644
--- a/MediaBrowser.Controller/Entities/UserView.cs
+++ b/MediaBrowser.Controller/Entities/UserView.cs
@@ -1,21 +1,18 @@
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.TV;
-using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Serialization;
using System.Threading.Tasks;
-using MediaBrowser.Controller.Dto;
-using MediaBrowser.Controller.Collections;
namespace MediaBrowser.Controller.Entities
{
public class UserView : Folder, IHasCollectionType
{
public string ViewType { get; set; }
- public Guid DisplayParentId { get; set; }
+ public new Guid DisplayParentId { get; set; }
public Guid? UserId { get; set; }
@@ -68,14 +65,6 @@ namespace MediaBrowser.Controller.Entities
}
}
- //public override double? GetDefaultPrimaryImageAspectRatio()
- //{
- // double value = 16;
- // value /= 9;
-
- // return value;
- //}
-
public override int GetChildCount(User user)
{
return GetChildren(user, true).Count;
@@ -161,8 +150,8 @@ namespace MediaBrowser.Controller.Entities
public static bool IsEligibleForGrouping(Folder folder)
{
- var collectionFolder = folder as ICollectionFolder;
- return collectionFolder != null && IsEligibleForGrouping(collectionFolder.CollectionType);
+ return folder is ICollectionFolder collectionFolder
+ && IsEligibleForGrouping(collectionFolder.CollectionType);
}
private static string[] ViewTypesEligibleForGrouping = new string[]
@@ -195,7 +184,7 @@ namespace MediaBrowser.Controller.Entities
protected override Task ValidateChildrenInternal(IProgress<double> progress, System.Threading.CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, Providers.MetadataRefreshOptions refreshOptions, Providers.IDirectoryService directoryService)
{
- return Task.FromResult(true);
+ return Task.CompletedTask;
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 65f5b8382..2db200ee2 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -10,7 +10,6 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Common.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Extensions;
@@ -132,8 +131,6 @@ namespace MediaBrowser.Controller.Entities
public bool HasSubtitles { get; set; }
public bool IsPlaceHolder { get; set; }
- public bool IsShortcut { get; set; }
- public string ShortcutPath { get; set; }
/// <summary>
/// Gets or sets the default index of the video stream.
@@ -173,7 +170,7 @@ namespace MediaBrowser.Controller.Entities
}
else
{
- return new string[] {};
+ return Array.Empty<string>();
}
return mediaEncoder.GetPlayableStreamFileNames(Path, videoType);
}
@@ -186,9 +183,9 @@ namespace MediaBrowser.Controller.Entities
public Video()
{
- AdditionalParts = new string[] {};
- LocalAlternateVersions = new string[] {};
- SubtitleFiles = new string[] {};
+ AdditionalParts = Array.Empty<string>();
+ LocalAlternateVersions = Array.Empty<string>();
+ SubtitleFiles = Array.Empty<string>();
LinkedAlternateVersions = EmptyLinkedChildArray;
}
@@ -215,10 +212,10 @@ namespace MediaBrowser.Controller.Entities
{
if (!string.IsNullOrEmpty(PrimaryVersionId))
{
- var item = LibraryManager.GetItemById(PrimaryVersionId) as Video;
- if (item != null)
+ var item = LibraryManager.GetItemById(PrimaryVersionId);
+ if (item is Video video)
{
- return item.MediaSourceCount;
+ return video.MediaSourceCount;
}
}
return LinkedAlternateVersions.Length + LocalAlternateVersions.Length + 1;
@@ -366,7 +363,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the additional parts.
/// </summary>
/// <returns>IEnumerable{Video}.</returns>
- public IEnumerable<Video> GetAdditionalParts()
+ public IOrderedEnumerable<Video> GetAdditionalParts()
{
return GetAdditionalPartIds()
.Select(i => LibraryManager.GetItemById(i))
@@ -420,8 +417,7 @@ namespace MediaBrowser.Controller.Entities
{
var updateType = base.UpdateFromResolvedItem(newItem);
- var newVideo = newItem as Video;
- if (newVideo != null)
+ if (newItem is Video newVideo)
{
if (!AdditionalParts.SequenceEqual(newVideo.AdditionalParts, StringComparer.Ordinal))
{
@@ -463,7 +459,7 @@ namespace MediaBrowser.Controller.Entities
.Select(i => i.FullName)
.ToArray();
}
- return new string[] {};
+ return Array.Empty<string>();
}
/// <summary>
@@ -618,9 +614,5 @@ namespace MediaBrowser.Controller.Entities
return list;
}
-
- public static bool IsHD (Video video) {
- return video.Height >= 720;
- }
}
}
diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.cs
index 11d77f81a..f3f81378b 100644
--- a/MediaBrowser.Controller/Library/IUserDataManager.cs
+++ b/MediaBrowser.Controller/Library/IUserDataManager.cs
@@ -5,7 +5,6 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
using System.Threading;
-using MediaBrowser.Model.Querying;
namespace MediaBrowser.Controller.Library
{
diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
index 7197425f3..9812802e7 100644
--- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs
+++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
@@ -2,10 +2,7 @@
using MediaBrowser.Controller.Providers;
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
@@ -169,6 +166,7 @@ namespace MediaBrowser.Controller.Library
AdditionalLocations.Add(path);
}
+ // REVIEW: @bond
/// <summary>
/// Gets the physical locations.
/// </summary>
@@ -177,7 +175,7 @@ namespace MediaBrowser.Controller.Library
{
get
{
- var paths = string.IsNullOrEmpty(Path) ? new string[] { } : new[] { Path };
+ var paths = string.IsNullOrEmpty(Path) ? Array.Empty<string>() : new[] { Path };
return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations).ToArray();
}
}
@@ -261,7 +259,7 @@ namespace MediaBrowser.Controller.Library
}
/// <summary>
- /// Equalses the specified args.
+ /// Equals the specified args.
/// </summary>
/// <param name="args">The args.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
index fa3aab4f2..4dc6c7517 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
@@ -47,52 +47,21 @@ namespace MediaBrowser.Controller.LiveTv
return list;
}
- public static double GetDefaultPrimaryImageAspectRatio(IHasProgramAttributes item)
+ private static string EmbyServiceName = "Emby";
+ public override double GetDefaultPrimaryImageAspectRatio()
{
- var serviceName = item.ServiceName;
+ var serviceName = ServiceName;
- if (item.IsMovie)
+ if (string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || string.Equals(serviceName, "Next Pvr", StringComparison.OrdinalIgnoreCase))
{
- if (string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || string.Equals(serviceName, "Next Pvr", StringComparison.OrdinalIgnoreCase))
- {
- double value = 2;
- value /= 3;
-
- return value;
- }
- else
- {
- double value = 16;
- value /= 9;
-
- return value;
- }
+ return 2 / 3;
}
else
{
- if (string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || string.Equals(serviceName, "Next Pvr", StringComparison.OrdinalIgnoreCase))
- {
- double value = 2;
- value /= 3;
-
- return value;
- }
- else
- {
- double value = 16;
- value /= 9;
-
- return value;
- }
+ return 16 / 9;
}
}
- private static string EmbyServiceName = "Emby";
- public override double GetDefaultPrimaryImageAspectRatio()
- {
- return GetDefaultPrimaryImageAspectRatio(this);
- }
-
[IgnoreDataMember]
public override SourceType SourceType
{
diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs
index baf0b0b13..c9eb6fee6 100644
--- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs
@@ -10,11 +10,11 @@ namespace MediaBrowser.Controller.LiveTv
{
public TimerInfo()
{
- Genres = new string[] { };
+ Genres = Array.Empty<string>();
KeepUntil = KeepUntil.UntilDeleted;
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- Tags = new string[] { };
+ Tags = Array.Empty<string>();
}
public Dictionary<string, string> ProviderIds { get; set; }
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 881e318ce..4fb9a711e 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
-using System.Threading;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna;
@@ -12,8 +11,6 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Reflection;
namespace MediaBrowser.Controller.MediaEncoding
{
@@ -343,19 +340,19 @@ namespace MediaBrowser.Controller.MediaEncoding
public int GetVideoProfileScore(string profile)
{
- var list = new []
+ string[] list =
{
- "Constrained Baseline",
+ "ConstrainedBaseline",
"Baseline",
"Extended",
"Main",
"High",
- "Progressive High",
- "Constrained High"
+ "ProgressiveHigh",
+ "ConstrainedHigh"
};
// strip spaces because they may be stripped out on the query string
- return Array.FindIndex(list, t => string.Equals(t.Replace(" ", ""), profile.Replace(" ", ""), StringComparison.OrdinalIgnoreCase));
+ return Array.FindIndex(list, t => string.Equals(t, profile.Replace(" ", ""), StringComparison.OrdinalIgnoreCase));
}
public string GetInputPathArgument(EncodingJobInfo state)
@@ -516,18 +513,12 @@ namespace MediaBrowser.Controller.MediaEncoding
public string NormalizeTranscodingLevel(string videoCodec, string level)
{
- double requestLevel;
-
// Clients may direct play higher than level 41, but there's no reason to transcode higher
- if (double.TryParse(level, NumberStyles.Any, _usCulture, out requestLevel))
+ if (double.TryParse(level, NumberStyles.Any, _usCulture, out double requestLevel)
+ && string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase)
+ && requestLevel > 41)
{
- if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
- {
- if (requestLevel > 41)
- {
- return "41";
- }
- }
+ return "41";
}
return level;
@@ -623,7 +614,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// h264 (h264_qsv)
else if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase))
{
- string[] valid_h264_qsv = new string[] { "veryslow", "slower", "slow", "medium", "fast", "faster", "veryfast" };
+ string[] valid_h264_qsv = { "veryslow", "slower", "slow", "medium", "fast", "faster", "veryfast" };
if (valid_h264_qsv.Contains(encodingOptions.H264Preset, StringComparer.OrdinalIgnoreCase))
{
@@ -1958,12 +1949,12 @@ namespace MediaBrowser.Controller.MediaEncoding
}
else
{
- state.PlayableStreamFileNames = new string[] { };
+ state.PlayableStreamFileNames = Array.Empty<string>();
}
}
else
{
- state.PlayableStreamFileNames = new string[] { };
+ state.PlayableStreamFileNames = Array.Empty<string>();
}
if (mediaSource.Timestamp.HasValue)
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
index c8c2367e6..3f6da59d8 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
@@ -207,7 +207,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
}
- return new string[] { };
+ return Array.Empty<string>();
}
public string GetRequestedLevel(string codec)
@@ -317,10 +317,10 @@ namespace MediaBrowser.Controller.MediaEncoding
_logger = logger;
TranscodingType = jobType;
RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- PlayableStreamFileNames = new string[] { };
- SupportedAudioCodecs = new string[] { };
- SupportedVideoCodecs = new string[] { };
- SupportedSubtitleCodecs = new string[] { };
+ PlayableStreamFileNames = Array.Empty<string>();
+ SupportedAudioCodecs = Array.Empty<string>();
+ SupportedVideoCodecs = Array.Empty<string>();
+ SupportedSubtitleCodecs = Array.Empty<string>();
}
public bool IsSegmentedLiveStream
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs
index befbb2140..101748a5a 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs
@@ -10,7 +10,6 @@ namespace MediaBrowser.Controller.MediaEncoding
public class EncodingJobOptions : BaseEncodingJobOptions
{
public string OutputDirectory { get; set; }
-
public string ItemId { get; set; }
public string MediaSourceId { get; set; }
public string AudioCodec { get; set; }
diff --git a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs
index 1d7222801..b191f9905 100644
--- a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs
+++ b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.MediaEncoding
public MediaInfoRequest()
{
- PlayableStreamFileNames = new string[] {};
+ PlayableStreamFileNames = Array.Empty<string>();
}
}
}
diff --git a/MediaBrowser.Controller/Net/AuthorizationInfo.cs b/MediaBrowser.Controller/Net/AuthorizationInfo.cs
index a68060db5..848d8fa15 100644
--- a/MediaBrowser.Controller/Net/AuthorizationInfo.cs
+++ b/MediaBrowser.Controller/Net/AuthorizationInfo.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Controller.Entities;
using System;
-
namespace MediaBrowser.Controller.Net
{
public class AuthorizationInfo
@@ -12,12 +11,7 @@ namespace MediaBrowser.Controller.Net
/// <value>The user identifier.</value>
public Guid UserId {
get {
- if (User == null) {
- return Guid.Empty;
- }
- else {
- return User.Id;
- }
+ return User == null ? Guid.Empty : User.Id;
}
}
diff --git a/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs
index b200f883a..26abbc2d2 100644
--- a/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs
+++ b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Specialized;
using MediaBrowser.Model.Services;
namespace MediaBrowser.Controller.Net
@@ -7,7 +6,6 @@ namespace MediaBrowser.Controller.Net
/// <summary>
/// Class WebSocketConnectEventArgs
/// </summary>
-
public class WebSocketConnectingEventArgs : EventArgs
{
/// <summary>
diff --git a/MediaBrowser.Controller/Playlists/IPlaylistManager.cs b/MediaBrowser.Controller/Playlists/IPlaylistManager.cs
index 5e790111d..d481bf7c5 100644
--- a/MediaBrowser.Controller/Playlists/IPlaylistManager.cs
+++ b/MediaBrowser.Controller/Playlists/IPlaylistManager.cs
@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using System;
-
namespace MediaBrowser.Controller.Playlists
{
public interface IPlaylistManager
diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index 78614340a..642dfde80 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -15,14 +15,14 @@ namespace MediaBrowser.Controller.Playlists
{
public class Playlist : Folder, IHasShares
{
- public static string[] SupportedExtensions = new string[] {
-
- ".m3u",
- ".m3u8",
- ".pls",
- ".wpl",
- ".zpl"
- };
+ public static string[] SupportedExtensions =
+ {
+ ".m3u",
+ ".m3u8",
+ ".pls",
+ ".wpl",
+ ".zpl"
+ };
public Guid OwnerUserId { get; set; }
@@ -30,7 +30,7 @@ namespace MediaBrowser.Controller.Playlists
public Playlist()
{
- Shares = new Share[] { };
+ Shares = Array.Empty<Share>();
}
[IgnoreDataMember]
@@ -131,7 +131,7 @@ namespace MediaBrowser.Controller.Playlists
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
- return Task.FromResult(true);
+ return Task.CompletedTask;
}
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
@@ -186,8 +186,7 @@ namespace MediaBrowser.Controller.Playlists
private static IEnumerable<BaseItem> GetPlaylistItems(BaseItem item, User user, string mediaType, DtoOptions options)
{
- var musicGenre = item as MusicGenre;
- if (musicGenre != null)
+ if (item is MusicGenre musicGenre)
{
return LibraryManager.GetItemList(new InternalItemsQuery(user)
{
@@ -199,8 +198,7 @@ namespace MediaBrowser.Controller.Playlists
});
}
- var musicArtist = item as MusicArtist;
- if (musicArtist != null)
+ if (item is MusicArtist musicArtist)
{
return LibraryManager.GetItemList(new InternalItemsQuery(user)
{
@@ -212,8 +210,7 @@ namespace MediaBrowser.Controller.Playlists
});
}
- var folder = item as Folder;
- if (folder != null)
+ if (item is Folder folder)
{
var query = new InternalItemsQuery(user)
{
diff --git a/MediaBrowser.Controller/Providers/AlbumInfo.cs b/MediaBrowser.Controller/Providers/AlbumInfo.cs
index 74feb4ea2..b0b443fc0 100644
--- a/MediaBrowser.Controller/Providers/AlbumInfo.cs
+++ b/MediaBrowser.Controller/Providers/AlbumInfo.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Providers
{
ArtistProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
SongInfos = new List<SongInfo>();
- AlbumArtists = EmptyStringArray;
+ AlbumArtists = Array.Empty<string>();
}
}
-} \ No newline at end of file
+}
diff --git a/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs b/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs
index 942d25071..6cc8a691e 100644
--- a/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs
+++ b/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs
@@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Providers
ImageRefreshMode = MetadataRefreshMode.Default;
DirectoryService = directoryService;
- ReplaceImages = new ImageType[] { };
+ ReplaceImages = Array.Empty<ImageType>();
IsAutomated = true;
}
@@ -30,4 +30,4 @@ namespace MediaBrowser.Controller.Providers
(ReplaceAllImages || ReplaceImages.Contains(type));
}
}
-} \ No newline at end of file
+}
diff --git a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs
index 98122e776..dc7a04135 100644
--- a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs
+++ b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs
@@ -6,8 +6,6 @@ namespace MediaBrowser.Controller.Providers
{
public class ItemLookupInfo : IHasProviderIds
{
- protected static string[] EmptyStringArray = new string[] { };
-
/// <summary>
/// Gets or sets the name.
/// </summary>
diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
index 2494be83a..3dbcc5305 100644
--- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
+++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
@@ -1,8 +1,6 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Providers;
@@ -47,7 +45,7 @@ namespace MediaBrowser.Controller.Providers
{
if (RefreshPaths == null)
{
- RefreshPaths = new string[] { };
+ RefreshPaths = Array.Empty<string>();
}
RefreshPaths = copy.RefreshPaths.ToArray();
diff --git a/MediaBrowser.Controller/Providers/MetadataResult.cs b/MediaBrowser.Controller/Providers/MetadataResult.cs
index f35d41ca4..271f784d7 100644
--- a/MediaBrowser.Controller/Providers/MetadataResult.cs
+++ b/MediaBrowser.Controller/Providers/MetadataResult.cs
@@ -74,4 +74,4 @@ namespace MediaBrowser.Controller.Providers
return userData;
}
}
-} \ No newline at end of file
+}
diff --git a/MediaBrowser.Controller/Providers/SongInfo.cs b/MediaBrowser.Controller/Providers/SongInfo.cs
index e3a6f5d37..61e950130 100644
--- a/MediaBrowser.Controller/Providers/SongInfo.cs
+++ b/MediaBrowser.Controller/Providers/SongInfo.cs
@@ -1,3 +1,4 @@
+using System;
namespace MediaBrowser.Controller.Providers
{
@@ -9,8 +10,8 @@ namespace MediaBrowser.Controller.Providers
public SongInfo()
{
- Artists = EmptyStringArray;
- AlbumArtists = EmptyStringArray;
+ Artists = Array.Empty<string>();
+ AlbumArtists = Array.Empty<string>();
}
}
-} \ No newline at end of file
+}
diff --git a/MediaBrowser.Controller/Session/AuthenticationRequest.cs b/MediaBrowser.Controller/Session/AuthenticationRequest.cs
index eb64db8c3..0489cf9b6 100644
--- a/MediaBrowser.Controller/Session/AuthenticationRequest.cs
+++ b/MediaBrowser.Controller/Session/AuthenticationRequest.cs
@@ -1,6 +1,5 @@
using System;
-
namespace MediaBrowser.Controller.Session
{
public class AuthenticationRequest
@@ -9,7 +8,6 @@ namespace MediaBrowser.Controller.Session
public Guid UserId { get; set; }
public string Password { get; set; }
public string PasswordSha1 { get; set; }
- public string PasswordMd5 { get; set; }
public string App { get; set; }
public string AppVersion { get; set; }
public string DeviceId { get; set; }
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index b7719e556..eca345cbc 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -5,7 +5,6 @@ using MediaBrowser.Controller.Security;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Session;
-using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.Threading;
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index 98848a440..77e786ead 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -22,9 +22,9 @@ namespace MediaBrowser.Controller.Session
_sessionManager = sessionManager;
_logger = logger;
- AdditionalUsers = new SessionUserInfo[] { };
+ AdditionalUsers = Array.Empty<SessionUserInfo>();
PlayState = new PlayerStateInfo();
- SessionControllers = new ISessionController[] { };
+ SessionControllers = Array.Empty<ISessionController>();
}
public PlayerStateInfo PlayState { get; set; }
@@ -49,7 +49,7 @@ namespace MediaBrowser.Controller.Session
{
if (Capabilities == null)
{
- return new string[] {};
+ return Array.Empty<string>();
}
return Capabilities.PlayableMediaTypes;
}
@@ -363,7 +363,7 @@ namespace MediaBrowser.Controller.Session
StopAutomaticProgress();
var controllers = SessionControllers.ToList();
- SessionControllers = new ISessionController[] { };
+ SessionControllers = Array.Empty<ISessionController>();
foreach (var controller in controllers)
{
diff --git a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs
index 84bf28c05..daef6db79 100644
--- a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs
+++ b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs
@@ -32,8 +32,8 @@ namespace MediaBrowser.Controller.Subtitles
SearchAllProviders = true;
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- DisabledSubtitleFetchers = new string[] {};
- SubtitleFetcherOrder = new string[] {};
+ DisabledSubtitleFetchers = Array.Empty<string>();
+ SubtitleFetcherOrder = Array.Empty<string>();
}
}
-} \ No newline at end of file
+}