diff options
| author | LogicalPhallacy <44458166+LogicalPhallacy@users.noreply.github.com> | 2019-01-23 00:31:35 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-23 00:31:35 -0800 |
| commit | 404bd04cbc17dc8c8bf4a5c9aa3ca9c5cd85aa68 (patch) | |
| tree | 3d267c6ceef9439a034c113095e10e4d619e7c70 /MediaBrowser.Controller | |
| parent | 8ff89fdc0c30f595a171ffc550f907ef22b6212a (diff) | |
| parent | e05e002b8bb4d13eb2b80b56a0aad8903ddb701e (diff) | |
Merge pull request #8 from jellyfin/master
rebase to latest master
Diffstat (limited to 'MediaBrowser.Controller')
262 files changed, 1190 insertions, 2297 deletions
diff --git a/MediaBrowser.Controller/Authentication/AuthenticationResult.cs b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs index 6dd8f02d8..3c65156e3 100644 --- a/MediaBrowser.Controller/Authentication/AuthenticationResult.cs +++ b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Session; +using MediaBrowser.Controller.Session; using MediaBrowser.Model.Dto; diff --git a/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs index 82308296f..b9f282bd2 100644 --- a/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs +++ b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Users; diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index 9cd50db17..adf03fb66 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -1,12 +1,10 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Querying; using System; using System.Linq; -using MediaBrowser.Model.Serialization; using System.Threading; -using System.Threading.Tasks; using MediaBrowser.Common.Progress; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Channels { @@ -33,19 +31,10 @@ namespace MediaBrowser.Controller.Channels } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override SourceType SourceType - { - get { return SourceType.Channel; } - } + public override SourceType SourceType => SourceType.Channel; protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query) { diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs index 0de2b9a0c..aff68883b 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Channels; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Channels; using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Channels { diff --git a/MediaBrowser.Controller/Channels/ChannelItemResult.cs b/MediaBrowser.Controller/Channels/ChannelItemResult.cs index f88881811..c194c8e48 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemResult.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemResult.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace MediaBrowser.Controller.Channels { @@ -13,4 +13,4 @@ namespace MediaBrowser.Controller.Channels Items = new List<ChannelItemInfo>(); } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Channels/ChannelItemType.cs b/MediaBrowser.Controller/Channels/ChannelItemType.cs index 184ce8a76..833ae75fe 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemType.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemType.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.Channels +namespace MediaBrowser.Controller.Channels { public enum ChannelItemType { @@ -6,4 +6,4 @@ Folder = 1 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Channels/ChannelParentalRating.cs b/MediaBrowser.Controller/Channels/ChannelParentalRating.cs index d9cc521b3..1d189446d 100644 --- a/MediaBrowser.Controller/Channels/ChannelParentalRating.cs +++ b/MediaBrowser.Controller/Channels/ChannelParentalRating.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.Channels +namespace MediaBrowser.Controller.Channels { public enum ChannelParentalRating { @@ -12,4 +12,4 @@ Adult = 4 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs b/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs index c2a51654c..c02055b90 100644 --- a/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.Channels +namespace MediaBrowser.Controller.Channels { public class ChannelSearchInfo { @@ -11,4 +11,4 @@ { public string UserId { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index dc1d9b00a..f8ed98a45 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Channels { diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index a9839e1fb..df508fbe2 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -1,11 +1,11 @@ -using System; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Channels; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Querying; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; namespace MediaBrowser.Controller.Channels { @@ -46,14 +46,12 @@ namespace MediaBrowser.Controller.Channels /// Gets the channels internal. /// </summary> /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> QueryResult<Channel> GetChannelsInternal(ChannelQuery query); /// <summary> /// Gets the channels. /// </summary> /// <param name="query">The query.</param> - /// <param name="cancellationToken">The cancellation token.</param> QueryResult<BaseItemDto> GetChannels(ChannelQuery query); /// <summary> diff --git a/MediaBrowser.Controller/Channels/IHasCacheKey.cs b/MediaBrowser.Controller/Channels/IHasCacheKey.cs index 6376d2f91..d86ad0dba 100644 --- a/MediaBrowser.Controller/Channels/IHasCacheKey.cs +++ b/MediaBrowser.Controller/Channels/IHasCacheKey.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Channels { public interface IHasCacheKey diff --git a/MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs b/MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs index a2c63586b..deee46ff7 100644 --- a/MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs +++ b/MediaBrowser.Controller/Channels/IRequiresMediaInfoCallback.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Dto; @@ -12,4 +12,4 @@ namespace MediaBrowser.Controller.Channels /// </summary> Task<IEnumerable<MediaSourceInfo>> GetChannelItemMediaInfo(string id, CancellationToken cancellationToken); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Channels/ISearchableChannel.cs b/MediaBrowser.Controller/Channels/ISearchableChannel.cs index bf9842eb4..d5b76a160 100644 --- a/MediaBrowser.Controller/Channels/ISearchableChannel.cs +++ b/MediaBrowser.Controller/Channels/ISearchableChannel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Entities; @@ -47,4 +47,4 @@ namespace MediaBrowser.Controller.Channels { string[] Attributes { get; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs index 976808aad..60455e68a 100644 --- a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs +++ b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs @@ -1,6 +1,5 @@ -using System; -using MediaBrowser.Model.Channels; using System.Collections.Generic; +using MediaBrowser.Model.Channels; namespace MediaBrowser.Controller.Channels { diff --git a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs index c69a1f6c3..6d5ca75af 100644 --- a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs +++ b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.Channels; using System; +using MediaBrowser.Model.Channels; namespace MediaBrowser.Controller.Channels diff --git a/MediaBrowser.Controller/Chapters/IChapterManager.cs b/MediaBrowser.Controller/Chapters/IChapterManager.cs index 161e87094..d061898a1 100644 --- a/MediaBrowser.Controller/Chapters/IChapterManager.cs +++ b/MediaBrowser.Controller/Chapters/IChapterManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Chapters diff --git a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs index 5363e035c..51fe4ce29 100644 --- a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs +++ b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Collections { diff --git a/MediaBrowser.Controller/Collections/CollectionEvents.cs b/MediaBrowser.Controller/Collections/CollectionEvents.cs index 80f66a444..bfc6af463 100644 --- a/MediaBrowser.Controller/Collections/CollectionEvents.cs +++ b/MediaBrowser.Controller/Collections/CollectionEvents.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Movies; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; namespace MediaBrowser.Controller.Collections { diff --git a/MediaBrowser.Controller/Collections/ICollectionManager.cs b/MediaBrowser.Controller/Collections/ICollectionManager.cs index 05bc927ba..cfe8493d3 100644 --- a/MediaBrowser.Controller/Collections/ICollectionManager.cs +++ b/MediaBrowser.Controller/Collections/ICollectionManager.cs @@ -1,8 +1,7 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Movies; using System; using System.Collections.Generic; -using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; namespace MediaBrowser.Controller.Collections { diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs index af5714932..6660743e6 100644 --- a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs +++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Configuration; namespace MediaBrowser.Controller.Configuration diff --git a/MediaBrowser.Controller/Connect/UserLinkResult.cs b/MediaBrowser.Controller/Connect/UserLinkResult.cs index 16ebfc70a..327ceb952 100644 --- a/MediaBrowser.Controller/Connect/UserLinkResult.cs +++ b/MediaBrowser.Controller/Connect/UserLinkResult.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Connect { public class UserLinkResult diff --git a/MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs b/MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs index b3f3bb902..89d0be58f 100644 --- a/MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs +++ b/MediaBrowser.Controller/Devices/CameraImageUploadInfo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Devices; +using MediaBrowser.Model.Devices; namespace MediaBrowser.Controller.Devices { diff --git a/MediaBrowser.Controller/Devices/IDeviceManager.cs b/MediaBrowser.Controller/Devices/IDeviceManager.cs index d29fb8ded..77d567631 100644 --- a/MediaBrowser.Controller/Devices/IDeviceManager.cs +++ b/MediaBrowser.Controller/Devices/IDeviceManager.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Model.Devices; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Session; using System; using System.IO; using System.Threading.Tasks; using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Devices; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Session; namespace MediaBrowser.Controller.Devices { diff --git a/MediaBrowser.Controller/Dlna/IDlnaManager.cs b/MediaBrowser.Controller/Dlna/IDlnaManager.cs index 2f64cd194..a6ee7c505 100644 --- a/MediaBrowser.Controller/Dlna/IDlnaManager.cs +++ b/MediaBrowser.Controller/Dlna/IDlnaManager.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Controller.Drawing; -using MediaBrowser.Model.Dlna; using System.Collections.Generic; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Model.Dlna; namespace MediaBrowser.Controller.Dlna { @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Dlna /// </summary> /// <param name="headers">The headers.</param> /// <returns>DeviceProfile.</returns> - DeviceProfile GetProfile(IDictionary<string,string> headers); + DeviceProfile GetProfile(IDictionary<string, string> headers); /// <summary> /// Gets the default profile. @@ -30,26 +30,26 @@ namespace MediaBrowser.Controller.Dlna /// </summary> /// <param name="profile">The profile.</param> void CreateProfile(DeviceProfile profile); - + /// <summary> /// Updates the profile. /// </summary> /// <param name="profile">The profile.</param> void UpdateProfile(DeviceProfile profile); - + /// <summary> /// Deletes the profile. /// </summary> /// <param name="id">The identifier.</param> void DeleteProfile(string id); - + /// <summary> /// Gets the profile. /// </summary> /// <param name="id">The identifier.</param> /// <returns>DeviceProfile.</returns> DeviceProfile GetProfile(string id); - + /// <summary> /// Gets the profile. /// </summary> diff --git a/MediaBrowser.Controller/Drawing/IImageEncoder.cs b/MediaBrowser.Controller/Drawing/IImageEncoder.cs index 757448eb2..6e2d5781a 100644 --- a/MediaBrowser.Controller/Drawing/IImageEncoder.cs +++ b/MediaBrowser.Controller/Drawing/IImageEncoder.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Model.Drawing; namespace MediaBrowser.Controller.Drawing diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs index fdf10e223..7e6e0127f 100644 --- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs +++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs @@ -1,11 +1,11 @@ -using System; +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Entities; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; namespace MediaBrowser.Controller.Drawing { @@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.Drawing /// <returns>ImageSize.</returns> ImageSize GetImageSize(BaseItem item, ItemImageInfo info); - ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool allowSlowMethods, bool updateItem); + ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool updateItem); /// <summary> /// Adds the parts. @@ -82,7 +82,7 @@ namespace MediaBrowser.Controller.Drawing /// </summary> /// <param name="options">The options.</param> /// <returns>Task.</returns> - Task<Tuple<string, string, DateTime>> ProcessImage(ImageProcessingOptions options); + Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options); /// <summary> /// Gets the enhanced image. diff --git a/MediaBrowser.Controller/Drawing/ImageCollageOptions.cs b/MediaBrowser.Controller/Drawing/ImageCollageOptions.cs index 92a7f5ac9..3f762fad0 100644 --- a/MediaBrowser.Controller/Drawing/ImageCollageOptions.cs +++ b/MediaBrowser.Controller/Drawing/ImageCollageOptions.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Drawing { public class ImageCollageOptions diff --git a/MediaBrowser.Controller/Drawing/ImageHelper.cs b/MediaBrowser.Controller/Drawing/ImageHelper.cs index 6fb9f256e..2680c60bd 100644 --- a/MediaBrowser.Controller/Drawing/ImageHelper.cs +++ b/MediaBrowser.Controller/Drawing/ImageHelper.cs @@ -1,4 +1,3 @@ -using System; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs index ffc3e6cc0..00d93930f 100644 --- a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs +++ b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs @@ -1,10 +1,9 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Drawing; using System; -using System.Collections.Generic; using System.IO; using System.Linq; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Drawing; namespace MediaBrowser.Controller.Drawing { diff --git a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs index 948219bf5..df9050de5 100644 --- a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs +++ b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Drawing @@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Drawing { return processor.GetImageCacheTag(item, imageType, 0); } - + public static string GetImageCacheTag(this IImageProcessor processor, BaseItem item, ImageType imageType, int imageIndex) { var imageInfo = item.GetImageInfo(imageType, imageIndex); @@ -22,4 +22,4 @@ namespace MediaBrowser.Controller.Drawing return processor.GetImageCacheTag(item, imageInfo); } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Drawing/ImageStream.cs b/MediaBrowser.Controller/Drawing/ImageStream.cs index 353abaca3..74ac24ec9 100644 --- a/MediaBrowser.Controller/Drawing/ImageStream.cs +++ b/MediaBrowser.Controller/Drawing/ImageStream.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.Drawing; using System; using System.IO; +using MediaBrowser.Model.Drawing; namespace MediaBrowser.Controller.Drawing { diff --git a/MediaBrowser.Controller/Dto/DtoOptions.cs b/MediaBrowser.Controller/Dto/DtoOptions.cs index b5ce09028..aa99f6b58 100644 --- a/MediaBrowser.Controller/Dto/DtoOptions.cs +++ b/MediaBrowser.Controller/Dto/DtoOptions.cs @@ -1,13 +1,13 @@ -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; using System; using System.Linq; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.Dto { public class DtoOptions { - private static readonly ItemFields[] DefaultExcludedFields = new [] + private static readonly ItemFields[] DefaultExcludedFields = new[] { ItemFields.SeasonUserData, ItemFields.RefreshState diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs index 37e83e45a..df5ec5dd0 100644 --- a/MediaBrowser.Controller/Dto/IDtoService.cs +++ b/MediaBrowser.Controller/Dto/IDtoService.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Entities; +using System.Collections.Generic; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Querying; -using System.Collections.Generic; namespace MediaBrowser.Controller.Dto { diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index a4601c270..054df21e5 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Controller.IO; -using MediaBrowser.Controller.Library; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.IO; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; @@ -24,10 +24,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool IsPhysicalRoot - { - get { return true; } - } + public override bool IsPhysicalRoot => true; public override bool CanDelete() { @@ -35,13 +32,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; /// <summary> /// The _virtual children @@ -52,19 +43,10 @@ namespace MediaBrowser.Controller.Entities /// Gets the virtual children. /// </summary> /// <value>The virtual children.</value> - public ConcurrentBag<BaseItem> VirtualChildren - { - get { return _virtualChildren; } - } + public ConcurrentBag<BaseItem> VirtualChildren => _virtualChildren; [IgnoreDataMember] - public override string[] PhysicalLocations - { - get - { - return PhysicalLocationsList; - } - } + public override string[] PhysicalLocations => PhysicalLocationsList; public string[] PhysicalLocationsList { get; set; } @@ -182,12 +164,12 @@ namespace MediaBrowser.Controller.Entities /// Adds the virtual child. /// </summary> /// <param name="child">The child.</param> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public void AddVirtualChild(BaseItem child) { if (child == null) { - throw new ArgumentNullException(); + throw new ArgumentNullException(nameof(child)); } _virtualChildren.Add(child); @@ -198,12 +180,12 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <param name="id">The id.</param> /// <returns>BaseItem.</returns> - /// <exception cref="System.ArgumentNullException">id</exception> + /// <exception cref="ArgumentNullException">id</exception> public BaseItem FindVirtualChild(Guid id) { if (id.Equals(Guid.Empty)) { - throw new ArgumentNullException("id"); + throw new ArgumentNullException(nameof(id)); } foreach (var child in _virtualChildren) diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 1aeae6052..13a6fe44a 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using MediaBrowser.Controller.Persistence; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities.Audio @@ -41,49 +41,22 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return false; } - } + public override bool SupportsPeople => false; [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - protected override bool SupportsOwnedItems - { - get - { - return false; - } - } + protected override bool SupportsOwnedItems => false; [IgnoreDataMember] - public override Folder LatestItemsIndexContainer - { - get - { - return AlbumEntity; - } - } + public override Folder LatestItemsIndexContainer => AlbumEntity; public override bool CanDownload() { @@ -115,23 +88,14 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public MusicAlbum AlbumEntity - { - get { return FindParent<MusicAlbum>(); } - } + public MusicAlbum AlbumEntity => FindParent<MusicAlbum>(); /// <summary> /// Gets the type of the media. /// </summary> /// <value>The type of the media.</value> [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Audio; - } - } + public override string MediaType => Model.Entities.MediaType.Audio; /// <summary> /// Creates the name of the sort. diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs index b2dedada4..a269b3486 100644 --- a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Entities.Audio { public interface IHasAlbumArtist diff --git a/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs b/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs index 2200d4b75..5ae056050 100644 --- a/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs +++ b/MediaBrowser.Controller/Entities/Audio/IHasMusicGenres.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - 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 870e6e07e..a3e05f0d2 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -1,15 +1,15 @@ -using System; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; +using System; using System.Collections.Generic; using System.Linq; -using MediaBrowser.Model.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.Audio { @@ -28,22 +28,13 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public MusicArtist MusicArtist - { - get { return GetMusicArtist(new DtoOptions(true)); } - } + public MusicArtist MusicArtist => GetMusicArtist(new DtoOptions(true)); public MusicArtist GetMusicArtist(DtoOptions options) { @@ -66,22 +57,10 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsCumulativeRunTimeTicks - { - get - { - return true; - } - } + public override bool SupportsCumulativeRunTimeTicks => true; [IgnoreDataMember] public string[] AllArtists @@ -107,29 +86,17 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public string AlbumArtist - { - get { return AlbumArtists.Length == 0 ? null : AlbumArtists[0]; } - } + public string AlbumArtist => AlbumArtists.Length == 0 ? null : AlbumArtists[0]; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return false; } - } + public override bool SupportsPeople => false; /// <summary> /// Gets the tracks. /// </summary> /// <value>The tracks.</value> [IgnoreDataMember] - public IEnumerable<BaseItem> Tracks - { - get - { - return GetRecursiveChildren(i => i is Audio); - } - } + public IEnumerable<BaseItem> Tracks => GetRecursiveChildren(i => i is Audio); protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs index 56ed10ced..2d464bd32 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs @@ -1,14 +1,14 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; -using MediaBrowser.Model.Serialization; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Extensions; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Users; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities.Audio @@ -19,61 +19,25 @@ namespace MediaBrowser.Controller.Entities.Audio public class MusicArtist : Folder, IItemByName, IHasMusicGenres, IHasDualAccess, IHasLookupInfo<ArtistInfo> { [IgnoreDataMember] - public bool IsAccessedByName - { - get { return ParentId.Equals(Guid.Empty); } - } + public bool IsAccessedByName => ParentId.Equals(Guid.Empty); [IgnoreDataMember] - public override bool IsFolder - { - get - { - return !IsAccessedByName; - } - } + public override bool IsFolder => !IsAccessedByName; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsCumulativeRunTimeTicks - { - get - { - return true; - } - } + public override bool SupportsCumulativeRunTimeTicks => true; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -154,13 +118,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; /// <summary> /// Gets the user data key. @@ -207,13 +165,7 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs index ec68eaf8b..d26aaf2bb 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Collections.Generic; -using MediaBrowser.Model.Serialization; using MediaBrowser.Controller.Extensions; +using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities.Audio @@ -24,28 +24,13 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; /// <summary> /// Returns the folder containing the item. @@ -53,13 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; public override double GetDefaultPrimaryImageAspectRatio() { @@ -77,13 +56,7 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public IList<BaseItem> GetTaggedItems(InternalItemsQuery query) { diff --git a/MediaBrowser.Controller/Entities/AudioBook.cs b/MediaBrowser.Controller/Entities/AudioBook.cs index 679facf64..65c8a5fdd 100644 --- a/MediaBrowser.Controller/Entities/AudioBook.cs +++ b/MediaBrowser.Controller/Entities/AudioBook.cs @@ -1,30 +1,17 @@ -using System; +using System; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Entities { public class AudioBook : Audio.Audio, IHasSeries, IHasLookupInfo<SongInfo> { [IgnoreDataMember] - public override bool SupportsPositionTicksResume - { - get - { - return true; - } - } + public override bool SupportsPositionTicksResume => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index a268e6d76..d313848fe 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,15 +1,3 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Library; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Globalization; @@ -17,15 +5,27 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller.Channels; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Extensions; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Persistence; +using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Sorting; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Library; using MediaBrowser.Model.LiveTv; +using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Users; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -108,19 +108,10 @@ namespace MediaBrowser.Controller.Entities public Guid ChannelId { get; set; } [IgnoreDataMember] - public virtual bool SupportsAddingToPlaylist - { - get - { - return false; - } - } + public virtual bool SupportsAddingToPlaylist => false; [IgnoreDataMember] - public virtual bool AlwaysScanInternalMetadataPath - { - get { return false; } - } + public virtual bool AlwaysScanInternalMetadataPath => false; /// <summary> /// Gets a value indicating whether this instance is in mixed folder. @@ -130,31 +121,13 @@ namespace MediaBrowser.Controller.Entities public bool IsInMixedFolder { get; set; } [IgnoreDataMember] - public virtual bool SupportsPlayedStatus - { - get - { - return false; - } - } + public virtual bool SupportsPlayedStatus => false; [IgnoreDataMember] - public virtual bool SupportsPositionTicksResume - { - get - { - return false; - } - } + public virtual bool SupportsPositionTicksResume => false; [IgnoreDataMember] - public virtual bool SupportsRemoteImageDownloading - { - get - { - return true; - } - } + public virtual bool SupportsRemoteImageDownloading => true; private string _name; /// <summary> @@ -164,10 +137,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public virtual string Name { - get - { - return _name; - } + get => _name; set { _name = value; @@ -178,10 +148,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public bool IsUnaired - { - get { return PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; } - } + public bool IsUnaired => PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; [IgnoreDataMember] public int? TotalBitrate { get; set; } @@ -189,13 +156,7 @@ namespace MediaBrowser.Controller.Entities public ExtraType? ExtraType { get; set; } [IgnoreDataMember] - public bool IsThemeMedia - { - get - { - return ExtraType.HasValue && (ExtraType.Value == Model.Entities.ExtraType.ThemeSong || ExtraType.Value == Model.Entities.ExtraType.ThemeVideo); - } - } + public bool IsThemeMedia => ExtraType.HasValue && (ExtraType.Value == Model.Entities.ExtraType.ThemeSong || ExtraType.Value == Model.Entities.ExtraType.ThemeVideo); [IgnoreDataMember] public string OriginalTitle { get; set; } @@ -295,13 +256,7 @@ namespace MediaBrowser.Controller.Entities public string ExternalEtag { get; set; } [IgnoreDataMember] - public virtual bool IsHidden - { - get - { - return false; - } - } + public virtual bool IsHidden => false; public BaseItem GetOwner() { @@ -362,22 +317,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public bool IsFileProtocol - { - get - { - return IsPathProtocol(MediaProtocol.File); - } - } + public bool IsFileProtocol => IsPathProtocol(MediaProtocol.File); [IgnoreDataMember] - public bool HasPathProtocol - { - get - { - return PathProtocol.HasValue; - } - } + public bool HasPathProtocol => PathProtocol.HasValue; [IgnoreDataMember] public virtual bool SupportsLocalMetadata @@ -408,13 +351,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool EnableAlphaNumericSorting - { - get - { - return true; - } - } + public virtual bool EnableAlphaNumericSorting => true; private List<Tuple<StringBuilder, bool>> GetSortChunks(string s1) { @@ -430,7 +367,7 @@ namespace MediaBrowser.Controller.Entities } char thisCh = s1[thisMarker]; - StringBuilder thisChunk = new StringBuilder(); + var thisChunk = new StringBuilder(); while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || SortHelper.InChunk(thisCh, thisChunk[0]))) { @@ -455,10 +392,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The primary image path.</value> [IgnoreDataMember] - public string PrimaryImagePath - { - get { return this.GetImagePath(ImageType.Primary); } - } + public string PrimaryImagePath => this.GetImagePath(ImageType.Primary); public bool IsMetadataFetcherEnabled(LibraryOptions libraryOptions, string name) { @@ -614,9 +548,9 @@ namespace MediaBrowser.Controller.Entities public static IMediaSourceManager MediaSourceManager { get; set; } /// <summary> - /// Returns a <see cref="System.String" /> that represents this instance. + /// Returns a <see cref="string" /> that represents this instance. /// </summary> - /// <returns>A <see cref="System.String" /> that represents this instance.</returns> + /// <returns>A <see cref="string" /> that represents this instance.</returns> public override string ToString() { return Name; @@ -637,13 +571,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The type of the media.</value> [IgnoreDataMember] - public virtual string MediaType - { - get - { - return null; - } - } + public virtual string MediaType => null; [IgnoreDataMember] public virtual string[] PhysicalLocations @@ -667,7 +595,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public string ForcedSortName { - get { return _forcedSortName; } + get => _forcedSortName; set { _forcedSortName = value; _sortName = null; } } @@ -695,10 +623,7 @@ namespace MediaBrowser.Controller.Entities } return _sortName; } - set - { - _sortName = value; - } + set => _sortName = value; } public string GetInternalMetadataPath() @@ -816,7 +741,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public Folder Parent { - get { return GetParent() as Folder; } + get => GetParent() as Folder; set { @@ -1007,10 +932,7 @@ namespace MediaBrowser.Controller.Entities public int? ParentIndexNumber { get; set; } [IgnoreDataMember] - public virtual bool HasLocalAlternateVersions - { - get { return false; } - } + public virtual bool HasLocalAlternateVersions => false; [IgnoreDataMember] public string OfficialRatingForComparison @@ -1139,7 +1061,7 @@ namespace MediaBrowser.Controller.Entities { if (item == null) { - throw new ArgumentNullException("media"); + throw new ArgumentNullException(nameof(item)); } var protocol = item.PathProtocol; @@ -1426,22 +1348,13 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected virtual bool SupportsOwnedItems - { - get { return !ParentId.Equals(Guid.Empty) && IsFileProtocol; } - } + protected virtual bool SupportsOwnedItems => !ParentId.Equals(Guid.Empty) && IsFileProtocol; [IgnoreDataMember] - public virtual bool SupportsPeople - { - get { return false; } - } + public virtual bool SupportsPeople => false; [IgnoreDataMember] - public virtual bool SupportsThemeMedia - { - get { return false; } - } + public virtual bool SupportsThemeMedia => false; /// <summary> /// Refreshes owned items such as trailers, theme videos, special features, etc. @@ -1490,9 +1403,9 @@ namespace MediaBrowser.Controller.Entities private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken) { - var newItems = LibraryManager.FindTrailers(this, fileSystemChildren, options.DirectoryService).ToList(); + var newItems = LibraryManager.FindTrailers(this, fileSystemChildren, options.DirectoryService); - var newItemIds = newItems.Select(i => i.Id).ToArray(); + var newItemIds = newItems.Select(i => i.Id); var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds); var ownerId = item.Id; @@ -1501,8 +1414,7 @@ namespace MediaBrowser.Controller.Entities { var subOptions = new MetadataRefreshOptions(options); - if (!i.ExtraType.HasValue || - i.ExtraType.Value != Model.Entities.ExtraType.Trailer || + if (i.ExtraType != Model.Entities.ExtraType.Trailer || i.OwnerId != ownerId || !i.ParentId.Equals(Guid.Empty)) { @@ -1517,7 +1429,7 @@ namespace MediaBrowser.Controller.Entities await Task.WhenAll(tasks).ConfigureAwait(false); - item.LocalTrailerIds = newItemIds; + item.LocalTrailerIds = newItemIds.ToArray(); return itemsChanged; } @@ -1602,10 +1514,7 @@ namespace MediaBrowser.Controller.Entities public Dictionary<string, string> ProviderIds { get; set; } [IgnoreDataMember] - public virtual Folder LatestItemsIndexContainer - { - get { return null; } - } + public virtual Folder LatestItemsIndexContainer => null; public virtual double GetDefaultPrimaryImageAspectRatio() { @@ -1751,12 +1660,12 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <param name="user">The user.</param> /// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns> - /// <exception cref="System.ArgumentNullException">user</exception> + /// <exception cref="ArgumentNullException">user</exception> public bool IsParentalAllowed(User user) { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } if (!IsVisibleViaTags(user)) @@ -1901,12 +1810,12 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <param name="user">The user.</param> /// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns> - /// <exception cref="System.ArgumentNullException">user</exception> + /// <exception cref="ArgumentNullException">user</exception> public virtual bool IsVisible(User user) { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } return IsParentalAllowed(user); @@ -1923,10 +1832,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool SupportsInheritedParentImages - { - get { return false; } - } + public virtual bool SupportsInheritedParentImages => false; protected bool IsVisibleStandaloneInternal(User user, bool checkFolders) { @@ -1969,22 +1875,10 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public virtual bool IsFolder - { - get - { - return false; - } - } + public virtual bool IsFolder => false; [IgnoreDataMember] - public virtual bool IsDisplayedAsFolder - { - get - { - return false; - } - } + public virtual bool IsDisplayedAsFolder => false; public virtual string GetClientTypeName() { @@ -2070,24 +1964,18 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool EnableRememberingTrackSelections - { - get - { - return true; - } - } + public virtual bool EnableRememberingTrackSelections => true; /// <summary> /// Adds a studio to the item /// </summary> /// <param name="name">The name.</param> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public void AddStudio(string name) { if (string.IsNullOrEmpty(name)) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } var current = Studios; @@ -2100,8 +1988,8 @@ namespace MediaBrowser.Controller.Entities } else { - var list = - Studios = current.Concat(new [] { name }).ToArray(); + var list = + Studios = current.Concat(new[] { name }).ToArray(); } } } @@ -2115,12 +2003,12 @@ namespace MediaBrowser.Controller.Entities /// Adds a genre to the item /// </summary> /// <param name="name">The name.</param> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public void AddGenre(string name) { if (string.IsNullOrEmpty(name)) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } var genres = Genres; @@ -2139,14 +2027,14 @@ 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> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public virtual void MarkPlayed(User user, DateTime? datePlayed, bool resetPosition) { if (user == null) { - throw new ArgumentNullException(); + throw new ArgumentNullException(nameof(user)); } var data = UserDataManager.GetUserData(user, this); @@ -2176,12 +2064,12 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <param name="user">The user.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public virtual void MarkUnplayed(User user) { if (user == null) { - throw new ArgumentNullException(); + throw new ArgumentNullException(nameof(user)); } var data = UserDataManager.GetUserData(user, this); @@ -2215,7 +2103,7 @@ namespace MediaBrowser.Controller.Entities /// <param name="type">The type.</param> /// <param name="imageIndex">Index of the image.</param> /// <returns><c>true</c> if the specified type has image; otherwise, <c>false</c>.</returns> - /// <exception cref="System.ArgumentException">Backdrops should be accessed using Item.Backdrops</exception> + /// <exception cref="ArgumentException">Backdrops should be accessed using Item.Backdrops</exception> public bool HasImage(ImageType type, int imageIndex) { return GetImageInfo(type, imageIndex) != null; @@ -2241,7 +2129,7 @@ namespace MediaBrowser.Controller.Entities else { var currentCount = ImageInfos.Length; - ImageInfos = ImageInfos.Concat(new [] { image }) .ToArray(); + ImageInfos = ImageInfos.Concat(new[] { image }).ToArray(); } } @@ -2256,7 +2144,7 @@ namespace MediaBrowser.Controller.Entities if (image == null) { - ImageInfos = ImageInfos.Concat(new [] { GetImageInfo(file, type) }) .ToArray(); + ImageInfos = ImageInfos.Concat(new[] { GetImageInfo(file, type) }).ToArray(); } else { @@ -2343,9 +2231,9 @@ namespace MediaBrowser.Controller.Entities /// <param name="imageType">Type of the image.</param> /// <param name="imageIndex">Index of the image.</param> /// <returns>System.String.</returns> - /// <exception cref="System.InvalidOperationException"> + /// <exception cref="InvalidOperationException"> /// </exception> - /// <exception cref="System.ArgumentNullException">item</exception> + /// <exception cref="ArgumentNullException">item</exception> public string GetImagePath(ImageType imageType, int imageIndex) { var info = GetImageInfo(imageType, imageIndex); @@ -2405,7 +2293,7 @@ namespace MediaBrowser.Controller.Entities /// <param name="imageType">Type of the image.</param> /// <param name="images">The images.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> - /// <exception cref="System.ArgumentException">Cannot call AddImages with chapter images</exception> + /// <exception cref="ArgumentException">Cannot call AddImages with chapter images</exception> public bool AddImages(ImageType imageType, List<FileSystemMetadata> images) { if (imageType == ImageType.Chapter) @@ -2579,7 +2467,7 @@ namespace MediaBrowser.Controller.Entities { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } var userdata = UserDataManager.GetUserData(user, this); @@ -2813,22 +2701,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool SupportsAncestors - { - get - { - return true; - } - } + public virtual bool SupportsAncestors => true; [IgnoreDataMember] - public virtual bool StopRefreshIfLocalMetadataFound - { - get - { - return true; - } - } + public virtual bool StopRefreshIfLocalMetadataFound => true; public virtual IEnumerable<Guid> GetIdsForAncestorQuery() { @@ -2915,14 +2791,9 @@ namespace MediaBrowser.Controller.Entities return GetExtras(); } - public virtual bool IsHD { - get - { - return Height >= 720; - } - } - public bool IsShortcut{ get; set;} - public string ShortcutPath{ get; set;} + public virtual bool IsHD => 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; } @@ -2931,12 +2802,7 @@ namespace MediaBrowser.Controller.Entities return RunTimeTicks ?? 0; } // what does this do? - public static ExtraType[] DisplayExtraTypes = new[] {Model.Entities.ExtraType.ThemeSong, Model.Entities.ExtraType.ThemeVideo }; - public virtual bool SupportsExternalTransfer - { - get { - return false; - } - } + public static ExtraType[] DisplayExtraTypes = new[] { Model.Entities.ExtraType.ThemeSong, Model.Entities.ExtraType.ThemeVideo }; + public virtual bool SupportsExternalTransfer => false; } } diff --git a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs index 8ab1788b5..9c955a724 100644 --- a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs +++ b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs @@ -1,14 +1,6 @@ -using System; using System.Linq; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.Entities { @@ -62,17 +54,17 @@ namespace MediaBrowser.Controller.Entities item.SetImagePath(imageType, BaseItem.FileSystem.GetFileInfo(file)); } } - + /// <summary> /// Copies all properties on object. Skips properties that do not exist. /// </summary> /// <param name="source">The source object.</param> /// <param name="dest">The destination object.</param> - public static void DeepCopy<T, TU>(this T source, TU dest) + public static void DeepCopy<T, TU>(this T source, TU dest) where T : BaseItem where TU : BaseItem { - var sourceProps = typeof (T).GetProperties().Where(x => x.CanRead).ToList(); + var sourceProps = typeof(T).GetProperties().Where(x => x.CanRead).ToList(); var destProps = typeof(TU).GetProperties() .Where(x => x.CanWrite) .ToList(); @@ -82,7 +74,7 @@ namespace MediaBrowser.Controller.Entities if (destProps.Any(x => x.Name == sourceProp.Name)) { var p = destProps.First(x => x.Name == sourceProp.Name); - p.SetValue(dest, sourceProp.GetValue(source, null), null); + p.SetValue(dest, sourceProp.GetValue(source, null), null); } } @@ -93,7 +85,7 @@ namespace MediaBrowser.Controller.Entities /// Copies all properties on newly created object. Skips properties that do not exist. /// </summary> /// <param name="source">The source object.</param> - public static TU DeepCopy<T, TU>(this T source) + public static TU DeepCopy<T, TU>(this T source) where T : BaseItem where TU : BaseItem, new() { diff --git a/MediaBrowser.Controller/Entities/BasePluginFolder.cs b/MediaBrowser.Controller/Entities/BasePluginFolder.cs index c06f1cef4..8cdb9695c 100644 --- a/MediaBrowser.Controller/Entities/BasePluginFolder.cs +++ b/MediaBrowser.Controller/Entities/BasePluginFolder.cs @@ -1,4 +1,3 @@ - using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities @@ -10,10 +9,7 @@ namespace MediaBrowser.Controller.Entities public abstract class BasePluginFolder : Folder, ICollectionFolder { [IgnoreDataMember] - public virtual string CollectionType - { - get { return null; } - } + public virtual string CollectionType => null; public override bool CanDelete() { @@ -26,22 +22,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; //public override double? GetDefaultPrimaryImageAspectRatio() //{ diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index 6814570c3..7a23d9a66 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -1,22 +1,15 @@ -using System; +using System; using System.Linq; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Entities { public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries { [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Book; - } - } + public override string MediaType => Model.Entities.MediaType.Book; [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 75d6b9381..91cfcd0ce 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -8,9 +8,7 @@ using System.Threading.Tasks; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; -using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; @@ -36,22 +34,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; public override bool CanDelete() { @@ -117,8 +103,7 @@ namespace MediaBrowser.Controller.Entities { lock (LibraryOptions) { - LibraryOptions options; - if (!LibraryOptions.TryGetValue(path, out options)) + if (!LibraryOptions.TryGetValue(path, out var options)) { options = LoadLibraryOptions(path); LibraryOptions[path] = options; @@ -160,22 +145,10 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The display prefs id.</value> [IgnoreDataMember] - public override Guid DisplayPreferencesId - { - get - { - return Id; - } - } + public override Guid DisplayPreferencesId => Id; [IgnoreDataMember] - public override string[] PhysicalLocations - { - get - { - return PhysicalLocationsList; - } - } + public override string[] PhysicalLocations => PhysicalLocationsList; public override bool IsSaveLocalMetadataEnabled() { @@ -339,10 +312,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The actual children.</value> [IgnoreDataMember] - public override IEnumerable<BaseItem> Children - { - get { return GetActualChildren(); } - } + public override IEnumerable<BaseItem> Children => GetActualChildren(); public IEnumerable<BaseItem> GetActualChildren() { @@ -388,12 +358,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/DayOfWeekHelper.cs b/MediaBrowser.Controller/Entities/DayOfWeekHelper.cs index 166ef66d4..8a79e0783 100644 --- a/MediaBrowser.Controller/Entities/DayOfWeekHelper.cs +++ b/MediaBrowser.Controller/Entities/DayOfWeekHelper.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.Configuration; using System; using System.Collections.Generic; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.cs index ee135a14e..f3bddd29c 100644 --- a/MediaBrowser.Controller/Entities/Extensions.cs +++ b/MediaBrowser.Controller/Entities/Extensions.cs @@ -1,7 +1,6 @@ -using MediaBrowser.Model.Entities; using System; using System.Linq; -using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Entities { @@ -17,7 +16,7 @@ namespace MediaBrowser.Controller.Entities { if (string.IsNullOrEmpty(url)) { - throw new ArgumentNullException("url"); + throw new ArgumentNullException(nameof(url)); } var current = item.RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase)); @@ -35,7 +34,7 @@ namespace MediaBrowser.Controller.Entities } else { - item.RemoteTrailers = item.RemoteTrailers.Concat(new [] { mediaUrl }).ToArray(); + item.RemoteTrailers = item.RemoteTrailers.Concat(new[] { mediaUrl }).ToArray(); } } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index dbe30f9a5..2103e0045 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1,27 +1,23 @@ -using MediaBrowser.Common.Progress; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Progress; using MediaBrowser.Controller.Channels; +using MediaBrowser.Controller.Collections; +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.IO; -using MediaBrowser.Model.Channels; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Extensions; -using MediaBrowser.Controller.Collections; -using MediaBrowser.Controller.Configuration; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -51,80 +47,35 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsThemeMedia - { - get { return true; } - } + public override bool SupportsThemeMedia => true; [IgnoreDataMember] - public virtual bool IsPreSorted - { - get { return false; } - } + public virtual bool IsPreSorted => false; [IgnoreDataMember] - public virtual bool IsPhysicalRoot - { - get { return false; } - } + public virtual bool IsPhysicalRoot => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return true; - } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; /// <summary> /// Gets a value indicating whether this instance is folder. /// </summary> /// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public override bool IsFolder - { - get - { - return true; - } - } + public override bool IsFolder => true; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public virtual bool SupportsCumulativeRunTimeTicks - { - get - { - return false; - } - } + public virtual bool SupportsCumulativeRunTimeTicks => false; [IgnoreDataMember] - public virtual bool SupportsDateLastMediaAdded - { - get - { - return false; - } - } + public virtual bool SupportsDateLastMediaAdded => false; public override bool CanDelete() { @@ -176,10 +127,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected virtual bool SupportsShortcutChildren - { - get { return false; } - } + protected virtual bool SupportsShortcutChildren => false; /// <summary> /// Adds the child. @@ -187,7 +135,7 @@ namespace MediaBrowser.Controller.Entities /// <param name="item">The item.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> - /// <exception cref="System.InvalidOperationException">Unable to add + item.Name</exception> + /// <exception cref="InvalidOperationException">Unable to add + item.Name</exception> public void AddChild(BaseItem item, CancellationToken cancellationToken) { item.SetParent(this); @@ -214,23 +162,14 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The actual children.</value> [IgnoreDataMember] - public virtual IEnumerable<BaseItem> Children - { - get - { - return LoadChildren(); - } - } + public virtual IEnumerable<BaseItem> Children => LoadChildren(); /// <summary> /// thread-safe access to all recursive children of this folder - without regard to user /// </summary> /// <value>The recursive children.</value> [IgnoreDataMember] - public IEnumerable<BaseItem> RecursiveChildren - { - get { return GetRecursiveChildren(); } - } + public IEnumerable<BaseItem> RecursiveChildren => GetRecursiveChildren(); public override bool IsVisible(User user) { @@ -392,9 +331,7 @@ namespace MediaBrowser.Controller.Entities foreach (var child in nonCachedChildren) { - BaseItem currentChild; - - if (currentChildren.TryGetValue(child.Id, out currentChild)) + if (currentChildren.TryGetValue(child.Id, out BaseItem currentChild)) { validChildren.Add(currentChild); @@ -997,7 +934,7 @@ namespace MediaBrowser.Controller.Entities { if (items == null) { - throw new ArgumentNullException("items"); + throw new ArgumentNullException(nameof(items)); } if (CollapseBoxSetItems(query, queryParent, user, configurationManager)) @@ -1252,7 +1189,7 @@ namespace MediaBrowser.Controller.Entities { if (user == null) { - throw new ArgumentNullException(); + throw new ArgumentNullException(nameof(user)); } //the true root should return our users root folder children @@ -1322,7 +1259,7 @@ namespace MediaBrowser.Controller.Entities /// <param name="user">The user.</param> /// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param> /// <returns>IEnumerable{BaseItem}.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public IEnumerable<BaseItem> GetRecursiveChildren(User user, bool includeLinkedChildren = true) { return GetRecursiveChildren(user, null); @@ -1332,7 +1269,7 @@ namespace MediaBrowser.Controller.Entities { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } var result = new Dictionary<Guid, BaseItem>(); @@ -1425,13 +1362,7 @@ namespace MediaBrowser.Controller.Entities return list; } - protected virtual bool FilterLinkedChildrenPerUser - { - get - { - return false; - } - } + protected virtual bool FilterLinkedChildrenPerUser => false; public bool ContainsLinkedChildByItemId(Guid itemId) { @@ -1528,13 +1459,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected override bool SupportsOwnedItems - { - get - { - return base.SupportsOwnedItems || SupportsShortcutChildren; - } - } + protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren; protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken) { @@ -1705,7 +1630,7 @@ namespace MediaBrowser.Controller.Entities { get { - // These are just far too slow. + // These are just far too slow. if (this is ICollectionFolder) { return false; diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index 4efc5648e..82a4531ff 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; @@ -27,26 +27,17 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsThemeMedia - { - get { return true; } - } + public override bool SupportsThemeMedia => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return false; } - } + public override bool SupportsPeople => false; /// <summary> /// Gets the type of the media. /// </summary> /// <value>The type of the media.</value> [IgnoreDataMember] - public override string MediaType - { - get { return Model.Entities.MediaType.Game; } - } + public override string MediaType => Model.Entities.MediaType.Game; /// <summary> /// Gets or sets the players supported. diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs index ba178d3c3..c0fd4ae89 100644 --- a/MediaBrowser.Controller/Entities/GameGenre.cs +++ b/MediaBrowser.Controller/Entities/GameGenre.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Collections.Generic; -using MediaBrowser.Model.Serialization; using MediaBrowser.Controller.Extensions; +using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -32,22 +32,10 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override bool IsSaveLocalMetadataEnabled() { @@ -68,13 +56,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/GameSystem.cs b/MediaBrowser.Controller/Entities/GameSystem.cs index fb60ce83a..63f830d25 100644 --- a/MediaBrowser.Controller/Entities/GameSystem.cs +++ b/MediaBrowser.Controller/Entities/GameSystem.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.Serialization; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities @@ -18,31 +18,13 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The display prefs id.</value> [IgnoreDataMember] - public override Guid DisplayPreferencesId - { - get - { - return Id; - } - } + public override Guid DisplayPreferencesId => Id; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -90,12 +72,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs index 57ffe2744..3f3ab3551 100644 --- a/MediaBrowser.Controller/Entities/Genre.cs +++ b/MediaBrowser.Controller/Entities/Genre.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.Serialization; -using MediaBrowser.Controller.Entities.Audio; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Extensions; +using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -35,31 +35,13 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override bool IsSaveLocalMetadataEnabled() { @@ -80,13 +62,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/ICollectionFolder.cs b/MediaBrowser.Controller/Entities/ICollectionFolder.cs index b61e7b339..a6a9a0783 100644 --- a/MediaBrowser.Controller/Entities/ICollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/ICollectionFolder.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IHasAspectRatio.cs b/MediaBrowser.Controller/Entities/IHasAspectRatio.cs index 5aecf4eac..149c1e5ab 100644 --- a/MediaBrowser.Controller/Entities/IHasAspectRatio.cs +++ b/MediaBrowser.Controller/Entities/IHasAspectRatio.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.Entities +namespace MediaBrowser.Controller.Entities { /// <summary> /// Interface IHasAspectRatio diff --git a/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs b/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs index 5e1ae2179..abee75a28 100644 --- a/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs +++ b/MediaBrowser.Controller/Entities/IHasDisplayOrder.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Entities { /// <summary> diff --git a/MediaBrowser.Controller/Entities/IHasMediaSources.cs b/MediaBrowser.Controller/Entities/IHasMediaSources.cs index a13c95942..4635b9062 100644 --- a/MediaBrowser.Controller/Entities/IHasMediaSources.cs +++ b/MediaBrowser.Controller/Entities/IHasMediaSources.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Model.Dto; +using System; using System.Collections.Generic; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using System; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs b/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs index 0bc9ff81e..777b40828 100644 --- a/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs +++ b/MediaBrowser.Controller/Entities/IHasProgramAttributes.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.LiveTv; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IHasScreenshots.cs b/MediaBrowser.Controller/Entities/IHasScreenshots.cs index 2fd402bc2..0975242f5 100644 --- a/MediaBrowser.Controller/Entities/IHasScreenshots.cs +++ b/MediaBrowser.Controller/Entities/IHasScreenshots.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Entities { /// <summary> diff --git a/MediaBrowser.Controller/Entities/IHasSeries.cs b/MediaBrowser.Controller/Entities/IHasSeries.cs index 18d66452a..7da53f730 100644 --- a/MediaBrowser.Controller/Entities/IHasSeries.cs +++ b/MediaBrowser.Controller/Entities/IHasSeries.cs @@ -1,4 +1,3 @@ - using System; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs b/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs index f4905b7dc..688439e6c 100644 --- a/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs +++ b/MediaBrowser.Controller/Entities/IHasSpecialFeatures.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IHasStartDate.cs b/MediaBrowser.Controller/Entities/IHasStartDate.cs index a6714fb96..1ecde9af4 100644 --- a/MediaBrowser.Controller/Entities/IHasStartDate.cs +++ b/MediaBrowser.Controller/Entities/IHasStartDate.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IHasTrailers.cs b/MediaBrowser.Controller/Entities/IHasTrailers.cs index 8e7c4e007..3bdb9b64a 100644 --- a/MediaBrowser.Controller/Entities/IHasTrailers.cs +++ b/MediaBrowser.Controller/Entities/IHasTrailers.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Linq; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IItemByName.cs b/MediaBrowser.Controller/Entities/IItemByName.cs index d21c6ae4d..89b5dfee3 100644 --- a/MediaBrowser.Controller/Entities/IItemByName.cs +++ b/MediaBrowser.Controller/Entities/IItemByName.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/IMetadataContainer.cs b/MediaBrowser.Controller/Entities/IMetadataContainer.cs index 33aa08425..a384c0df3 100644 --- a/MediaBrowser.Controller/Entities/IMetadataContainer.cs +++ b/MediaBrowser.Controller/Entities/IMetadataContainer.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Providers; using System; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Providers; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs b/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs index fbe5a06d0..7d13bf325 100644 --- a/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs +++ b/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs @@ -1,9 +1,8 @@ - namespace MediaBrowser.Controller.Entities { /// <summary> /// Marker interface to denote a class that supports being hidden underneath it's boxset. - /// Just about anything can be placed into a boxset, + /// Just about anything can be placed into a boxset, /// but movies should also only appear underneath and not outside separately (subject to configuration). /// </summary> public interface ISupportsBoxSetGrouping diff --git a/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs index 2507c8ee6..3e96771c3 100644 --- a/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs +++ b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Entities { public interface ISupportsPlaceHolders diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index bb99c0a84..4b7af5391 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; -using MediaBrowser.Model.Configuration; using System.Linq; using MediaBrowser.Controller.Dto; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Entities { @@ -158,7 +158,7 @@ namespace MediaBrowser.Controller.Entities public bool EnableGroupByMetadataKey { get; set; } public bool? HasChapterImages { get; set; } - public ValueTuple<string, SortOrder>[] OrderBy { get; set; } + public ValueTuple<string, SortOrder>[] OrderBy { get; set; } public DateTime? MinDateCreated { get; set; } public DateTime? MinDateLastSaved { get; set; } diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs index ce3e9e070..1613531b5 100644 --- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/Entities/ItemImageInfo.cs b/MediaBrowser.Controller/Entities/ItemImageInfo.cs index bd0011c4b..ff6b13398 100644 --- a/MediaBrowser.Controller/Entities/ItemImageInfo.cs +++ b/MediaBrowser.Controller/Entities/ItemImageInfo.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.Entities; using System; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/Entities/LinkedChild.cs b/MediaBrowser.Controller/Entities/LinkedChild.cs index 363a3d6fd..bb2d03246 100644 --- a/MediaBrowser.Controller/Entities/LinkedChild.cs +++ b/MediaBrowser.Controller/Entities/LinkedChild.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index e888a5582..124a943ef 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -1,13 +1,12 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.Movies { @@ -26,28 +25,13 @@ namespace MediaBrowser.Controller.Entities.Movies } [IgnoreDataMember] - protected override bool FilterLinkedChildrenPerUser - { - get - { - return true; - } - } + protected override bool FilterLinkedChildrenPerUser => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; public Guid[] LocalTrailerIds { get; set; } public Guid[] RemoteTrailerIds { get; set; } @@ -64,7 +48,7 @@ namespace MediaBrowser.Controller.Entities.Movies } public override double GetDefaultPrimaryImageAspectRatio() - => 2 / 3; + => 2.0 / 3; public override UnratedItem GetBlockUnratedType() { @@ -111,13 +95,7 @@ namespace MediaBrowser.Controller.Entities.Movies } [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; public override bool IsAuthorizedToDelete(User user, List<Folder> allCollectionFolders) { diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 4f743991b..232d11624 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; @@ -21,10 +21,10 @@ namespace MediaBrowser.Controller.Entities.Movies public Movie() { - SpecialFeatureIds = new Guid[] {}; + SpecialFeatureIds = new Guid[] { }; RemoteTrailers = EmptyMediaUrlArray; - LocalTrailerIds = new Guid[] {}; - RemoteTrailerIds = new Guid[] {}; + LocalTrailerIds = new Guid[] { }; + RemoteTrailerIds = new Guid[] { }; } public Guid[] LocalTrailerIds { get; set; } @@ -39,8 +39,8 @@ namespace MediaBrowser.Controller.Entities.Movies [IgnoreDataMember] public string CollectionName { - get { return TmdbCollectionName; } - set { TmdbCollectionName = value; } + get => TmdbCollectionName; + set => TmdbCollectionName = value; } public override double GetDefaultPrimaryImageAspectRatio() @@ -51,7 +51,7 @@ namespace MediaBrowser.Controller.Entities.Movies return 0; } - return 2 / 3; + return 2.0 / 3; } protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken) @@ -184,13 +184,6 @@ namespace MediaBrowser.Controller.Entities.Movies } [IgnoreDataMember] - public override bool StopRefreshIfLocalMetadataFound - { - get - { - // Need people id's from internet metadata - return false; - } - } + public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs index 4015a1178..5bf082b7e 100644 --- a/MediaBrowser.Controller/Entities/MusicVideo.cs +++ b/MediaBrowser.Controller/Entities/MusicVideo.cs @@ -1,9 +1,8 @@ -using MediaBrowser.Controller.Entities.Audio; +using System; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using System.Collections.Generic; using MediaBrowser.Model.Serialization; -using System; namespace MediaBrowser.Controller.Entities { @@ -18,13 +17,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public string[] AllArtists - { - get - { - return Artists; - } - } + public string[] AllArtists => Artists; public override UnratedItem GetBlockUnratedType() { diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.cs index 9f85b2aea..2fb613768 100644 --- a/MediaBrowser.Controller/Entities/PeopleHelper.cs +++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Linq; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Entities { @@ -11,12 +11,12 @@ namespace MediaBrowser.Controller.Entities { if (person == null) { - throw new ArgumentNullException("person"); + throw new ArgumentNullException(nameof(person)); } if (string.IsNullOrEmpty(person.Name)) { - throw new ArgumentNullException(); + throw new ArgumentException("The person's name was empty or null.", nameof(person)); } // Normalize @@ -103,7 +103,7 @@ namespace MediaBrowser.Controller.Entities { if (string.IsNullOrEmpty(name)) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } foreach (var i in people) diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index 5c35a7411..dd0183489 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Providers; using System; using System.Collections.Generic; using MediaBrowser.Controller.Extensions; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; @@ -51,13 +51,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; public override bool CanDelete() { @@ -70,31 +64,13 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool EnableAlphaNumericSorting - { - get - { - return false; - } - } + public override bool EnableAlphaNumericSorting => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public static string GetPath(string name) { @@ -199,9 +175,9 @@ namespace MediaBrowser.Controller.Entities public Dictionary<string, string> ProviderIds { get; set; } /// <summary> - /// Returns a <see cref="System.String" /> that represents this instance. + /// Returns a <see cref="string" /> that represents this instance. /// </summary> - /// <returns>A <see cref="System.String" /> that represents this instance.</returns> + /// <returns>A <see cref="string" /> that represents this instance.</returns> public override string ToString() { return Name; diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index 662aa4249..60c832189 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Drawing; +using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities @@ -6,31 +6,13 @@ namespace MediaBrowser.Controller.Entities public class Photo : BaseItem { [IgnoreDataMember] - public override bool SupportsLocalMetadata - { - get - { - return false; - } - } + public override bool SupportsLocalMetadata => false; [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Photo; - } - } + public override string MediaType => Model.Entities.MediaType.Photo; [IgnoreDataMember] - public override Folder LatestItemsIndexContainer - { - get - { - return AlbumEntity; - } - } + public override Folder LatestItemsIndexContainer => AlbumEntity; [IgnoreDataMember] @@ -79,8 +61,7 @@ namespace MediaBrowser.Controller.Entities } } - width /= Height.Value; - return width; + return width / height; } return base.GetDefaultPrimaryImageAspectRatio(); diff --git a/MediaBrowser.Controller/Entities/PhotoAlbum.cs b/MediaBrowser.Controller/Entities/PhotoAlbum.cs index af9d8c801..4cd0c8b66 100644 --- a/MediaBrowser.Controller/Entities/PhotoAlbum.cs +++ b/MediaBrowser.Controller/Entities/PhotoAlbum.cs @@ -1,34 +1,16 @@ -using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { public class PhotoAlbum : Folder { [IgnoreDataMember] - public override bool AlwaysScanInternalMetadataPath - { - get - { - return true; - } - } + public override bool AlwaysScanInternalMetadataPath => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; } } diff --git a/MediaBrowser.Controller/Entities/Share.cs b/MediaBrowser.Controller/Entities/Share.cs index 4ea0b1ea6..c17789ccc 100644 --- a/MediaBrowser.Controller/Entities/Share.cs +++ b/MediaBrowser.Controller/Entities/Share.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; - namespace MediaBrowser.Controller.Entities { public interface IHasShares diff --git a/MediaBrowser.Controller/Entities/SourceType.cs b/MediaBrowser.Controller/Entities/SourceType.cs index 9c307b4e6..927483b93 100644 --- a/MediaBrowser.Controller/Entities/SourceType.cs +++ b/MediaBrowser.Controller/Entities/SourceType.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Entities { public enum SourceType diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs index c076cd680..d6da0d48c 100644 --- a/MediaBrowser.Controller/Entities/Studio.cs +++ b/MediaBrowser.Controller/Entities/Studio.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Collections.Generic; -using MediaBrowser.Model.Serialization; using MediaBrowser.Controller.Extensions; +using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -29,31 +29,13 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -81,13 +63,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 00e055c51..072b1d89a 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; @@ -47,61 +47,25 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - protected override bool SupportsOwnedItems - { - get - { - return IsStacked || MediaSourceCount > 1; - } - } + protected override bool SupportsOwnedItems => IsStacked || MediaSourceCount > 1; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; [IgnoreDataMember] - public int? AiredSeasonNumber - { - get - { - return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber; - } - } + public int? AiredSeasonNumber => AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber; [IgnoreDataMember] - public override Folder LatestItemsIndexContainer - { - get - { - return Series; - } - } + public override Folder LatestItemsIndexContainer => Series; [IgnoreDataMember] - public override Guid DisplayParentId - { - get - { - return SeasonId; - } - } + public override Guid DisplayParentId => SeasonId; [IgnoreDataMember] - protected override bool EnableDefaultVideoUserDataKeys - { - get - { - return false; - } - } + protected override bool EnableDefaultVideoUserDataKeys => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -111,7 +75,7 @@ namespace MediaBrowser.Controller.Entities.TV return 0; } - return 16 / 9; + return 16.0 / 9; } public override List<string> GetUserDataKeys() @@ -143,7 +107,8 @@ namespace MediaBrowser.Controller.Entities.TV get { var seriesId = SeriesId; - if (seriesId.Equals(Guid.Empty)) { + if (seriesId.Equals(Guid.Empty)) + { seriesId = FindSeriesId(); } return !seriesId.Equals(Guid.Empty) ? (LibraryManager.GetItemById(seriesId) as Series) : null; @@ -156,7 +121,8 @@ namespace MediaBrowser.Controller.Entities.TV get { var seasonId = SeasonId; - if (seasonId.Equals(Guid.Empty)) { + if (seasonId.Equals(Guid.Empty)) + { seasonId = FindSeasonId(); } return !seasonId.Equals(Guid.Empty) ? (LibraryManager.GetItemById(seasonId) as Season) : null; @@ -164,13 +130,7 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public bool IsInSeasonFolder - { - get - { - return FindParent<Season>() != null; - } - } + public bool IsInSeasonFolder => FindParent<Season>() != null; [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } @@ -276,13 +236,7 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public bool IsMissingEpisode - { - get - { - return LocationType == LocationType.Virtual; - } - } + public bool IsMissingEpisode => LocationType == LocationType.Virtual; [IgnoreDataMember] public Guid SeasonId { get; set; } diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index cb3a7f345..b40009e0c 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -1,13 +1,12 @@ -using System; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Users; +using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.TV { @@ -17,46 +16,22 @@ namespace MediaBrowser.Controller.Entities.TV public class Season : Folder, IHasSeries, IHasLookupInfo<SeasonInfo> { [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; [IgnoreDataMember] - public override bool SupportsDateLastMediaAdded - { - get - { - return false; - } - } + public override bool SupportsDateLastMediaAdded => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public override Guid DisplayParentId - { - get { return SeriesId; } - } + public override Guid DisplayParentId => SeriesId; public override double GetDefaultPrimaryImageAspectRatio() { diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index d4a62626e..4539ab0f2 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -1,17 +1,17 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Providers; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Entities.TV { @@ -32,43 +32,19 @@ namespace MediaBrowser.Controller.Entities.TV public string AirTime { get; set; } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; [IgnoreDataMember] - public override bool SupportsDateLastMediaAdded - { - get - { - return true; - } - } + public override bool SupportsDateLastMediaAdded => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; public Guid[] LocalTrailerIds { get; set; } public Guid[] RemoteTrailerIds { get; set; } @@ -143,7 +119,7 @@ namespace MediaBrowser.Controller.Entities.TV IncludeItemTypes = new[] { typeof(Season).Name }, IsVirtualItem = false, Limit = 0, - DtoOptions = new Dto.DtoOptions(false) + DtoOptions = new DtoOptions(false) { EnableImages = false } @@ -160,7 +136,7 @@ namespace MediaBrowser.Controller.Entities.TV { AncestorWithPresentationUniqueKey = null, SeriesPresentationUniqueKey = seriesKey, - DtoOptions = new Dto.DtoOptions(false) + DtoOptions = new DtoOptions(false) { EnableImages = false } @@ -526,13 +502,6 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public override bool StopRefreshIfLocalMetadataFound - { - get - { - // Need people id's from internet metadata - return false; - } - } + public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/TagExtensions.cs b/MediaBrowser.Controller/Entities/TagExtensions.cs index 84e61be4f..97f590635 100644 --- a/MediaBrowser.Controller/Entities/TagExtensions.cs +++ b/MediaBrowser.Controller/Entities/TagExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; namespace MediaBrowser.Controller.Entities @@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Entities { if (string.IsNullOrWhiteSpace(name)) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } var current = item.Tags; @@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Entities } else { - item.Tags = current.Concat(new [] { name }).ToArray(); + item.Tags = current.Concat(new[] { name }).ToArray(); } } } diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 2ef268ed1..5bf22d7bc 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Controller.Providers; +using System; +using System.Collections.Generic; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -using System.Collections.Generic; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; -using System; namespace MediaBrowser.Controller.Entities { @@ -21,7 +21,7 @@ namespace MediaBrowser.Controller.Entities public TrailerType[] TrailerTypes { get; set; } public override double GetDefaultPrimaryImageAspectRatio() - => 2 / 3; + => 2.0 / 3; public override UnratedItem GetBlockUnratedType() { @@ -94,13 +94,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool StopRefreshIfLocalMetadataFound - { - get - { - // Need people id's from internet metadata - return false; - } - } + public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index f569c8021..10fe096a4 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -1,12 +1,12 @@ -using MediaBrowser.Controller.Library; +using System; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Connect; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; -using System; -using System.Threading; -using System.Threading.Tasks; namespace MediaBrowser.Controller.Entities { @@ -19,7 +19,7 @@ namespace MediaBrowser.Controller.Entities public static IXmlSerializer XmlSerializer { get; set; } /// <summary> - /// From now on all user paths will be Id-based. + /// From now on all user paths will be Id-based. /// This is for backwards compatibility. /// </summary> public bool UsesIdForConfigurationPath { get; set; } @@ -40,14 +40,8 @@ namespace MediaBrowser.Controller.Entities // Strictly to remove IgnoreDataMember public override ItemImageInfo[] ImageInfos { - get - { - return base.ImageInfos; - } - set - { - base.ImageInfos = value; - } + get => base.ImageInfos; + set => base.ImageInfos = value; } /// <summary> @@ -57,15 +51,8 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public override string Path { - get - { - // Return this so that metadata providers will look in here - return ConfigurationDirectoryPath; - } - set - { - base.Path = value; - } + get => ConfigurationDirectoryPath; + set => base.Path = value; } private string _name; @@ -75,10 +62,7 @@ namespace MediaBrowser.Controller.Entities /// <value>The name.</value> public override string Name { - get - { - return _name; - } + get => _name; set { _name = value; @@ -94,26 +78,14 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; /// <summary> /// Gets the root folder. /// </summary> /// <value>The root folder.</value> [IgnoreDataMember] - public Folder RootFolder - { - get - { - return LibraryManager.GetUserRootFolder(); - } - } + public Folder RootFolder => LibraryManager.GetUserRootFolder(); /// <summary> /// Gets or sets the last login date. @@ -146,7 +118,7 @@ namespace MediaBrowser.Controller.Entities return _config; } - set { _config = value; } + set => _config = value; } private volatile UserPolicy _policy; @@ -169,7 +141,7 @@ namespace MediaBrowser.Controller.Entities return _policy; } - set { _policy = value; } + set => _policy = value; } /// <summary> @@ -177,12 +149,12 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <param name="newName">The new name.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public Task Rename(string newName) { if (string.IsNullOrEmpty(newName)) { - throw new ArgumentNullException("newName"); + throw new ArgumentNullException(nameof(newName)); } // If only the casing is changing, leave the file system alone @@ -232,13 +204,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The configuration directory path.</value> [IgnoreDataMember] - public string ConfigurationDirectoryPath - { - get - { - return GetConfigurationDirectoryPath(Name); - } - } + public string ConfigurationDirectoryPath => GetConfigurationDirectoryPath(Name); public override double GetDefaultPrimaryImageAspectRatio() { @@ -259,7 +225,7 @@ namespace MediaBrowser.Controller.Entities { if (string.IsNullOrEmpty(username)) { - throw new ArgumentNullException("username"); + throw new ArgumentNullException(nameof(username)); } var safeFolderName = FileSystem.GetValidFilename(username); @@ -327,15 +293,9 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; - public long InternalId { get; set;} + public long InternalId { get; set; } } diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs index 0e1326949..f7136bdf2 100644 --- a/MediaBrowser.Controller/Entities/UserItemData.cs +++ b/MediaBrowser.Controller/Entities/UserItemData.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities @@ -28,20 +28,17 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the users 0-10 rating /// </summary> /// <value>The rating.</value> - /// <exception cref="System.ArgumentOutOfRangeException">Rating;A 0 to 10 rating is required for UserItemData.</exception> + /// <exception cref="ArgumentOutOfRangeException">Rating;A 0 to 10 rating is required for UserItemData.</exception> public double? Rating { - get - { - return _rating; - } + get => _rating; set { if (value.HasValue) { if (value.Value < 0 || value.Value > 10) { - throw new ArgumentOutOfRangeException("value", "A 0 to 10 rating is required for UserItemData."); + throw new ArgumentOutOfRangeException(nameof(value), "A 0 to 10 rating is required for UserItemData."); } } @@ -90,7 +87,7 @@ namespace MediaBrowser.Controller.Entities public int? SubtitleStreamIndex { get; set; } public const double MinLikeValue = 6.5; - + /// <summary> /// This is an interpreted property to indicate likes or dislikes /// This should never be serialized. diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index f8e843d92..7fe8df8af 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -1,12 +1,12 @@ -using MediaBrowser.Model.Serialization; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Library; -using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Library; +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -34,22 +34,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; private void ClearCache() { @@ -78,7 +66,7 @@ namespace MediaBrowser.Controller.Entities return new QueryResult<BaseItem> { TotalRecordCount = totalCount, - Items = itemsArray + Items = itemsArray //TODO Fix The co-variant conversion between Folder[] and BaseItem[], this can generate runtime issues. }; } @@ -88,22 +76,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected override bool SupportsShortcutChildren - { - get - { - return true; - } - } + protected override bool SupportsShortcutChildren => true; [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user) { diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index b7c9884ff..de4105df9 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Controller.Playlists; -using MediaBrowser.Controller.TV; -using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; using System.Linq; -using MediaBrowser.Model.Serialization; using System.Threading.Tasks; +using MediaBrowser.Controller.Playlists; +using MediaBrowser.Controller.TV; +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { @@ -20,13 +20,7 @@ namespace MediaBrowser.Controller.Entities public static IPlaylistManager PlaylistManager; [IgnoreDataMember] - public string CollectionType - { - get - { - return ViewType; - } - } + public string CollectionType => ViewType; public override IEnumerable<Guid> GetIdsForAncestorQuery() { @@ -48,22 +42,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; public override int GetChildCount(User user) { @@ -188,12 +170,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index b50a12d52..6f98fcd8d 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -1,20 +1,15 @@ -using MediaBrowser.Controller.Entities.Audio; +using System; +using System.Collections.Generic; +using System.Linq; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.TV; using MediaBrowser.Model.Entities; -using Microsoft.Extensions.Logging; using MediaBrowser.Model.Querying; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Collections; -using MediaBrowser.Model.Extensions; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities { @@ -412,7 +407,7 @@ namespace MediaBrowser.Controller.Entities { return new QueryResult<BaseItem> { - Items = result.Items, + 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 }; } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 2db200ee2..dd4440c3b 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -1,20 +1,19 @@ -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Controller.Providers; -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 System.Threading.Tasks; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.LiveTv; +using MediaBrowser.Controller.MediaEncoding; +using MediaBrowser.Controller.Persistence; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; +using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Extensions; -using MediaBrowser.Controller.MediaEncoding; -using MediaBrowser.Controller.LiveTv; namespace MediaBrowser.Controller.Entities { @@ -34,28 +33,13 @@ namespace MediaBrowser.Controller.Entities public LinkedChild[] LinkedAlternateVersions { get; set; } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return true; - } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] public override bool SupportsPositionTicksResume @@ -107,10 +91,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsThemeMedia - { - get { return true; } - } + public override bool SupportsThemeMedia => true; /// <summary> /// Gets or sets the timestamp. @@ -200,10 +181,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] public int MediaSourceCount @@ -223,16 +201,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public bool IsStacked - { - get { return AdditionalParts.Length > 0; } - } + public bool IsStacked => AdditionalParts.Length > 0; [IgnoreDataMember] - public override bool HasLocalAlternateVersions - { - get { return LocalAlternateVersions.Length > 0; } - } + public override bool HasLocalAlternateVersions => LocalAlternateVersions.Length > 0; public IEnumerable<Guid> GetAdditionalPartIds() { @@ -290,13 +262,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected virtual bool EnableDefaultVideoUserDataKeys - { - get - { - return true; - } - } + protected virtual bool EnableDefaultVideoUserDataKeys => true; public override List<string> GetUserDataKeys() { @@ -467,23 +433,14 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value><c>true</c> if [is3 D]; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool Is3D - { - get { return Video3DFormat.HasValue; } - } + public bool Is3D => Video3DFormat.HasValue; /// <summary> /// Gets the type of the media. /// </summary> /// <value>The type of the media.</value> [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Video; - } - } + public override string MediaType => Model.Entities.MediaType.Video; protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs index 8e3cd0b70..13e82fada 100644 --- a/MediaBrowser.Controller/Entities/Year.cs +++ b/MediaBrowser.Controller/Entities/Year.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using MediaBrowser.Model.Serialization; @@ -25,13 +25,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; public override double GetDefaultPrimaryImageAspectRatio() { @@ -42,13 +36,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override bool CanDelete() { @@ -62,11 +50,9 @@ namespace MediaBrowser.Controller.Entities public IList<BaseItem> GetTaggedItems(InternalItemsQuery query) { - int year; - var usCulture = new CultureInfo("en-US"); - if (!int.TryParse(Name, NumberStyles.Integer, usCulture, out year)) + if (!int.TryParse(Name, NumberStyles.Integer, usCulture, out var year)) { return new List<BaseItem>(); } @@ -78,24 +64,16 @@ namespace MediaBrowser.Controller.Entities public int? GetYearValue() { - int i; - - if (int.TryParse(Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out i)) + if (int.TryParse(Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out var year)) { - return i; + return year; } return null; } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Extensions/StringExtensions.cs b/MediaBrowser.Controller/Extensions/StringExtensions.cs index 60e7815db..73f529fc0 100644 --- a/MediaBrowser.Controller/Extensions/StringExtensions.cs +++ b/MediaBrowser.Controller/Extensions/StringExtensions.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Globalization; +using MediaBrowser.Model.Globalization; namespace MediaBrowser.Controller.Extensions { diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index c0cf51ab2..4bbb60283 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.IO; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.IO { @@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.IO /// <param name="flattenFolderDepth">The flatten folder depth.</param> /// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param> /// <returns>Dictionary{System.StringFileSystemInfo}.</returns> - /// <exception cref="System.ArgumentNullException">path</exception> + /// <exception cref="ArgumentNullException">path</exception> public static FileSystemMetadata[] GetFilteredFileSystemEntries(IDirectoryService directoryService, string path, IFileSystem fileSystem, @@ -46,11 +46,11 @@ namespace MediaBrowser.Controller.IO { if (string.IsNullOrEmpty(path)) { - throw new ArgumentNullException("path"); + throw new ArgumentNullException(nameof(path)); } if (args == null) { - throw new ArgumentNullException("args"); + throw new ArgumentNullException(nameof(args)); } var entries = directoryService.GetFileSystemEntries(path); diff --git a/MediaBrowser.Controller/IResourceFileManager.cs b/MediaBrowser.Controller/IResourceFileManager.cs index 64f1b9f7a..f70ea6a17 100644 --- a/MediaBrowser.Controller/IResourceFileManager.cs +++ b/MediaBrowser.Controller/IResourceFileManager.cs @@ -1,22 +1,6 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Net; -using MediaBrowser.Controller.Plugins; -using MediaBrowser.Model.Extensions; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Serialization; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading.Tasks; -using MediaBrowser.Common.Plugins; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Globalization; -using MediaBrowser.Model.Plugins; -using MediaBrowser.Model.Reflection; using MediaBrowser.Model.Services; namespace MediaBrowser.Controller diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index 830c160e3..22797aa0d 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -1,11 +1,10 @@ -using MediaBrowser.Common; -using MediaBrowser.Model.System; using System; using System.Collections.Generic; -using System.Net; +using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common; using MediaBrowser.Model.Net; -using System.Threading; +using MediaBrowser.Model.System; namespace MediaBrowser.Controller { @@ -24,12 +23,6 @@ namespace MediaBrowser.Controller Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken); - /// <summary> - /// Gets a value indicating whether [supports automatic run at startup]. - /// </summary> - /// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value> - bool SupportsAutoRunAtStartup { get; } - bool CanLaunchWebBrowser { get; } /// <summary> @@ -43,7 +36,7 @@ namespace MediaBrowser.Controller /// </summary> /// <value>The HTTPS port.</value> int HttpsPort { get; } - + /// <summary> /// Gets a value indicating whether [supports HTTPS]. /// </summary> diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs index 5fb7968dd..2b43513b7 100644 --- a/MediaBrowser.Controller/IServerApplicationPaths.cs +++ b/MediaBrowser.Controller/IServerApplicationPaths.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; namespace MediaBrowser.Controller { @@ -12,11 +12,10 @@ namespace MediaBrowser.Controller /// <summary> /// Gets the application resources path. This is the path to the folder containing resources that are deployed as part of the application - /// For example, this folder contains dashboard-ui and swagger-ui /// </summary> /// <value>The application resources path.</value> string ApplicationResourcesPath { get; } - + /// <summary> /// Gets the path to the default user view directory. Used if no specific user view is defined. /// </summary> @@ -106,4 +105,4 @@ namespace MediaBrowser.Controller string GetTranscodingTempPath(); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Library/DeleteOptions.cs b/MediaBrowser.Controller/Library/DeleteOptions.cs index 822fc3dc3..751b90481 100644 --- a/MediaBrowser.Controller/Library/DeleteOptions.cs +++ b/MediaBrowser.Controller/Library/DeleteOptions.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Library { public class DeleteOptions diff --git a/MediaBrowser.Controller/Library/IIntroProvider.cs b/MediaBrowser.Controller/Library/IIntroProvider.cs index 611aab387..d9d1ca8c7 100644 --- a/MediaBrowser.Controller/Library/IIntroProvider.cs +++ b/MediaBrowser.Controller/Library/IIntroProvider.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Controller.Entities; using System.Collections.Generic; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index d572716fa..9d404ba1a 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -1,22 +1,19 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Controller.Resolvers; -using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; - -using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.IO; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; +using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Resolvers; +using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.Library { @@ -103,7 +100,7 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="value">The value.</param> /// <returns>Task{Year}.</returns> - /// <exception cref="System.ArgumentOutOfRangeException"></exception> + /// <exception cref="ArgumentOutOfRangeException"></exception> Year GetYear(int value); /// <summary> @@ -163,7 +160,6 @@ namespace MediaBrowser.Controller.Library /// Adds the parts. /// </summary> /// <param name="rules">The rules.</param> - /// <param name="pluginFolders">The plugin folders.</param> /// <param name="resolvers">The resolvers.</param> /// <param name="introProviders">The intro providers.</param> /// <param name="itemComparers">The item comparers.</param> @@ -298,7 +294,7 @@ namespace MediaBrowser.Controller.Library string name, Guid parentId, string viewType, - string sortNamen); + string sortName); /// <summary> /// Gets the named view. @@ -547,4 +543,4 @@ namespace MediaBrowser.Controller.Library string videoPath, string[] files); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Library/ILibraryMonitor.cs b/MediaBrowser.Controller/Library/ILibraryMonitor.cs index e965e47d6..233cfb197 100644 --- a/MediaBrowser.Controller/Library/ILibraryMonitor.cs +++ b/MediaBrowser.Controller/Library/ILibraryMonitor.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Library { @@ -40,4 +40,4 @@ namespace MediaBrowser.Controller.Library /// <returns><c>true</c> if [is path locked] [the specified path]; otherwise, <c>false</c>.</returns> bool IsPathLocked(string path); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Library/ILibraryPostScanTask.cs b/MediaBrowser.Controller/Library/ILibraryPostScanTask.cs index 694422907..cba5e8fd7 100644 --- a/MediaBrowser.Controller/Library/ILibraryPostScanTask.cs +++ b/MediaBrowser.Controller/Library/ILibraryPostScanTask.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Controller/Library/ILiveStream.cs b/MediaBrowser.Controller/Library/ILiveStream.cs index e00da7340..734932f17 100644 --- a/MediaBrowser.Controller/Library/ILiveStream.cs +++ b/MediaBrowser.Controller/Library/ILiveStream.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Dto; diff --git a/MediaBrowser.Controller/Library/IMediaSourceManager.cs b/MediaBrowser.Controller/Library/IMediaSourceManager.cs index 8541c4fd9..fbae4edb0 100644 --- a/MediaBrowser.Controller/Library/IMediaSourceManager.cs +++ b/MediaBrowser.Controller/Library/IMediaSourceManager.cs @@ -1,13 +1,13 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; +using System.IO; using System.Threading; using System.Threading.Tasks; -using System.IO; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Persistence; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/IMediaSourceProvider.cs b/MediaBrowser.Controller/Library/IMediaSourceProvider.cs index eec138532..9e74879fc 100644 --- a/MediaBrowser.Controller/Library/IMediaSourceProvider.cs +++ b/MediaBrowser.Controller/Library/IMediaSourceProvider.cs @@ -1,9 +1,8 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Dto; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using System; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/IMetadataFileSaver.cs b/MediaBrowser.Controller/Library/IMetadataFileSaver.cs index e66fbcbc8..5b92388ce 100644 --- a/MediaBrowser.Controller/Library/IMetadataFileSaver.cs +++ b/MediaBrowser.Controller/Library/IMetadataFileSaver.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Library { @@ -16,4 +16,4 @@ namespace MediaBrowser.Controller.Library { bool IsEnabled { get; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Library/IMetadataSaver.cs b/MediaBrowser.Controller/Library/IMetadataSaver.cs index f71afa656..dd119984e 100644 --- a/MediaBrowser.Controller/Library/IMetadataSaver.cs +++ b/MediaBrowser.Controller/Library/IMetadataSaver.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Controller.Entities; using System.Threading; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/IMusicManager.cs b/MediaBrowser.Controller/Library/IMusicManager.cs index 535e6df7e..554dd0895 100644 --- a/MediaBrowser.Controller/Library/IMusicManager.cs +++ b/MediaBrowser.Controller/Library/IMusicManager.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; using System.Collections.Generic; using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/ISearchEngine.cs b/MediaBrowser.Controller/Library/ISearchEngine.cs index 715f16407..8498b92ae 100644 --- a/MediaBrowser.Controller/Library/ISearchEngine.cs +++ b/MediaBrowser.Controller/Library/ISearchEngine.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Search; namespace MediaBrowser.Controller.Library diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.cs index f3f81378b..ce4e3f530 100644 --- a/MediaBrowser.Controller/Library/IUserDataManager.cs +++ b/MediaBrowser.Controller/Library/IUserDataManager.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Threading; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using System; -using System.Threading; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index d29b164ef..925d91a37 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -1,13 +1,13 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Events; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.Users; using MediaBrowser.Controller.Authentication; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Library { @@ -43,7 +43,7 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="id">The id.</param> /// <returns>User.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> User GetUserById(Guid id); /// <summary> @@ -73,16 +73,16 @@ namespace MediaBrowser.Controller.Library /// <param name="user">The user.</param> /// <param name="newName">The new name.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">user</exception> - /// <exception cref="System.ArgumentException"></exception> + /// <exception cref="ArgumentNullException">user</exception> + /// <exception cref="ArgumentException"></exception> Task RenameUser(User user, string newName); /// <summary> /// Updates the user. /// </summary> /// <param name="user">The user.</param> - /// <exception cref="System.ArgumentNullException">user</exception> - /// <exception cref="System.ArgumentException"></exception> + /// <exception cref="ArgumentNullException">user</exception> + /// <exception cref="ArgumentException"></exception> void UpdateUser(User user); /// <summary> @@ -90,8 +90,8 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="name">The name.</param> /// <returns>User.</returns> - /// <exception cref="System.ArgumentNullException">name</exception> - /// <exception cref="System.ArgumentException"></exception> + /// <exception cref="ArgumentNullException">name</exception> + /// <exception cref="ArgumentException"></exception> Task<User> CreateUser(string name); /// <summary> @@ -99,8 +99,8 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="user">The user.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">user</exception> - /// <exception cref="System.ArgumentException"></exception> + /// <exception cref="ArgumentNullException">user</exception> + /// <exception cref="ArgumentException"></exception> Task DeleteUser(User user); /// <summary> @@ -123,7 +123,7 @@ namespace MediaBrowser.Controller.Library /// <param name="user">The user.</param> /// <returns>Task.</returns> void ResetEasyPassword(User user); - + /// <summary> /// Changes the password. /// </summary> @@ -133,7 +133,7 @@ namespace MediaBrowser.Controller.Library /// Changes the easy password. /// </summary> void ChangeEasyPassword(User user, string newPassword, string newPasswordSha1); - + /// <summary> /// Gets the user dto. /// </summary> diff --git a/MediaBrowser.Controller/Library/IUserViewManager.cs b/MediaBrowser.Controller/Library/IUserViewManager.cs index f4649777c..0d7da7579 100644 --- a/MediaBrowser.Controller/Library/IUserViewManager.cs +++ b/MediaBrowser.Controller/Library/IUserViewManager.cs @@ -1,11 +1,9 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Library; -using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Library; +using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/IntroInfo.cs b/MediaBrowser.Controller/Library/IntroInfo.cs index d0e61d0f0..0e761d549 100644 --- a/MediaBrowser.Controller/Library/IntroInfo.cs +++ b/MediaBrowser.Controller/Library/IntroInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Library { @@ -16,4 +16,4 @@ namespace MediaBrowser.Controller.Library /// <value>The item id.</value> public Guid? ItemId { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Library/ItemChangeEventArgs.cs b/MediaBrowser.Controller/Library/ItemChangeEventArgs.cs index e671490d3..c9671de47 100644 --- a/MediaBrowser.Controller/Library/ItemChangeEventArgs.cs +++ b/MediaBrowser.Controller/Library/ItemChangeEventArgs.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 9812802e7..7bb8325f8 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; using System; using System.Collections.Generic; using System.Linq; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.IO; @@ -67,13 +67,7 @@ namespace MediaBrowser.Controller.Library /// Gets a value indicating whether this instance is directory. /// </summary> /// <value><c>true</c> if this instance is directory; otherwise, <c>false</c>.</value> - public bool IsDirectory - { - get - { - return FileInfo.IsDirectory; - } - } + public bool IsDirectory => FileInfo.IsDirectory; /// <summary> /// Gets a value indicating whether this instance is vf. @@ -103,13 +97,7 @@ namespace MediaBrowser.Controller.Library /// Gets a value indicating whether this instance is physical root. /// </summary> /// <value><c>true</c> if this instance is physical root; otherwise, <c>false</c>.</value> - public bool IsPhysicalRoot - { - get - { - return IsDirectory && BaseItem.FileSystem.AreEqual(Path, _appPaths.RootFolderPath); - } - } + public bool IsPhysicalRoot => IsDirectory && BaseItem.FileSystem.AreEqual(Path, _appPaths.RootFolderPath); /// <summary> /// Gets or sets the additional locations. @@ -126,7 +114,7 @@ namespace MediaBrowser.Controller.Library { var item = parent as T; - // Just in case the user decided to nest episodes. + // Just in case the user decided to nest episodes. // Not officially supported but in some cases we can handle it. if (item == null) { @@ -150,12 +138,12 @@ namespace MediaBrowser.Controller.Library /// Adds the additional location. /// </summary> /// <param name="path">The path.</param> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public void AddAdditionalLocation(string path) { if (string.IsNullOrEmpty(path)) { - throw new ArgumentNullException(); + throw new ArgumentException("The path was empty or null.", nameof(path)); } if (AdditionalLocations == null) @@ -185,12 +173,12 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="name">The name.</param> /// <returns>FileSystemInfo.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public FileSystemMetadata GetFileSystemEntryByName(string name) { if (string.IsNullOrEmpty(name)) { - throw new ArgumentNullException(); + throw new ArgumentException("The name was empty or null.", nameof(name)); } return GetFileSystemEntryByPath(System.IO.Path.Combine(Path, name)); @@ -201,12 +189,12 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="path">The path.</param> /// <returns>FileSystemInfo.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> public FileSystemMetadata GetFileSystemEntryByPath(string path) { if (string.IsNullOrEmpty(path)) { - throw new ArgumentNullException(); + throw new ArgumentException("The path was empty or null.", nameof(path)); } foreach (var file in FileSystemChildren) @@ -240,10 +228,10 @@ namespace MediaBrowser.Controller.Library #region Equality Overrides /// <summary> - /// Determines whether the specified <see cref="System.Object" /> is equal to this instance. + /// Determines whether the specified <see cref="object" /> is equal to this instance. /// </summary> /// <param name="obj">The object to compare with the current object.</param> - /// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns> + /// <returns><c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.</returns> public override bool Equals(object obj) { return Equals(obj as ItemResolveArgs); diff --git a/MediaBrowser.Controller/Library/ItemUpdateType.cs b/MediaBrowser.Controller/Library/ItemUpdateType.cs index cf6263356..b62f314ba 100644 --- a/MediaBrowser.Controller/Library/ItemUpdateType.cs +++ b/MediaBrowser.Controller/Library/ItemUpdateType.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs b/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs index ec69bea6e..037b0b62c 100644 --- a/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs +++ b/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Library @@ -10,4 +10,4 @@ namespace MediaBrowser.Controller.Library return manager.GetItemById(new Guid(id)); } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Library/MetadataConfigurationStore.cs b/MediaBrowser.Controller/Library/MetadataConfigurationStore.cs index dc2fa0f99..31adbdcf3 100644 --- a/MediaBrowser.Controller/Library/MetadataConfigurationStore.cs +++ b/MediaBrowser.Controller/Library/MetadataConfigurationStore.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Configuration; using System.Collections.Generic; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.cs index bab334a6d..e2988a831 100644 --- a/MediaBrowser.Controller/Library/NameExtensions.cs +++ b/MediaBrowser.Controller/Library/NameExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using MediaBrowser.Controller.Extensions; using MediaBrowser.Model.Extensions; diff --git a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs index 00d9932a7..b0302d04c 100644 --- a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs +++ b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Dto; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs b/MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs index b0f6799fc..12add2573 100644 --- a/MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs +++ b/MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.Library +namespace MediaBrowser.Controller.Library { public class PlaybackStopEventArgs : PlaybackProgressEventArgs { @@ -8,4 +8,4 @@ /// <value><c>true</c> if [played to completion]; otherwise, <c>false</c>.</value> public bool PlayedToCompletion { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Library/Profiler.cs b/MediaBrowser.Controller/Library/Profiler.cs index 745e49920..9fe175a7c 100644 --- a/MediaBrowser.Controller/Library/Profiler.cs +++ b/MediaBrowser.Controller/Library/Profiler.cs @@ -1,6 +1,6 @@ -using Microsoft.Extensions.Logging; using System; using System.Diagnostics; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/SearchHintInfo.cs b/MediaBrowser.Controller/Library/SearchHintInfo.cs index f832811c2..692431e34 100644 --- a/MediaBrowser.Controller/Library/SearchHintInfo.cs +++ b/MediaBrowser.Controller/Library/SearchHintInfo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index dc95ba112..5b66e7497 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System; namespace MediaBrowser.Controller.Library { @@ -11,7 +10,7 @@ namespace MediaBrowser.Controller.Library /// <summary> /// The TVDB API key /// </summary> - public static readonly string TvdbApiKey = "B89CE93890E9419B"; + public static readonly string TvdbApiKey = "72930AE1CB7E2DB3"; public static readonly string TvdbBaseUrl = "https://www.thetvdb.com/"; /// <summary> /// The banner URL @@ -41,9 +40,7 @@ namespace MediaBrowser.Controller.Library }; } - DayOfWeek value; - - if (Enum.TryParse(day, true, out value)) + if (Enum.TryParse(day, true, out DayOfWeek value)) { return new DayOfWeek[] { @@ -51,7 +48,7 @@ namespace MediaBrowser.Controller.Library }; } - return new DayOfWeek[]{}; + return new DayOfWeek[] { }; } return null; } diff --git a/MediaBrowser.Controller/Library/UserDataSaveEventArgs.cs b/MediaBrowser.Controller/Library/UserDataSaveEventArgs.cs index d921a7077..3e7351b8b 100644 --- a/MediaBrowser.Controller/Library/UserDataSaveEventArgs.cs +++ b/MediaBrowser.Controller/Library/UserDataSaveEventArgs.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Library { diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs index c000da852..70477fce7 100644 --- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.LiveTv; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { @@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The tuner host identifier.</value> public string TunerHostId { get; set; } - + /// <summary> /// Gets or sets the type of the channel. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/IListingsProvider.cs b/MediaBrowser.Controller/LiveTv/IListingsProvider.cs index faf4a34df..c719ad81c 100644 --- a/MediaBrowser.Controller/LiveTv/IListingsProvider.cs +++ b/MediaBrowser.Controller/LiveTv/IListingsProvider.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index a7f675034..f99df6c7c 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -1,15 +1,14 @@ -using System; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Events; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Querying; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Model.Events; -using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.LiveTv { diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 601fb69aa..ba3813d8a 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -1,10 +1,9 @@ -using MediaBrowser.Controller.Drawing; -using MediaBrowser.Model.Dto; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Library; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Controller.LiveTv { @@ -99,7 +98,7 @@ namespace MediaBrowser.Controller.LiveTv /// <param name="program">The program.</param> /// <returns>Task{SeriesTimerInfo}.</returns> Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken, ProgramInfo program = null); - + /// <summary> /// Gets the series timers asynchronous. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/ITunerHost.cs b/MediaBrowser.Controller/LiveTv/ITunerHost.cs index d5a0e2115..240ba8c23 100644 --- a/MediaBrowser.Controller/LiveTv/ITunerHost.cs +++ b/MediaBrowser.Controller/LiveTv/ITunerHost.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.LiveTv; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Library; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 9e2d29eb6..55f47aae9 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -1,14 +1,14 @@ -using MediaBrowser.Controller.Entities; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.MediaInfo; -using System.Collections.Generic; -using System.Globalization; using MediaBrowser.Model.Serialization; -using System; -using System.Linq; namespace MediaBrowser.Controller.LiveTv { @@ -32,28 +32,13 @@ namespace MediaBrowser.Controller.LiveTv } [IgnoreDataMember] - public override bool SupportsPositionTicksResume - { - get - { - return false; - } - } + public override bool SupportsPositionTicksResume => false; [IgnoreDataMember] - public override SourceType SourceType - { - get { return SourceType.LiveTV; } - } + public override SourceType SourceType => SourceType.LiveTV; [IgnoreDataMember] - public override bool EnableRememberingTrackSelections - { - get - { - return false; - } - } + public override bool EnableRememberingTrackSelections => false; /// <summary> /// Gets or sets the number. @@ -68,14 +53,7 @@ namespace MediaBrowser.Controller.LiveTv public ChannelType ChannelType { get; set; } [IgnoreDataMember] - public override LocationType LocationType - { - get - { - // TODO: This should be removed - return LocationType.Remote; - } - } + public override LocationType LocationType => LocationType.Remote; protected override string CreateSortName() { @@ -93,13 +71,7 @@ namespace MediaBrowser.Controller.LiveTv } [IgnoreDataMember] - public override string MediaType - { - get - { - return ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video; - } - } + public override string MediaType => ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video; public override string GetClientTypeName() { @@ -176,13 +148,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool IsKids - { - get - { - return Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); [IgnoreDataMember] public bool IsRepeat { get; set; } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs b/MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs index a7735ad80..df8f91eec 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.LiveTv { @@ -17,4 +17,4 @@ namespace MediaBrowser.Controller.LiveTv } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 4dc6c7517..8bde6a5da 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -1,12 +1,12 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; using System.Linq; using MediaBrowser.Common.Configuration; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; @@ -54,19 +54,16 @@ namespace MediaBrowser.Controller.LiveTv if (string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || string.Equals(serviceName, "Next Pvr", StringComparison.OrdinalIgnoreCase)) { - return 2 / 3; + return 2.0 / 3; } else { - return 16 / 9; + return 16.0 / 9; } } [IgnoreDataMember] - public override SourceType SourceType - { - get { return SourceType.LiveTV; } - } + public override SourceType SourceType => SourceType.LiveTV; /// <summary> /// The start date of the program, in UTC. @@ -103,13 +100,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>true</c> if this instance is sports; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool IsSports - { - get - { - return Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsSports => Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets a value indicating whether this instance is series. @@ -123,52 +114,28 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool IsLive - { - get - { - return Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsLive => Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets a value indicating whether this instance is news. /// </summary> /// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool IsNews - { - get - { - return Tags.Contains("News", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsNews => Tags.Contains("News", StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets a value indicating whether this instance is kids. /// </summary> /// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool IsKids - { - get - { - return Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets a value indicating whether this instance is premiere. /// </summary> /// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool IsPremiere - { - get - { - return Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsPremiere => Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); /// <summary> /// Returns the folder containing the item. @@ -176,13 +143,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The containing folder path.</value> [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; //[IgnoreDataMember] //public override string MediaType @@ -251,13 +212,7 @@ namespace MediaBrowser.Controller.LiveTv } [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; private LiveTvOptions GetConfiguration() { @@ -313,6 +268,6 @@ namespace MediaBrowser.Controller.LiveTv return list; } - public string SeriesName { get; set;} + public string SeriesName { get; set; } } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs index 4da238acf..67b2f0eb1 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.LiveTv; using System.Collections.Generic; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { @@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>true</c> if this instance is visible; otherwise, <c>false</c>.</value> public bool IsVisible { get; set; } - + public LiveTvServiceStatusInfo() { Tuners = new List<LiveTvTunerInfo>(); diff --git a/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs index 5c001f288..2857f73f6 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.LiveTv; using System.Collections.Generic; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { @@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The URL.</value> public string Url { get; set; } - + /// <summary> /// Gets or sets the status. /// </summary> @@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The name of the program.</value> public string ProgramName { get; set; } - + /// <summary> /// Gets or sets the clients. /// </summary> @@ -64,10 +64,10 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>true</c> if this instance can reset; otherwise, <c>false</c>.</value> public bool CanReset { get; set; } - + public LiveTvTunerInfo() { Clients = new List<string>(); } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index 9e3cbdded..5d0f13192 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -1,7 +1,6 @@ -using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { @@ -161,7 +160,7 @@ namespace MediaBrowser.Controller.LiveTv /// Gets or sets a value indicating whether this instance is premiere. /// </summary> /// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value> - public bool IsPremiere { get; set; } + public bool IsPremiere { get; set; } /// <summary> /// Gets or sets the production year. diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs index 3006b9bbe..432388d6b 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { @@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The timer identifier.</value> public string TimerId { get; set; } - + /// <summary> /// ChannelId of the recording. /// </summary> @@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The type of the channel.</value> public ChannelType ChannelType { get; set; } - + /// <summary> /// Name of the recording. /// </summary> @@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The URL.</value> public string Url { get; set; } - + /// <summary> /// Gets or sets the overview. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/RecordingStatusChangedEventArgs.cs b/MediaBrowser.Controller/LiveTv/RecordingStatusChangedEventArgs.cs index 90ea329fe..99460a686 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingStatusChangedEventArgs.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingStatusChangedEventArgs.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.LiveTv; using System; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { diff --git a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs index 5c73ed833..4fbd496c5 100644 --- a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using MediaBrowser.Model.LiveTv; @@ -15,13 +15,13 @@ namespace MediaBrowser.Controller.LiveTv /// ChannelId of the recording. /// </summary> public string ChannelId { get; set; } - + /// <summary> /// Gets or sets the program identifier. /// </summary> /// <value>The program identifier.</value> public string ProgramId { get; set; } - + /// <summary> /// Name of the recording. /// </summary> @@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>true</c> if [record new only]; otherwise, <c>false</c>.</value> public bool RecordNewOnly { get; set; } - + /// <summary> /// Gets or sets the days. /// </summary> @@ -108,7 +108,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The series identifier.</value> public string SeriesId { get; set; } - + public SeriesTimerInfo() { Days = new List<DayOfWeek>(); diff --git a/MediaBrowser.Controller/LiveTv/TimerEventInfo.cs b/MediaBrowser.Controller/LiveTv/TimerEventInfo.cs index 5b71a26a2..cfec39b4e 100644 --- a/MediaBrowser.Controller/LiveTv/TimerEventInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerEventInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.LiveTv { diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index c9eb6fee6..2fea6a8cb 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; using System.Linq; +using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.LiveTv @@ -114,28 +114,15 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The episode number.</value> public int? EpisodeNumber { get; set; } + public bool IsMovie { get; set; } - public bool IsKids - { - get - { - return Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); - } - } - public bool IsSports - { - get - { - return Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); - } - } - public bool IsNews - { - get - { - return Tags.Contains("News", StringComparer.OrdinalIgnoreCase); - } - } + + public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); + + public bool IsSports => Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); + + public bool IsNews => Tags.Contains("News", StringComparer.OrdinalIgnoreCase); + public bool IsSeries { get; set; } /// <summary> @@ -143,28 +130,21 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value> [IgnoreDataMember] - public bool IsLive - { - get - { - return Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsLive => Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); [IgnoreDataMember] - public bool IsPremiere - { - get - { - return Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsPremiere => Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); public int? ProductionYear { get; set; } + public string EpisodeTitle { get; set; } + public DateTime? OriginalAirDate { get; set; } + public bool IsProgramSeries { get; set; } + public bool IsRepeat { get; set; } + public string HomePageUrl { get; set; } public float? CommunityRating { get; set; } public string OfficialRating { get; set; } diff --git a/MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs b/MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs index 3b2df0471..cb02da635 100644 --- a/MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs +++ b/MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.LiveTv +namespace MediaBrowser.Controller.LiveTv { public class TunerChannelMapping { diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 4567f62dd..01893f1b5 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -1,4 +1,11 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <Authors>Jellyfin Contributors</Authors> + <PackageId>Jellyfin.Controller</PackageId> + <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl> + <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl> + </PropertyGroup> <ItemGroup> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> diff --git a/MediaBrowser.Controller/MediaEncoding/DroidSansFallback.ttf.REMOVED.git-id b/MediaBrowser.Controller/MediaEncoding/DroidSansFallback.ttf.REMOVED.git-id deleted file mode 100644 index 3c0ca209e..000000000 --- a/MediaBrowser.Controller/MediaEncoding/DroidSansFallback.ttf.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4366f8d8bf9886d71e3e9ddae8480d953caf02cf
\ No newline at end of file diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 4fb9a711e..e086f9d33 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1,16 +1,17 @@ -using System; +using System; 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; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Controller.MediaEncoding { @@ -21,6 +22,8 @@ namespace MediaBrowser.Controller.MediaEncoding private readonly IMediaEncoder _mediaEncoder; private readonly IFileSystem _fileSystem; private readonly ISubtitleEncoder _subtitleEncoder; + // private readonly IApplicationPaths _appPaths; + // private readonly IAssemblyInfo _assemblyInfo; public EncodingHelper(IMediaEncoder mediaEncoder, IFileSystem fileSystem, ISubtitleEncoder subtitleEncoder) { @@ -40,56 +43,55 @@ namespace MediaBrowser.Controller.MediaEncoding { var hwType = encodingOptions.HardwareAccelerationType; - if (!encodingOptions.EnableHardwareEncoding) - { - hwType = null; - } - - if (string.Equals(hwType, "qsv", StringComparison.OrdinalIgnoreCase) || - string.Equals(hwType, "h264_qsv", StringComparison.OrdinalIgnoreCase)) + var codecMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { - return GetAvailableEncoder("h264_qsv", defaultEncoder); - } + {"qsv", "h264_qsv"}, + {"h264_qsv", "h264_qsv"}, + {"nvenc", "h264_nvenc"}, + {"amf", "h264_amf"}, + {"omx", "h264_omx"}, + {"h264_v4l2m2m", "h264_v4l2m2m"}, + {"mediacodec", "h264_mediacodec"}, + {"vaapi", "h264_vaapi"} + }; - if (string.Equals(hwType, "nvenc", StringComparison.OrdinalIgnoreCase)) - { - return GetAvailableEncoder("h264_nvenc", defaultEncoder); - } - if (string.Equals(hwType, "amf", StringComparison.OrdinalIgnoreCase)) - { - return GetAvailableEncoder("h264_amf", defaultEncoder); - } - if (string.Equals(hwType, "omx", StringComparison.OrdinalIgnoreCase)) - { - return GetAvailableEncoder("h264_omx", defaultEncoder); - } - if (string.Equals(hwType, "h264_v4l2m2m", StringComparison.OrdinalIgnoreCase)) + if (!string.IsNullOrEmpty(hwType) + && encodingOptions.EnableHardwareEncoding && codecMap.ContainsKey(hwType)) { - return GetAvailableEncoder("h264_v4l2m2m", defaultEncoder); - } - if (string.Equals(hwType, "mediacodec", StringComparison.OrdinalIgnoreCase)) - { - return GetAvailableEncoder("h264_mediacodec", defaultEncoder); - } - if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(encodingOptions.VaapiDevice)) - { - if (IsVaapiSupported(state)) + if (CheckVaapi(state, hwType, encodingOptions)) { - return GetAvailableEncoder("h264_vaapi", defaultEncoder); + var preferredEncoder = codecMap[hwType]; + + if (_mediaEncoder.SupportsEncoder(preferredEncoder)) + { + return preferredEncoder; + } } } + } + // Avoid performing a second attempt when the first one + // hasn't tried hardware encoding anyway. + encodingOptions.EnableHardwareEncoding = false; return defaultEncoder; } - private string GetAvailableEncoder(string preferredEncoder, string defaultEncoder) + private bool CheckVaapi(EncodingJobInfo state, string hwType, EncodingOptions encodingOptions) { - if (_mediaEncoder.SupportsEncoder(preferredEncoder)) + if (!string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase)) { - return preferredEncoder; + // No vaapi requested, return OK. + return true; } - return defaultEncoder; + + if (string.IsNullOrEmpty(encodingOptions.VaapiDevice)) + { + // No device specified, return OK. + return true; + } + + return IsVaapiSupported(state); } private bool IsVaapiSupported(EncodingJobInfo state) @@ -340,7 +342,7 @@ namespace MediaBrowser.Controller.MediaEncoding public int GetVideoProfileScore(string profile) { - string[] list = + var list = new[] { "ConstrainedBaseline", "Baseline", @@ -538,14 +540,54 @@ namespace MediaBrowser.Controller.MediaEncoding ? string.Empty : string.Format(",setpts=PTS -{0}/TB", seconds.ToString(_usCulture)); - string fallbackFontParam = string.Empty; + // TODO + // var fallbackFontPath = Path.Combine(_appPaths.ProgramDataPath, "fonts", "DroidSansFallback.ttf"); + // string fallbackFontParam = string.Empty; + + // if (!_fileSystem.FileExists(fallbackFontPath)) + // { + // _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fallbackFontPath)); + // using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), GetType().Namespace + ".DroidSansFallback.ttf")) + // { + // using (var fileStream = _fileSystem.GetFileStream(fallbackFontPath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) + // { + // stream.CopyTo(fileStream); + // } + // } + // } + + // fallbackFontParam = string.Format(":force_style='FontName=Droid Sans Fallback':fontsdir='{0}'", _mediaEncoder.EscapeSubtitleFilterPath(_fileSystem.GetDirectoryName(fallbackFontPath))); + + if (state.SubtitleStream.IsExternal) + { + var subtitlePath = state.SubtitleStream.Path; + + var charsetParam = string.Empty; + + if (!string.IsNullOrEmpty(state.SubtitleStream.Language)) + { + var charenc = _subtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.SubtitleStream.Language, state.MediaSource.Protocol, CancellationToken.None).Result; + + if (!string.IsNullOrEmpty(charenc)) + { + charsetParam = ":charenc=" + charenc; + } + } + + // TODO: Perhaps also use original_size=1920x800 ?? + return string.Format("subtitles=filename='{0}'{1}{2}{3}", + _mediaEncoder.EscapeSubtitleFilterPath(subtitlePath), + charsetParam, + // fallbackFontParam, + setPtsParam); + } var mediaPath = state.MediaPath ?? string.Empty; - return string.Format("subtitles='{0}:si={1}'{2}{3}", + return string.Format("subtitles='{0}:si={1}'{2}", _mediaEncoder.EscapeSubtitleFilterPath(mediaPath), state.InternalSubtitleStreamOffset.ToString(_usCulture), - fallbackFontParam, + // fallbackFontParam, setPtsParam); } @@ -718,14 +760,18 @@ namespace MediaBrowser.Controller.MediaEncoding var request = state.BaseRequest; var profile = state.GetRequestedProfiles(targetVideoCodec).FirstOrDefault(); - if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase)) + + // vaapi does not support Baseline profile, force Constrained Baseline in this case, + // which is compatible (and ugly) + if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) && + profile != null && profile.ToLower().Contains("baseline")) { - param += " -profile:v 578"; + profile = "constrained_baseline"; } - else if (!string.IsNullOrEmpty(profile)) + + if (!string.IsNullOrEmpty(profile)) { if (!string.Equals(videoEncoder, "h264_omx", StringComparison.OrdinalIgnoreCase) && - !string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) && !string.Equals(videoEncoder, "h264_v4l2m2m", StringComparison.OrdinalIgnoreCase)) { // not supported by h264_omx @@ -740,7 +786,7 @@ namespace MediaBrowser.Controller.MediaEncoding level = NormalizeTranscodingLevel(state.OutputVideoCodec, level); // h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format - // also needed for libx264 due to https://trac.ffmpeg.org/ticket/3307 + // also needed for libx264 due to https://trac.ffmpeg.org/ticket/3307 if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) || string.Equals(videoEncoder, "libx264", StringComparison.OrdinalIgnoreCase)) { @@ -943,9 +989,7 @@ namespace MediaBrowser.Controller.MediaEncoding var level = state.GetRequestedLevel(videoStream.Codec); if (!string.IsNullOrEmpty(level)) { - double requestLevel; - - if (double.TryParse(level, NumberStyles.Any, _usCulture, out requestLevel)) + if (double.TryParse(level, NumberStyles.Any, _usCulture, out var requestLevel)) { if (!videoStream.Level.HasValue) { @@ -1041,51 +1085,67 @@ namespace MediaBrowser.Controller.MediaEncoding { var bitrate = request.VideoBitRate; - if (videoStream != null) + // If specific values were requested, then force the caller to supply a bitrate as well + if (request.Height.HasValue && request.Width.HasValue) { - var isUpscaling = request.Height.HasValue && videoStream.Height.HasValue && - request.Height.Value > videoStream.Height.Value && request.Width.HasValue && videoStream.Width.HasValue && - request.Width.Value > videoStream.Width.Value; + return bitrate; + } - // Don't allow bitrate increases unless upscaling - if (!isUpscaling) + if (videoStream != null) + { + if (bitrate.HasValue) { - if (bitrate.HasValue && videoStream.BitRate.HasValue) + var inputVideoCodec = videoStream.Codec; + bitrate = ScaleBitrate(bitrate.Value, inputVideoCodec, outputVideoCodec); + + // If a max bitrate was requested, don't let the scaled bitrate exceed it + if (request.VideoBitRate.HasValue) { - bitrate = GetMinBitrate(videoStream.BitRate.Value, bitrate.Value); + bitrate = Math.Min(bitrate.Value, request.VideoBitRate.Value); } } } - if (bitrate.HasValue) - { - var inputVideoCodec = videoStream == null ? null : videoStream.Codec; - bitrate = ResolutionNormalizer.ScaleBitrate(bitrate.Value, inputVideoCodec, outputVideoCodec); + return bitrate; + } - // If a max bitrate was requested, don't let the scaled bitrate exceed it - if (request.VideoBitRate.HasValue) - { - bitrate = Math.Min(bitrate.Value, request.VideoBitRate.Value); - } + private static double GetVideoBitrateScaleFactor(string codec) + { + if (StringHelper.EqualsIgnoreCase(codec, "h265") || + StringHelper.EqualsIgnoreCase(codec, "hevc") || + StringHelper.EqualsIgnoreCase(codec, "vp9")) + { + return .5; } - - return bitrate; + return 1; } - private int GetMinBitrate(int sourceBitrate, int requestedBitrate) + private static int ScaleBitrate(int bitrate, string inputVideoCodec, string outputVideoCodec) { - if (sourceBitrate <= 2000000) + var inputScaleFactor = GetVideoBitrateScaleFactor(inputVideoCodec); + var outputScaleFactor = GetVideoBitrateScaleFactor(outputVideoCodec); + var scaleFactor = outputScaleFactor / inputScaleFactor; + + if (bitrate <= 500000) { - sourceBitrate = Convert.ToInt32(sourceBitrate * 2.5); + scaleFactor = Math.Max(scaleFactor, 4); } - else if (sourceBitrate <= 3000000) + else if (bitrate <= 1000000) { - sourceBitrate = Convert.ToInt32(sourceBitrate * 2); + scaleFactor = Math.Max(scaleFactor, 3); + } + else if (bitrate <= 2000000) + { + scaleFactor = Math.Max(scaleFactor, 2.5); + } + else if (bitrate <= 3000000) + { + scaleFactor = Math.Max(scaleFactor, 2); } - var bitrate = Math.Min(sourceBitrate, requestedBitrate); + var newBitrate = scaleFactor * bitrate; - return bitrate; + return Convert.ToInt32(newBitrate); } public int? GetAudioBitrateParam(BaseEncodingJobOptions request, MediaStream audioStream) @@ -1137,7 +1197,7 @@ namespace MediaBrowser.Controller.MediaEncoding /// <summary> /// Gets the number of audio channels to specify on the command line /// </summary> - /// <param name="request">The request.</param> + /// <param name="state">The state.</param> /// <param name="audioStream">The audio stream.</param> /// <param name="outputAudioCodec">The output audio codec.</param> /// <returns>System.Nullable{System.Int32}.</returns> @@ -1407,7 +1467,7 @@ namespace MediaBrowser.Controller.MediaEncoding videoSizeParam); } - private Tuple<int?, int?> GetFixedOutputSize(int? videoWidth, + private ValueTuple<int?, int?> GetFixedOutputSize(int? videoWidth, int? videoHeight, int? requestedWidth, int? requestedHeight, @@ -1416,11 +1476,11 @@ namespace MediaBrowser.Controller.MediaEncoding { if (!videoWidth.HasValue && !requestedWidth.HasValue) { - return new Tuple<int?, int?>(null, null); + return new ValueTuple<int?, int?>(null, null); } if (!videoHeight.HasValue && !requestedHeight.HasValue) { - return new Tuple<int?, int?>(null, null); + return new ValueTuple<int?, int?>(null, null); } decimal inputWidth = Convert.ToDecimal(videoWidth ?? requestedWidth); @@ -1440,7 +1500,7 @@ namespace MediaBrowser.Controller.MediaEncoding outputWidth = 2 * Math.Truncate(outputWidth / 2); outputHeight = 2 * Math.Truncate(outputHeight / 2); - return new Tuple<int?, int?>(Convert.ToInt32(outputWidth), Convert.ToInt32(outputHeight)); + return new ValueTuple<int?, int?>(Convert.ToInt32(outputWidth), Convert.ToInt32(outputHeight)); } public List<string> GetScalingFilters(int? videoWidth, @@ -1671,7 +1731,7 @@ namespace MediaBrowser.Controller.MediaEncoding var inputHeight = videoStream == null ? null : videoStream.Height; var threeDFormat = state.MediaSource.Video3DFormat; - var videoDecoder = GetVideoDecoder(state, options); + var videoDecoder = this.GetHardwareAcceleratedVideoDecoder(state, options); filters.AddRange(GetScalingFilters(inputWidth, inputHeight, threeDFormat, videoDecoder, outputVideoCodec, request.Width, request.Height, request.MaxWidth, request.MaxHeight)); @@ -1706,7 +1766,8 @@ namespace MediaBrowser.Controller.MediaEncoding if (string.Equals(outputVideoCodec, "libvpx", StringComparison.OrdinalIgnoreCase)) { // per docs: - // -threads number of threads to use for encoding, can't be 0 [auto] with VP8 (recommended value : number of real cores - 1) + // -threads number of threads to use for encoding, can't be 0 [auto] with VP8 + // (recommended value : number of real cores - 1) return Math.Max(Environment.ProcessorCount - 1, 1); } @@ -1852,7 +1913,7 @@ namespace MediaBrowser.Controller.MediaEncoding inputModifier += " -fflags " + string.Join("", flags.ToArray()); } - var videoDecoder = GetVideoDecoder(state, encodingOptions); + var videoDecoder = this.GetHardwareAcceleratedVideoDecoder(state, encodingOptions); if (!string.IsNullOrEmpty(videoDecoder)) { inputModifier += " " + videoDecoder; @@ -1894,7 +1955,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (state.MediaSource.RequiresLooping) { - inputModifier += " -stream_loop -1"; + inputModifier += " -stream_loop -1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2"; } return inputModifier; @@ -1907,11 +1968,11 @@ namespace MediaBrowser.Controller.MediaEncoding { if (state == null) { - throw new ArgumentNullException("state"); + throw new ArgumentNullException(nameof(state)); } if (mediaSource == null) { - throw new ArgumentNullException("mediaSource"); + throw new ArgumentNullException(nameof(mediaSource)); } var path = mediaSource.Path; @@ -1990,7 +2051,7 @@ namespace MediaBrowser.Controller.MediaEncoding { if (string.IsNullOrEmpty(requestedUrl)) { - requestedUrl = "test." + videoRequest.OutputContainer; + requestedUrl = "test." + videoRequest.Container; } videoRequest.VideoCodec = InferVideoCodec(requestedUrl); @@ -2016,6 +2077,49 @@ namespace MediaBrowser.Controller.MediaEncoding } state.MediaSource = mediaSource; + + var request = state.BaseRequest; + if (!string.IsNullOrWhiteSpace(request.AudioCodec)) + { + var supportedAudioCodecsList = request.AudioCodec.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); + + ShiftAudioCodecsIfNeeded(supportedAudioCodecsList, state.AudioStream); + + state.SupportedAudioCodecs = supportedAudioCodecsList.ToArray(); + + request.AudioCodec = state.SupportedAudioCodecs.FirstOrDefault(i => _mediaEncoder.CanEncodeToAudioCodec(i)) + ?? state.SupportedAudioCodecs.FirstOrDefault(); + } + } + + private void ShiftAudioCodecsIfNeeded(List<string> audioCodecs, MediaStream audioStream) + { + // Nothing to do here + if (audioCodecs.Count < 2) + { + return; + } + + var inputChannels = audioStream == null ? 6 : audioStream.Channels ?? 6; + if (inputChannels >= 6) + { + return; + } + + // Transcoding to 2ch ac3 almost always causes a playback failure + // Keep it in the supported codecs list, but shift it to the end of the list so that if transcoding happens, another codec is used + var shiftAudioCodecs = new[] { "ac3", "eac3" }; + if (audioCodecs.All(i => shiftAudioCodecs.Contains(i, StringComparer.OrdinalIgnoreCase))) + { + return; + } + + while (shiftAudioCodecs.Contains(audioCodecs[0], StringComparer.OrdinalIgnoreCase)) + { + var removed = shiftAudioCodecs[0]; + audioCodecs.RemoveAt(0); + audioCodecs.Add(removed); + } } private void NormalizeSubtitleEmbed(EncodingJobInfo state) @@ -2036,17 +2140,17 @@ namespace MediaBrowser.Controller.MediaEncoding /// <summary> /// Gets the name of the output video codec /// </summary> - protected string GetVideoDecoder(EncodingJobInfo state, EncodingOptions encodingOptions) + protected string GetHardwareAcceleratedVideoDecoder(EncodingJobInfo state, EncodingOptions encodingOptions) { if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { return null; } - return GetVideoDecoder(state.MediaSource.VideoType ?? VideoType.VideoFile, state.VideoStream, encodingOptions); + return this.GetHardwareAcceleratedVideoDecoder(state.MediaSource.VideoType ?? VideoType.VideoFile, state.VideoStream, encodingOptions); } - public string GetVideoDecoder(VideoType videoType, MediaStream videoStream, EncodingOptions encodingOptions) + public string GetHardwareAcceleratedVideoDecoder(VideoType videoType, MediaStream videoStream, EncodingOptions encodingOptions) { // Only use alternative encoders for video files. // When using concat with folder rips, if the mfx session fails to initialize, ffmpeg will be stuck retrying and will not exit gracefully @@ -2071,6 +2175,7 @@ namespace MediaBrowser.Controller.MediaEncoding // qsv decoder does not support 10-bit input if ((videoStream.BitDepth ?? 8) > 8) { + encodingOptions.HardwareDecodingCodecs = Array.Empty<string>(); return null; } return "-c:v h264_qsv "; @@ -2205,6 +2310,11 @@ namespace MediaBrowser.Controller.MediaEncoding else if (string.Equals(encodingOptions.HardwareAccelerationType, "amf", StringComparison.OrdinalIgnoreCase)) { + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + { + return "-hwaccel dxva2"; + } + switch (videoStream.Codec.ToLower()) { case "avc": @@ -2224,6 +2334,9 @@ namespace MediaBrowser.Controller.MediaEncoding } } + // Avoid a second attempt if no hardware acceleration is being used + encodingOptions.HardwareDecodingCodecs = Array.Empty<string>(); + // leave blank so ffmpeg will decide return null; } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs index 3f6da59d8..6651a6d70 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs @@ -1,24 +1,27 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Session; using Microsoft.Extensions.Logging; +using System.IO; +using MediaBrowser.Model.Net; +using MediaBrowser.Controller.Library; +using System.Threading.Tasks; namespace MediaBrowser.Controller.MediaEncoding { // For now, a common base class until the API and MediaEncoding classes are unified - public abstract class EncodingJobInfo + public class EncodingJobInfo { - private readonly ILogger _logger; + protected readonly IMediaSourceManager MediaSourceManager; public MediaStream VideoStream { get; set; } public VideoType VideoType { get; set; } @@ -43,6 +46,21 @@ namespace MediaBrowser.Controller.MediaEncoding public bool ReadInputAtNativeFramerate { get; set; } + public string OutputFilePath { get; set; } + + public string MimeType { get; set; } + public long? EncodingDurationTicks { get; set; } + + public string GetMimeType(string outputPath, bool enableStreamDefault = true) + { + if (!string.IsNullOrEmpty(MimeType)) + { + return MimeType; + } + + return MimeTypes.GetMimeType(outputPath, enableStreamDefault); + } + private TranscodeReason[] _transcodeReasons = null; public TranscodeReason[] TranscodeReasons { @@ -61,53 +79,17 @@ namespace MediaBrowser.Controller.MediaEncoding } } - public bool IgnoreInputDts - { - get - { - return MediaSource.IgnoreDts; - } - } + public bool IgnoreInputDts => MediaSource.IgnoreDts; - public bool IgnoreInputIndex - { - get - { - return MediaSource.IgnoreIndex; - } - } + public bool IgnoreInputIndex => MediaSource.IgnoreIndex; - public bool GenPtsInput - { - get - { - return MediaSource.GenPtsInput; - } - } + public bool GenPtsInput => MediaSource.GenPtsInput; - public bool DiscardCorruptFramesInput - { - get - { - return false; - } - } + public bool DiscardCorruptFramesInput => false; - public bool EnableFastSeekInput - { - get - { - return false; - } - } + public bool EnableFastSeekInput => false; - public bool GenPtsOutput - { - get - { - return false; - } - } + public bool GenPtsOutput => false; public string OutputContainer { get; set; } @@ -142,15 +124,9 @@ namespace MediaBrowser.Controller.MediaEncoding public BaseEncodingJobOptions BaseRequest { get; set; } - public long? StartTimeTicks - { - get { return BaseRequest.StartTimeTicks; } - } + public long? StartTimeTicks => BaseRequest.StartTimeTicks; - public bool CopyTimestamps - { - get { return BaseRequest.CopyTimestamps; } - } + public bool CopyTimestamps => BaseRequest.CopyTimestamps; public int? OutputAudioBitrate; public int? OutputAudioChannels; @@ -235,8 +211,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (!string.IsNullOrEmpty(codec)) { var value = BaseRequest.GetOption(codec, "maxrefframes"); - int result; - if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) + if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -255,8 +230,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (!string.IsNullOrEmpty(codec)) { var value = BaseRequest.GetOption(codec, "videobitdepth"); - int result; - if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) + if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -275,8 +249,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (!string.IsNullOrEmpty(codec)) { var value = BaseRequest.GetOption(codec, "audiobitdepth"); - int result; - if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) + if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -299,8 +272,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (!string.IsNullOrEmpty(codec)) { var value = BaseRequest.GetOption(codec, "audiochannels"); - int result; - if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) + if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -312,9 +284,8 @@ namespace MediaBrowser.Controller.MediaEncoding public bool IsVideoRequest { get; set; } public TranscodingJobType TranscodingType { get; set; } - public EncodingJobInfo(ILogger logger, IMediaSourceManager unused, TranscodingJobType jobType) + public EncodingJobInfo(TranscodingJobType jobType) { - _logger = logger; TranscodingType = jobType; RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); PlayableStreamFileNames = Array.Empty<string>(); @@ -323,13 +294,7 @@ namespace MediaBrowser.Controller.MediaEncoding SupportedSubtitleCodecs = Array.Empty<string>(); } - public bool IsSegmentedLiveStream - { - get - { - return TranscodingType != TranscodingJobType.Progressive && !RunTimeTicks.HasValue; - } - } + public bool IsSegmentedLiveStream => TranscodingType != TranscodingJobType.Progressive && !RunTimeTicks.HasValue; public bool EnableBreakOnNonKeyFrames(string videoCodec) { @@ -346,13 +311,7 @@ namespace MediaBrowser.Controller.MediaEncoding return false; } - public int? TotalOutputBitrate - { - get - { - return (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0); - } - } + public int? TotalOutputBitrate => (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0); public int? OutputWidth { @@ -473,8 +432,7 @@ namespace MediaBrowser.Controller.MediaEncoding } var level = GetRequestedLevel(ActualOutputVideoCodec); - double result; - if (!string.IsNullOrEmpty(level) && double.TryParse(level, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) + if (!string.IsNullOrEmpty(level) && double.TryParse(level, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -661,6 +619,28 @@ namespace MediaBrowser.Controller.MediaEncoding } } + public string ActualOutputAudioCodec + { + get + { + var codec = OutputAudioCodec; + + if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase)) + { + var stream = AudioStream; + + if (stream != null) + { + return stream.Codec; + } + + return null; + } + + return codec; + } + } + public bool? IsTargetInterlaced { get @@ -716,6 +696,14 @@ namespace MediaBrowser.Controller.MediaEncoding } } + public int HlsListSize + { + get + { + return 0; + } + } + private int? GetMediaStreamCount(MediaStreamType type, int limit) { var count = MediaSource.GetStreamCount(type); @@ -727,29 +715,15 @@ namespace MediaBrowser.Controller.MediaEncoding return count; } - protected void DisposeIsoMount() - { - if (IsoMount != null) - { - try - { - IsoMount.Dispose(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error disposing iso mount"); - } - - IsoMount = null; - } - } public IProgress<double> Progress { get; set; } - public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate) { + public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate) + { Progress.Report(percentComplete.Value); } - public virtual void Dispose () { + public virtual void Dispose() + { } } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index 101748a5a..be97c75a2 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -11,32 +11,26 @@ namespace MediaBrowser.Controller.MediaEncoding { public string OutputDirectory { get; set; } public string ItemId { get; set; } - public string MediaSourceId { get; set; } - public string AudioCodec { get; set; } + public string TempDirectory { get; set; } public bool ReadInputAtNativeFramerate { get; set; } /// <summary> /// Gets a value indicating whether this instance has fixed resolution. /// </summary> /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value> - public bool HasFixedResolution - { - get - { - return Width.HasValue || Height.HasValue; - } - } + public bool HasFixedResolution => Width.HasValue || Height.HasValue; + + public DeviceProfile DeviceProfile { get; set; } - private readonly CultureInfo _usCulture = new CultureInfo("en-US"); public EncodingJobOptions(StreamInfo info, DeviceProfile deviceProfile) { - OutputContainer = info.Container; + Container = info.Container; StartTimeTicks = info.StartPositionTicks; MaxWidth = info.MaxWidth; MaxHeight = info.MaxHeight; MaxFramerate = info.MaxFramerate; - ItemId = info.ItemId.ToString(""); + Id = info.ItemId; MediaSourceId = info.MediaSourceId; AudioCodec = info.TargetAudioCodec.FirstOrDefault(); MaxAudioChannels = info.GlobalMaxAudioChannels; @@ -61,6 +55,29 @@ namespace MediaBrowser.Controller.MediaEncoding // For now until api and media encoding layers are unified public class BaseEncodingJobOptions { + /// <summary> + /// Gets or sets the id. + /// </summary> + /// <value>The id.</value> + [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public Guid Id { get; set; } + + [ApiMember(Name = "MediaSourceId", Description = "The media version id, if playing an alternate version", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string MediaSourceId { get; set; } + + [ApiMember(Name = "DeviceId", Description = "The device id of the client requesting. Used to stop encoding processes when needed.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string DeviceId { get; set; } + + [ApiMember(Name = "Container", Description = "Container", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] + public string Container { get; set; } + + /// <summary> + /// Gets or sets the audio codec. + /// </summary> + /// <value>The audio codec.</value> + [ApiMember(Name = "AudioCodec", Description = "Optional. Specify a audio codec to encode to, e.g. mp3. If omitted the server will auto-select using the url's extension. Options: aac, mp3, vorbis, wma.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string AudioCodec { get; set; } + [ApiMember(Name = "EnableAutoStreamCopy", Description = "Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool EnableAutoStreamCopy { get; set; } @@ -186,7 +203,7 @@ namespace MediaBrowser.Controller.MediaEncoding public bool RequireNonAnamorphic { get; set; } public int? TranscodingMaxAudioChannels { get; set; } public int? CpuCoreLimit { get; set; } - public string OutputContainer { get; set; } + public string LiveStreamId { get; set; } public bool EnableMpegtsM2TsMode { get; set; } @@ -234,8 +251,7 @@ namespace MediaBrowser.Controller.MediaEncoding public string GetOption(string name) { - string value; - if (StreamOptions.TryGetValue(name, out value)) + if (StreamOptions.TryGetValue(name, out var value)) { return value; } @@ -251,11 +267,5 @@ namespace MediaBrowser.Controller.MediaEncoding Context = EncodingContext.Streaming; StreamOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } - - public string TempDirectory { get; set; } - public string DeviceId { get; set; } - public Guid Id { get; set; } - public string Container { get; set; } - public DeviceProfile DeviceProfile { get; set; } } } diff --git a/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs b/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs index 7d50efd5e..e560999e8 100644 --- a/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs +++ b/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs @@ -1,9 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.MediaEncoding { diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 2b85b8975..48055a37e 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Controller.MediaEncoding { diff --git a/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs b/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs index de7496d42..174e74f34 100644 --- a/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.MediaInfo; using System.IO; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Controller.MediaEncoding { diff --git a/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs b/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs index a8d1e5a0f..361dd79dc 100644 --- a/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs @@ -1,10 +1,9 @@ - namespace MediaBrowser.Controller.MediaEncoding { public class ImageEncodingOptions { public string InputPath { get; set; } - + public int? Width { get; set; } public int? Height { get; set; } @@ -14,7 +13,7 @@ namespace MediaBrowser.Controller.MediaEncoding public int? MaxHeight { get; set; } public int? Quality { get; set; } - + public string Format { get; set; } } } diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs index 8bb826bd1..b812a8ddc 100644 --- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs +++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Model.Extensions; using System; using System.Globalization; using System.IO; using System.Linq; using System.Text; +using MediaBrowser.Model.Extensions; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.MediaEncoding @@ -39,6 +39,7 @@ namespace MediaBrowser.Controller.MediaEncoding } catch (ObjectDisposedException) { + //TODO Investigate and properly fix. // Don't spam the log. This doesn't seem to throw in windows, but sometimes under linux } catch (Exception ex) @@ -73,9 +74,8 @@ namespace MediaBrowser.Controller.MediaEncoding (i + 1 < parts.Length)) { var rate = parts[i + 1]; - float val; - if (float.TryParse(rate, NumberStyles.Any, _usCulture, out val)) + if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val)) { framerate = val; } @@ -84,9 +84,8 @@ namespace MediaBrowser.Controller.MediaEncoding part.StartsWith("time=", StringComparison.OrdinalIgnoreCase)) { var time = part.Split(new[] { '=' }, 2).Last(); - TimeSpan val; - if (TimeSpan.TryParse(time, _usCulture, out val)) + if (TimeSpan.TryParse(time, _usCulture, out var val)) { var currentMs = startMs + val.TotalMilliseconds; @@ -109,9 +108,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (scale.HasValue) { - long val; - - if (long.TryParse(size, NumberStyles.Any, _usCulture, out val)) + if (long.TryParse(size, NumberStyles.Any, _usCulture, out var val)) { bytesTranscoded = val * scale.Value; } @@ -130,9 +127,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (scale.HasValue) { - float val; - - if (float.TryParse(rate, NumberStyles.Any, _usCulture, out val)) + if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val)) { bitRate = (int)Math.Ceiling(val * scale.Value); } diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index 70e4db84f..7f842c1d0 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.IO; -using MediaBrowser.Model.MediaInfo; using System; using System.IO; using System.Linq; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Controller.MediaEncoding { @@ -31,14 +31,14 @@ namespace MediaBrowser.Controller.MediaEncoding return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames); } - return new[] {videoPath}; + return new[] { videoPath }; } private static string[] GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, string[] filenames) { if (filenames.Length == 0) { - return new string[]{}; + return new string[] { }; } var allFiles = fileSystem diff --git a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs index b191f9905..b78ef0b80 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs @@ -1,10 +1,7 @@ -using MediaBrowser.Model.Dlna; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.MediaInfo; -using System.Collections.Generic; -using MediaBrowser.Model.Dto; using System; +using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.IO; namespace MediaBrowser.Controller.MediaEncoding { diff --git a/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs index 2f31b8e66..64c2294e3 100644 --- a/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs +++ b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net @@ -44,14 +44,11 @@ namespace MediaBrowser.Controller.Net /// >0 Executed after global request filters /// </summary> /// <value>The priority.</value> - public int Priority - { - get { return 0; } - } + public int Priority => 0; public string[] GetRoles() { - return (Roles ?? string.Empty).Split(new []{ ',' }, StringSplitOptions.RemoveEmptyEntries); + return (Roles ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } public bool AllowLocalOnly { get; set; } diff --git a/MediaBrowser.Controller/Net/AuthorizationInfo.cs b/MediaBrowser.Controller/Net/AuthorizationInfo.cs index 848d8fa15..3e004763d 100644 --- a/MediaBrowser.Controller/Net/AuthorizationInfo.cs +++ b/MediaBrowser.Controller/Net/AuthorizationInfo.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Controller.Entities; using System; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Net { @@ -9,12 +9,8 @@ namespace MediaBrowser.Controller.Net /// Gets or sets the user identifier. /// </summary> /// <value>The user identifier.</value> - public Guid UserId { - get { - return User == null ? Guid.Empty : User.Id; - } - } - + public Guid UserId => User == null ? Guid.Empty : User.Id; + /// <summary> /// Gets or sets the device identifier. /// </summary> diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs index 31ec149bf..4e7e1c8ed 100644 --- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs +++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs @@ -1,12 +1,12 @@ -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Threading; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net.WebSockets; -using System.Threading.Tasks; using System.Threading; -using System; +using System.Threading.Tasks; +using MediaBrowser.Model.Net; +using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Net @@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Net { if (logger == null) { - throw new ArgumentNullException("logger"); + throw new ArgumentNullException(nameof(logger)); } Logger = logger; @@ -65,7 +65,7 @@ namespace MediaBrowser.Controller.Net { if (message == null) { - throw new ArgumentNullException("message"); + throw new ArgumentNullException(nameof(message)); } if (string.Equals(message.MessageType, Name + "Start", StringComparison.OrdinalIgnoreCase)) @@ -83,17 +83,11 @@ namespace MediaBrowser.Controller.Net protected readonly CultureInfo UsCulture = new CultureInfo("en-US"); - protected virtual bool SendOnTimer - { - get - { - return false; - } - } + protected virtual bool SendOnTimer => false; protected virtual void ParseMessageParams(string[] values) { - + } /// <summary> @@ -269,7 +263,7 @@ namespace MediaBrowser.Controller.Net } catch (ObjectDisposedException) { - + //TODO Investigate and properly fix. } } @@ -280,10 +274,13 @@ namespace MediaBrowser.Controller.Net } catch (ObjectDisposedException) { - + //TODO Investigate and properly fix. } - ActiveConnections.Remove(connection); + lock (ActiveConnections) + { + ActiveConnections.Remove(connection); + } } /// <summary> diff --git a/MediaBrowser.Controller/Net/IAuthService.cs b/MediaBrowser.Controller/Net/IAuthService.cs index 361320250..142f1d91c 100644 --- a/MediaBrowser.Controller/Net/IAuthService.cs +++ b/MediaBrowser.Controller/Net/IAuthService.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Services; +using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net { diff --git a/MediaBrowser.Controller/Net/IAuthorizationContext.cs b/MediaBrowser.Controller/Net/IAuthorizationContext.cs index 5a9d0aa30..61598391f 100644 --- a/MediaBrowser.Controller/Net/IAuthorizationContext.cs +++ b/MediaBrowser.Controller/Net/IAuthorizationContext.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Services; +using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net { @@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Net /// <param name="requestContext">The request context.</param> /// <returns>AuthorizationInfo.</returns> AuthorizationInfo GetAuthorizationInfo(object requestContext); - + /// <summary> /// Gets the authorization information. /// </summary> diff --git a/MediaBrowser.Controller/Net/IHasResultFactory.cs b/MediaBrowser.Controller/Net/IHasResultFactory.cs index 03144e4b8..b8cf8cd78 100644 --- a/MediaBrowser.Controller/Net/IHasResultFactory.cs +++ b/MediaBrowser.Controller/Net/IHasResultFactory.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Services; +using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net { diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs index f8e631de3..ff9ecf8af 100644 --- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs +++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; @@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Net object GetResult(IRequest requestContext, byte[] content, string contentType, IDictionary<string, string> responseHeaders = null); object GetResult(IRequest requestContext, Stream content, string contentType, IDictionary<string, string> responseHeaders = null); - object GetResult(IRequest requestContext, string content, string contentType, IDictionary<string, string> responseHeaders = null); + object GetResult(IRequest requestContext, string content, string contentType, IDictionary<string, string> responseHeaders = null); object GetRedirectResult(string url); @@ -43,10 +43,10 @@ namespace MediaBrowser.Controller.Net /// <param name="responseHeaders">The response headers.</param> /// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param> /// <returns>System.Object.</returns> - Task<object> GetStaticResult(IRequest requestContext, - Guid cacheKey, + Task<object> GetStaticResult(IRequest requestContext, + Guid cacheKey, DateTime? lastDateModified, - TimeSpan? cacheDuration, + TimeSpan? cacheDuration, string contentType, Func<Task<Stream>> factoryFn, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false); @@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Net /// <param name="requestContext">The request context.</param> /// <param name="options">The options.</param> /// <returns>System.Object.</returns> - Task<object> GetStaticFileResult(IRequest requestContext, + Task<object> GetStaticFileResult(IRequest requestContext, StaticFileResultOptions options); } } diff --git a/MediaBrowser.Controller/Net/IHttpServer.cs b/MediaBrowser.Controller/Net/IHttpServer.cs index d2ebadcfa..f41303007 100644 --- a/MediaBrowser.Controller/Net/IHttpServer.cs +++ b/MediaBrowser.Controller/Net/IHttpServer.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using MediaBrowser.Model.Services; using MediaBrowser.Model.Events; +using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net { diff --git a/MediaBrowser.Controller/Net/ISessionContext.cs b/MediaBrowser.Controller/Net/ISessionContext.cs index 37ddbc2b3..5c3c19f6b 100644 --- a/MediaBrowser.Controller/Net/ISessionContext.cs +++ b/MediaBrowser.Controller/Net/ISessionContext.cs @@ -1,11 +1,10 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Session; -using System.Threading.Tasks; using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net { - public interface ISessionContext + public interface ISessionContext { SessionInfo GetSession(object requestContext); User GetUser(object requestContext); diff --git a/MediaBrowser.Controller/Net/IWebSocketConnection.cs b/MediaBrowser.Controller/Net/IWebSocketConnection.cs index 816e9afca..a09b2f7a2 100644 --- a/MediaBrowser.Controller/Net/IWebSocketConnection.cs +++ b/MediaBrowser.Controller/Net/IWebSocketConnection.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Services; +using System; using System.Net.WebSockets; -using System.Threading.Tasks; using System.Threading; -using System; +using System.Threading.Tasks; +using MediaBrowser.Model.Net; +using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net { @@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Net /// <param name="message">The message.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">message</exception> + /// <exception cref="ArgumentNullException">message</exception> Task SendAsync<T>(WebSocketMessage<T> message, CancellationToken cancellationToken); /// <summary> @@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Net /// <param name="text">The text.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">buffer</exception> + /// <exception cref="ArgumentNullException">buffer</exception> Task SendAsync(string text, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/Net/IWebSocketListener.cs b/MediaBrowser.Controller/Net/IWebSocketListener.cs index 29698c1a4..e38f0e259 100644 --- a/MediaBrowser.Controller/Net/IWebSocketListener.cs +++ b/MediaBrowser.Controller/Net/IWebSocketListener.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace MediaBrowser.Controller.Net { diff --git a/MediaBrowser.Controller/Net/SecurityException.cs b/MediaBrowser.Controller/Net/SecurityException.cs index b251ab9a9..3ccecf0eb 100644 --- a/MediaBrowser.Controller/Net/SecurityException.cs +++ b/MediaBrowser.Controller/Net/SecurityException.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Net { diff --git a/MediaBrowser.Controller/Net/StaticResultOptions.cs b/MediaBrowser.Controller/Net/StaticResultOptions.cs index 1c9b2586d..a54de12be 100644 --- a/MediaBrowser.Controller/Net/StaticResultOptions.cs +++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; diff --git a/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs index 26abbc2d2..f26b764bb 100644 --- a/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs +++ b/MediaBrowser.Controller/Net/WebSocketConnectEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Model.Services; namespace MediaBrowser.Controller.Net diff --git a/MediaBrowser.Controller/Net/WebSocketMessageInfo.cs b/MediaBrowser.Controller/Net/WebSocketMessageInfo.cs index 332f16420..5bf39cae6 100644 --- a/MediaBrowser.Controller/Net/WebSocketMessageInfo.cs +++ b/MediaBrowser.Controller/Net/WebSocketMessageInfo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Net; +using MediaBrowser.Model.Net; namespace MediaBrowser.Controller.Net { @@ -13,4 +13,4 @@ namespace MediaBrowser.Controller.Net /// <value>The connection.</value> public IWebSocketConnection Connection { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Notifications/INotificationManager.cs b/MediaBrowser.Controller/Notifications/INotificationManager.cs index 161f0ffba..44defbe0b 100644 --- a/MediaBrowser.Controller/Notifications/INotificationManager.cs +++ b/MediaBrowser.Controller/Notifications/INotificationManager.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Notifications; using System.Collections.Generic; -using System.Threading.Tasks; using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Notifications; namespace MediaBrowser.Controller.Notifications { diff --git a/MediaBrowser.Controller/Notifications/INotificationService.cs b/MediaBrowser.Controller/Notifications/INotificationService.cs index b1e313b87..8c6019923 100644 --- a/MediaBrowser.Controller/Notifications/INotificationService.cs +++ b/MediaBrowser.Controller/Notifications/INotificationService.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Controller.Entities; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Notifications { diff --git a/MediaBrowser.Controller/Notifications/INotificationTypeFactory.cs b/MediaBrowser.Controller/Notifications/INotificationTypeFactory.cs index bf92aae2d..9f1d2841d 100644 --- a/MediaBrowser.Controller/Notifications/INotificationTypeFactory.cs +++ b/MediaBrowser.Controller/Notifications/INotificationTypeFactory.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.Notifications; using System.Collections.Generic; +using MediaBrowser.Model.Notifications; namespace MediaBrowser.Controller.Notifications { diff --git a/MediaBrowser.Controller/Notifications/UserNotification.cs b/MediaBrowser.Controller/Notifications/UserNotification.cs index d035a3995..3f46468b3 100644 --- a/MediaBrowser.Controller/Notifications/UserNotification.cs +++ b/MediaBrowser.Controller/Notifications/UserNotification.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Notifications; using System; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Notifications; namespace MediaBrowser.Controller.Notifications { diff --git a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs index 25aba6bd9..4424e044b 100644 --- a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs +++ b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; -using MediaBrowser.Model.Entities; using System; +using System.Collections.Generic; using System.Threading; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Persistence { diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 7905ea1aa..0d086fd7e 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -1,9 +1,9 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Threading; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.Persistence diff --git a/MediaBrowser.Controller/Persistence/IRepository.cs b/MediaBrowser.Controller/Persistence/IRepository.cs index 2340ca646..56bf1dd5a 100644 --- a/MediaBrowser.Controller/Persistence/IRepository.cs +++ b/MediaBrowser.Controller/Persistence/IRepository.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Persistence { diff --git a/MediaBrowser.Controller/Persistence/IUserDataRepository.cs b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs index 5ab3f0943..a4bdf60d7 100644 --- a/MediaBrowser.Controller/Persistence/IUserDataRepository.cs +++ b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs @@ -1,7 +1,6 @@ -using System.Collections.Generic; -using MediaBrowser.Controller.Entities; -using System; +using System.Collections.Generic; using System.Threading; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Persistence { diff --git a/MediaBrowser.Controller/Persistence/IUserRepository.cs b/MediaBrowser.Controller/Persistence/IUserRepository.cs index 2817c4255..cd23e5223 100644 --- a/MediaBrowser.Controller/Persistence/IUserRepository.cs +++ b/MediaBrowser.Controller/Persistence/IUserRepository.cs @@ -1,6 +1,5 @@ -using MediaBrowser.Controller.Entities; using System.Collections.Generic; -using System.Threading; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Persistence { @@ -13,7 +12,6 @@ namespace MediaBrowser.Controller.Persistence /// Deletes the user. /// </summary> /// <param name="user">The user.</param> - /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> void DeleteUser(User user); diff --git a/MediaBrowser.Controller/Persistence/MediaStreamQuery.cs b/MediaBrowser.Controller/Persistence/MediaStreamQuery.cs index 10985f57d..7dc563b3a 100644 --- a/MediaBrowser.Controller/Persistence/MediaStreamQuery.cs +++ b/MediaBrowser.Controller/Persistence/MediaStreamQuery.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.Entities; using System; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Persistence { diff --git a/MediaBrowser.Controller/Playlists/IPlaylistManager.cs b/MediaBrowser.Controller/Playlists/IPlaylistManager.cs index d481bf7c5..5001f6842 100644 --- a/MediaBrowser.Controller/Playlists/IPlaylistManager.cs +++ b/MediaBrowser.Controller/Playlists/IPlaylistManager.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Playlists; +using System; using System.Collections.Generic; using System.Threading.Tasks; -using System; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Playlists; namespace MediaBrowser.Controller.Playlists { diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index 642dfde80..969643660 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -1,15 +1,15 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; using System.Linq; -using MediaBrowser.Model.Serialization; +using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; -using System.Threading; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Playlists { @@ -34,13 +34,7 @@ namespace MediaBrowser.Controller.Playlists } [IgnoreDataMember] - public bool IsFile - { - get - { - return IsPlaylistFile(Path); - } - } + public bool IsFile => IsPlaylistFile(Path); public static bool IsPlaylistFile(string path) { @@ -64,49 +58,19 @@ namespace MediaBrowser.Controller.Playlists } [IgnoreDataMember] - protected override bool FilterLinkedChildrenPerUser - { - get - { - return true; - } - } + protected override bool FilterLinkedChildrenPerUser => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return string.Equals(MediaType, "Video", StringComparison.OrdinalIgnoreCase); - } - } + public override bool SupportsPlayedStatus => string.Equals(MediaType, "Video", StringComparison.OrdinalIgnoreCase); [IgnoreDataMember] - public override bool AlwaysScanInternalMetadataPath - { - get - { - return true; - } - } + public override bool AlwaysScanInternalMetadataPath => true; [IgnoreDataMember] - public override bool SupportsCumulativeRunTimeTicks - { - get - { - return true; - } - } + public override bool SupportsCumulativeRunTimeTicks => true; public override double GetDefaultPrimaryImageAspectRatio() { @@ -229,24 +193,12 @@ namespace MediaBrowser.Controller.Playlists } [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; public string PlaylistMediaType { get; set; } [IgnoreDataMember] - public override string MediaType - { - get - { - return PlaylistMediaType; - } - } + public override string MediaType => PlaylistMediaType; public void SetMediaType(string value) { diff --git a/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs b/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs index d294107d7..5deb165f6 100644 --- a/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs +++ b/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; namespace MediaBrowser.Controller.Plugins @@ -15,6 +15,6 @@ namespace MediaBrowser.Controller.Plugins // Find all dictionaries using GetManifestResourceNames, start start with the prefix // Return the one for the culture if exists, otherwise return the default return null; - } + } } } diff --git a/MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs b/MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs index 5feaf798c..c156da924 100644 --- a/MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs +++ b/MediaBrowser.Controller/Plugins/IPluginConfigurationPage.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Common.Plugins; using System.IO; +using MediaBrowser.Common.Plugins; namespace MediaBrowser.Controller.Plugins { diff --git a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs index 9ad829e45..7b7a591aa 100644 --- a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs +++ b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Plugins { diff --git a/MediaBrowser.Controller/Properties/AssemblyInfo.cs b/MediaBrowser.Controller/Properties/AssemblyInfo.cs index 844b93f37..007a1d739 100644 --- a/MediaBrowser.Controller/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Controller/Properties/AssemblyInfo.cs @@ -1,27 +1,21 @@ -using System.Reflection; +using System.Reflection; +using System.Resources; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("MediaBrowser.Controller")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MediaBrowser.Controller")] -[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyCompany("Jellyfin Project")] +[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")] +[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -//
\ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/ArtistInfo.cs b/MediaBrowser.Controller/Providers/ArtistInfo.cs index 8a4abd5c6..08bf3982b 100644 --- a/MediaBrowser.Controller/Providers/ArtistInfo.cs +++ b/MediaBrowser.Controller/Providers/ArtistInfo.cs @@ -11,4 +11,4 @@ namespace MediaBrowser.Controller.Providers SongInfos = new List<SongInfo>(); } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/BookInfo.cs b/MediaBrowser.Controller/Providers/BookInfo.cs index 52519bcb0..03a6737c5 100644 --- a/MediaBrowser.Controller/Providers/BookInfo.cs +++ b/MediaBrowser.Controller/Providers/BookInfo.cs @@ -4,4 +4,4 @@ namespace MediaBrowser.Controller.Providers { public string SeriesName { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/BoxSetInfo.cs b/MediaBrowser.Controller/Providers/BoxSetInfo.cs index f604231de..4cbe2d6ef 100644 --- a/MediaBrowser.Controller/Providers/BoxSetInfo.cs +++ b/MediaBrowser.Controller/Providers/BoxSetInfo.cs @@ -4,4 +4,4 @@ namespace MediaBrowser.Controller.Providers { } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 9bb2f5bed..133e7c115 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -1,8 +1,8 @@ -using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; using MediaBrowser.Model.IO; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Providers { @@ -25,9 +25,7 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata[] GetFileSystemEntries(string path) { - FileSystemMetadata[] entries; - - if (!_cache.TryGetValue(path, out entries)) + if (!_cache.TryGetValue(path, out FileSystemMetadata[] entries)) { //_logger.LogDebug("Getting files for " + path); @@ -56,8 +54,7 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata GetFile(string path) { - FileSystemMetadata file; - if (!_fileCache.TryGetValue(path, out file)) + if (!_fileCache.TryGetValue(path, out FileSystemMetadata file)) { file = _fileSystem.GetFileInfo(path); @@ -83,8 +80,7 @@ namespace MediaBrowser.Controller.Providers public List<string> GetFilePaths(string path, bool clearCache) { - List<string> result; - if (clearCache || !_filePathCache.TryGetValue(path, out result)) + if (clearCache || !_filePathCache.TryGetValue(path, out List<string> result)) { result = _fileSystem.GetFilePaths(path).ToList(); diff --git a/MediaBrowser.Controller/Providers/DynamicImageInfo.cs b/MediaBrowser.Controller/Providers/DynamicImageInfo.cs index 14b4c6afb..0791783c6 100644 --- a/MediaBrowser.Controller/Providers/DynamicImageInfo.cs +++ b/MediaBrowser.Controller/Providers/DynamicImageInfo.cs @@ -7,4 +7,4 @@ namespace MediaBrowser.Controller.Providers public string ImageId { get; set; } public ImageType Type { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/DynamicImageResponse.cs b/MediaBrowser.Controller/Providers/DynamicImageResponse.cs index d19a28a24..11c7ccbe5 100644 --- a/MediaBrowser.Controller/Providers/DynamicImageResponse.cs +++ b/MediaBrowser.Controller/Providers/DynamicImageResponse.cs @@ -33,4 +33,4 @@ namespace MediaBrowser.Controller.Providers } } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/EpisodeInfo.cs b/MediaBrowser.Controller/Providers/EpisodeInfo.cs index 4eafe0e0e..6ecf4edc5 100644 --- a/MediaBrowser.Controller/Providers/EpisodeInfo.cs +++ b/MediaBrowser.Controller/Providers/EpisodeInfo.cs @@ -17,4 +17,4 @@ namespace MediaBrowser.Controller.Providers SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/ExtraInfo.cs b/MediaBrowser.Controller/Providers/ExtraInfo.cs index 1fbe6e93a..413ff2e78 100644 --- a/MediaBrowser.Controller/Providers/ExtraInfo.cs +++ b/MediaBrowser.Controller/Providers/ExtraInfo.cs @@ -12,4 +12,4 @@ namespace MediaBrowser.Controller.Providers public ExtraType ExtraType { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/ExtraSource.cs b/MediaBrowser.Controller/Providers/ExtraSource.cs index 901af60f8..46b246fbc 100644 --- a/MediaBrowser.Controller/Providers/ExtraSource.cs +++ b/MediaBrowser.Controller/Providers/ExtraSource.cs @@ -6,4 +6,4 @@ namespace MediaBrowser.Controller.Providers Metadata = 2, Remote = 3 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/GameInfo.cs b/MediaBrowser.Controller/Providers/GameInfo.cs index 771cf6cec..1f3eb40b7 100644 --- a/MediaBrowser.Controller/Providers/GameInfo.cs +++ b/MediaBrowser.Controller/Providers/GameInfo.cs @@ -8,4 +8,4 @@ namespace MediaBrowser.Controller.Providers /// <value>The game system.</value> public string GameSystem { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/GameSystemInfo.cs b/MediaBrowser.Controller/Providers/GameSystemInfo.cs index efe2635cd..796486b82 100644 --- a/MediaBrowser.Controller/Providers/GameSystemInfo.cs +++ b/MediaBrowser.Controller/Providers/GameSystemInfo.cs @@ -8,4 +8,4 @@ namespace MediaBrowser.Controller.Providers /// <value>The path.</value> public string Path { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs b/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs index af1838d74..2d5a0b364 100644 --- a/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IDirectoryService.cs b/MediaBrowser.Controller/Providers/IDirectoryService.cs index 0b4574f6e..8059d2bd1 100644 --- a/MediaBrowser.Controller/Providers/IDirectoryService.cs +++ b/MediaBrowser.Controller/Providers/IDirectoryService.cs @@ -12,4 +12,4 @@ namespace MediaBrowser.Controller.Providers List<string> GetFilePaths(string path); List<string> GetFilePaths(string path, bool clearCache); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IDynamicImageProvider.cs b/MediaBrowser.Controller/Providers/IDynamicImageProvider.cs index 3e9127fc4..dec327d66 100644 --- a/MediaBrowser.Controller/Providers/IDynamicImageProvider.cs +++ b/MediaBrowser.Controller/Providers/IDynamicImageProvider.cs @@ -24,4 +24,4 @@ namespace MediaBrowser.Controller.Providers /// <returns>Task{DynamicImageResponse}.</returns> Task<DynamicImageResponse> GetImage(BaseItem item, ImageType type, CancellationToken cancellationToken); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IExternalId.cs b/MediaBrowser.Controller/Providers/IExternalId.cs index 946f28199..d7e337bda 100644 --- a/MediaBrowser.Controller/Providers/IExternalId.cs +++ b/MediaBrowser.Controller/Providers/IExternalId.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IExtrasProvider.cs b/MediaBrowser.Controller/Providers/IExtrasProvider.cs index 58775ccac..fa31635cb 100644 --- a/MediaBrowser.Controller/Providers/IExtrasProvider.cs +++ b/MediaBrowser.Controller/Providers/IExtrasProvider.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IForcedProvider.cs b/MediaBrowser.Controller/Providers/IForcedProvider.cs index 9e35b00ad..35fa29d94 100644 --- a/MediaBrowser.Controller/Providers/IForcedProvider.cs +++ b/MediaBrowser.Controller/Providers/IForcedProvider.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Providers { /// <summary> diff --git a/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs b/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs index 7cc05bf67..68acb3910 100644 --- a/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs +++ b/MediaBrowser.Controller/Providers/IHasItemChangeMonitor.cs @@ -12,4 +12,4 @@ namespace MediaBrowser.Controller.Providers /// <returns><c>true</c> if the specified item has changed; otherwise, <c>false</c>.</returns> bool HasChanged(BaseItem item, IDirectoryService directoryService); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IHasLookupInfo.cs b/MediaBrowser.Controller/Providers/IHasLookupInfo.cs index afce49852..4c0c38442 100644 --- a/MediaBrowser.Controller/Providers/IHasLookupInfo.cs +++ b/MediaBrowser.Controller/Providers/IHasLookupInfo.cs @@ -5,4 +5,4 @@ namespace MediaBrowser.Controller.Providers { TLookupInfoType GetLookupInfo(); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IHasOrder.cs b/MediaBrowser.Controller/Providers/IHasOrder.cs index cb5298dd3..a3db61225 100644 --- a/MediaBrowser.Controller/Providers/IHasOrder.cs +++ b/MediaBrowser.Controller/Providers/IHasOrder.cs @@ -4,4 +4,4 @@ namespace MediaBrowser.Controller.Providers { int Order { get; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IImageEnhancer.cs b/MediaBrowser.Controller/Providers/IImageEnhancer.cs index c8ea25335..2de657854 100644 --- a/MediaBrowser.Controller/Providers/IImageEnhancer.cs +++ b/MediaBrowser.Controller/Providers/IImageEnhancer.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Entities; +using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Entities; -using System.Threading.Tasks; namespace MediaBrowser.Controller.Providers { @@ -58,4 +58,4 @@ namespace MediaBrowser.Controller.Providers { public bool RequiresTransparency { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IImageProvider.cs b/MediaBrowser.Controller/Providers/IImageProvider.cs index ac857b2aa..2df3d5ff8 100644 --- a/MediaBrowser.Controller/Providers/IImageProvider.cs +++ b/MediaBrowser.Controller/Providers/IImageProvider.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/ILocalImageFileProvider.cs b/MediaBrowser.Controller/Providers/ILocalImageFileProvider.cs index 96e154dad..72bc56390 100644 --- a/MediaBrowser.Controller/Providers/ILocalImageFileProvider.cs +++ b/MediaBrowser.Controller/Providers/ILocalImageFileProvider.cs @@ -7,4 +7,4 @@ namespace MediaBrowser.Controller.Providers { List<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/ILocalImageProvider.cs b/MediaBrowser.Controller/Providers/ILocalImageProvider.cs index 1027a4cb2..09aaab3de 100644 --- a/MediaBrowser.Controller/Providers/ILocalImageProvider.cs +++ b/MediaBrowser.Controller/Providers/ILocalImageProvider.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.Providers +namespace MediaBrowser.Controller.Providers { /// <summary> /// This is just a marker interface diff --git a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs index fc4cca19c..2a2c379f6 100644 --- a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Controller.Entities; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Providers { @@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Providers /// <param name="directoryService">The directory service.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{MetadataResult{`0}}.</returns> - Task<MetadataResult<TItemType>> GetMetadata(ItemInfo info, + Task<MetadataResult<TItemType>> GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken); } diff --git a/MediaBrowser.Controller/Providers/IMetadataProvider.cs b/MediaBrowser.Controller/Providers/IMetadataProvider.cs index 7da590193..3e595ff93 100644 --- a/MediaBrowser.Controller/Providers/IMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/IMetadataProvider.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IMetadataService.cs b/MediaBrowser.Controller/Providers/IMetadataService.cs index 1c9c4b71a..49f6a7830 100644 --- a/MediaBrowser.Controller/Providers/IMetadataService.cs +++ b/MediaBrowser.Controller/Providers/IMetadataService.cs @@ -1,8 +1,8 @@ -using System; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; +using System; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs b/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs index 608674905..058010e1a 100644 --- a/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs +++ b/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs @@ -2,6 +2,6 @@ namespace MediaBrowser.Controller.Providers { public interface IPreRefreshProvider : ICustomMetadataProvider { - + } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs index f1930ee2f..925ace895 100644 --- a/MediaBrowser.Controller/Providers/IProviderManager.cs +++ b/MediaBrowser.Controller/Providers/IProviderManager.cs @@ -1,15 +1,15 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Providers; using System; using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Events; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Providers { @@ -175,4 +175,4 @@ namespace MediaBrowser.Controller.Providers Normal = 1, Low = 2 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs b/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs index 5db5ddbb2..e56bba3e3 100644 --- a/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs +++ b/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Providers; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Providers { @@ -19,7 +19,7 @@ namespace MediaBrowser.Controller.Providers /// <param name="item">The item.</param> /// <returns>IEnumerable{ImageType}.</returns> IEnumerable<ImageType> GetSupportedImages(BaseItem item); - + /// <summary> /// Gets the images. /// </summary> diff --git a/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs b/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs index 695d488ed..c143b15cd 100644 --- a/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Providers; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/IRemoteSearchProvider.cs b/MediaBrowser.Controller/Providers/IRemoteSearchProvider.cs index 0077def42..fdb0c8eb5 100644 --- a/MediaBrowser.Controller/Providers/IRemoteSearchProvider.cs +++ b/MediaBrowser.Controller/Providers/IRemoteSearchProvider.cs @@ -14,4 +14,4 @@ namespace MediaBrowser.Controller.Providers /// <returns>Task{HttpResponseInfo}.</returns> Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs b/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs index 6cc8a691e..aac41369c 100644 --- a/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs +++ b/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs @@ -1,7 +1,6 @@ -using System.Collections.Generic; -using MediaBrowser.Model.Entities; using System; using System.Linq; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/ItemInfo.cs b/MediaBrowser.Controller/Providers/ItemInfo.cs index 76adfe8a2..f29a8aa70 100644 --- a/MediaBrowser.Controller/Providers/ItemInfo.cs +++ b/MediaBrowser.Controller/Providers/ItemInfo.cs @@ -29,4 +29,4 @@ namespace MediaBrowser.Controller.Providers public bool IsInMixedFolder { get; set; } public bool IsPlaceHolder { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs index dc7a04135..0aaab9a94 100644 --- a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs +++ b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/LocalImageInfo.cs b/MediaBrowser.Controller/Providers/LocalImageInfo.cs index 5e6efe9f6..24cded79b 100644 --- a/MediaBrowser.Controller/Providers/LocalImageInfo.cs +++ b/MediaBrowser.Controller/Providers/LocalImageInfo.cs @@ -1,5 +1,3 @@ - -using MediaBrowser.Controller.IO; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; @@ -10,4 +8,4 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata FileInfo { get; set; } public ImageType Type { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/MetadataProviderPriority.cs b/MediaBrowser.Controller/Providers/MetadataProviderPriority.cs index d01261866..0076bb972 100644 --- a/MediaBrowser.Controller/Providers/MetadataProviderPriority.cs +++ b/MediaBrowser.Controller/Providers/MetadataProviderPriority.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Providers { /// <summary> diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshMode.cs b/MediaBrowser.Controller/Providers/MetadataRefreshMode.cs index 56492006a..02152ee33 100644 --- a/MediaBrowser.Controller/Providers/MetadataRefreshMode.cs +++ b/MediaBrowser.Controller/Providers/MetadataRefreshMode.cs @@ -22,4 +22,4 @@ namespace MediaBrowser.Controller.Providers /// </summary> FullRefresh = 3 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs index 3dbcc5305..b3eb8cdd1 100644 --- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs +++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs @@ -1,8 +1,6 @@ -using System; +using System; using System.Linq; using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.IO; -using Microsoft.Extensions.Logging; using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Providers diff --git a/MediaBrowser.Controller/Providers/MetadataResult.cs b/MediaBrowser.Controller/Providers/MetadataResult.cs index 271f784d7..f4b915c06 100644 --- a/MediaBrowser.Controller/Providers/MetadataResult.cs +++ b/MediaBrowser.Controller/Providers/MetadataResult.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Controller.Entities; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Providers { diff --git a/MediaBrowser.Controller/Providers/MovieInfo.cs b/MediaBrowser.Controller/Providers/MovieInfo.cs index 198336fc0..c9a766fe7 100644 --- a/MediaBrowser.Controller/Providers/MovieInfo.cs +++ b/MediaBrowser.Controller/Providers/MovieInfo.cs @@ -4,4 +4,4 @@ namespace MediaBrowser.Controller.Providers { } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/MusicVideoInfo.cs b/MediaBrowser.Controller/Providers/MusicVideoInfo.cs index 6e12405f7..194b26484 100644 --- a/MediaBrowser.Controller/Providers/MusicVideoInfo.cs +++ b/MediaBrowser.Controller/Providers/MusicVideoInfo.cs @@ -4,4 +4,4 @@ namespace MediaBrowser.Controller.Providers { public string[] Artists { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/PersonLookupInfo.cs b/MediaBrowser.Controller/Providers/PersonLookupInfo.cs index db4dacb0b..3fa6e50b7 100644 --- a/MediaBrowser.Controller/Providers/PersonLookupInfo.cs +++ b/MediaBrowser.Controller/Providers/PersonLookupInfo.cs @@ -4,4 +4,4 @@ namespace MediaBrowser.Controller.Providers { } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/RemoteSearchQuery.cs b/MediaBrowser.Controller/Providers/RemoteSearchQuery.cs index 77cf9e255..078125673 100644 --- a/MediaBrowser.Controller/Providers/RemoteSearchQuery.cs +++ b/MediaBrowser.Controller/Providers/RemoteSearchQuery.cs @@ -1,3 +1,5 @@ +using System; + namespace MediaBrowser.Controller.Providers { public class RemoteSearchQuery<T> @@ -5,7 +7,7 @@ namespace MediaBrowser.Controller.Providers { public T SearchInfo { get; set; } - public string ItemId { get; set; } + public Guid ItemId { get; set; } /// <summary> /// If set will only search within the given provider @@ -18,4 +20,4 @@ namespace MediaBrowser.Controller.Providers /// <value><c>true</c> if [include disabled providers]; otherwise, <c>false</c>.</value> public bool IncludeDisabledProviders { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/SeasonInfo.cs b/MediaBrowser.Controller/Providers/SeasonInfo.cs index 31af268b8..dd2ef9ad7 100644 --- a/MediaBrowser.Controller/Providers/SeasonInfo.cs +++ b/MediaBrowser.Controller/Providers/SeasonInfo.cs @@ -12,4 +12,4 @@ namespace MediaBrowser.Controller.Providers SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/SeriesInfo.cs b/MediaBrowser.Controller/Providers/SeriesInfo.cs index 0b1361757..6c206e031 100644 --- a/MediaBrowser.Controller/Providers/SeriesInfo.cs +++ b/MediaBrowser.Controller/Providers/SeriesInfo.cs @@ -3,4 +3,4 @@ namespace MediaBrowser.Controller.Providers public class SeriesInfo : ItemLookupInfo { } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/TrailerInfo.cs b/MediaBrowser.Controller/Providers/TrailerInfo.cs index ea8377adf..13f07562d 100644 --- a/MediaBrowser.Controller/Providers/TrailerInfo.cs +++ b/MediaBrowser.Controller/Providers/TrailerInfo.cs @@ -3,4 +3,4 @@ namespace MediaBrowser.Controller.Providers public class TrailerInfo : ItemLookupInfo { } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Providers/VideoContentType.cs b/MediaBrowser.Controller/Providers/VideoContentType.cs index 903c77612..c3b8964a3 100644 --- a/MediaBrowser.Controller/Providers/VideoContentType.cs +++ b/MediaBrowser.Controller/Providers/VideoContentType.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Providers { /// <summary> diff --git a/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs b/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs index fc5157d5f..637a7e3f0 100644 --- a/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs +++ b/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Resolvers @@ -24,13 +24,7 @@ namespace MediaBrowser.Controller.Resolvers /// Gets the priority. /// </summary> /// <value>The priority.</value> - public virtual ResolverPriority Priority - { - get - { - return ResolverPriority.First; - } - } + public virtual ResolverPriority Priority => ResolverPriority.First; /// <summary> /// Sets initial values on the newly resolved item diff --git a/MediaBrowser.Controller/Resolvers/IItemResolver.cs b/MediaBrowser.Controller/Resolvers/IItemResolver.cs index 3af5d5f7f..16e37d249 100644 --- a/MediaBrowser.Controller/Resolvers/IItemResolver.cs +++ b/MediaBrowser.Controller/Resolvers/IItemResolver.cs @@ -1,9 +1,7 @@ -using MediaBrowser.Controller.Entities; +using System.Collections.Generic; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; -using System.Collections.Generic; - -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; namespace MediaBrowser.Controller.Resolvers @@ -29,7 +27,7 @@ namespace MediaBrowser.Controller.Resolvers public interface IMultiItemResolver { MultiItemResolverResult ResolveMultiple(Folder parent, - List<FileSystemMetadata> files, + List<FileSystemMetadata> files, string collectionType, IDirectoryService directoryService); } diff --git a/MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs b/MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs index 25537193a..b40cc157a 100644 --- a/MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs +++ b/MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs @@ -1,6 +1,4 @@ - using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; namespace MediaBrowser.Controller.Resolvers diff --git a/MediaBrowser.Controller/Resolvers/ResolverPriority.cs b/MediaBrowser.Controller/Resolvers/ResolverPriority.cs index df5edeb05..e39310095 100644 --- a/MediaBrowser.Controller/Resolvers/ResolverPriority.cs +++ b/MediaBrowser.Controller/Resolvers/ResolverPriority.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Resolvers { /// <summary> diff --git a/MediaBrowser.Controller/Security/AuthenticationInfo.cs b/MediaBrowser.Controller/Security/AuthenticationInfo.cs index c75bf89e4..828213588 100644 --- a/MediaBrowser.Controller/Security/AuthenticationInfo.cs +++ b/MediaBrowser.Controller/Security/AuthenticationInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Security { @@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Security /// </summary> /// <value>The application version.</value> public string AppVersion { get; set; } - + /// <summary> /// Gets or sets the name of the device. /// </summary> @@ -65,6 +65,6 @@ namespace MediaBrowser.Controller.Security public DateTime? DateRevoked { get; set; } public DateTime DateLastActivity { get; set; } - public string UserName { get; set;} + public string UserName { get; set; } } } diff --git a/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs b/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs index 125534c46..2bd17eb26 100644 --- a/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs +++ b/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Security { @@ -21,7 +21,7 @@ namespace MediaBrowser.Controller.Security /// </summary> /// <value>The access token.</value> public string AccessToken { get; set; } - + /// <summary> /// Gets or sets a value indicating whether this instance is active. /// </summary> @@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Security /// </summary> /// <value><c>null</c> if [has user] contains no value, <c>true</c> if [has user]; otherwise, <c>false</c>.</value> public bool? HasUser { get; set; } - + /// <summary> /// Gets or sets the start index. /// </summary> diff --git a/MediaBrowser.Controller/Security/IAuthenticationRepository.cs b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs index 2843c6b73..6a9625613 100644 --- a/MediaBrowser.Controller/Security/IAuthenticationRepository.cs +++ b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs @@ -1,6 +1,5 @@ -using MediaBrowser.Model.Devices; +using MediaBrowser.Model.Devices; using MediaBrowser.Model.Querying; -using System.Threading; namespace MediaBrowser.Controller.Security { @@ -10,7 +9,6 @@ namespace MediaBrowser.Controller.Security /// Creates the specified information. /// </summary> /// <param name="info">The information.</param> - /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> void Create(AuthenticationInfo info); @@ -18,7 +16,6 @@ namespace MediaBrowser.Controller.Security /// Updates the specified information. /// </summary> /// <param name="info">The information.</param> - /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> void Update(AuthenticationInfo info); diff --git a/MediaBrowser.Controller/Security/IEncryptionManager.cs b/MediaBrowser.Controller/Security/IEncryptionManager.cs index bb4f77d83..68680fdf3 100644 --- a/MediaBrowser.Controller/Security/IEncryptionManager.cs +++ b/MediaBrowser.Controller/Security/IEncryptionManager.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Security { public interface IEncryptionManager diff --git a/MediaBrowser.Controller/Session/AuthenticationRequest.cs b/MediaBrowser.Controller/Session/AuthenticationRequest.cs index 0489cf9b6..a28f47a9c 100644 --- a/MediaBrowser.Controller/Session/AuthenticationRequest.cs +++ b/MediaBrowser.Controller/Session/AuthenticationRequest.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Session { diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs index e1d3a7ee6..a59c96ac7 100644 --- a/MediaBrowser.Controller/Session/ISessionController.cs +++ b/MediaBrowser.Controller/Session/ISessionController.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Controller.Session diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs index eca345cbc..771027103 100644 --- a/MediaBrowser.Controller/Session/ISessionManager.cs +++ b/MediaBrowser.Controller/Session/ISessionManager.cs @@ -1,14 +1,14 @@ -using MediaBrowser.Controller.Authentication; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Authentication; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Security; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Events; using MediaBrowser.Model.Session; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; namespace MediaBrowser.Controller.Session { @@ -43,7 +43,7 @@ namespace MediaBrowser.Controller.Session event EventHandler<SessionEventArgs> SessionEnded; event EventHandler<SessionEventArgs> SessionActivity; - + /// <summary> /// Occurs when [capabilities changed]. /// </summary> @@ -58,7 +58,7 @@ namespace MediaBrowser.Controller.Session /// Occurs when [authentication succeeded]. /// </summary> event EventHandler<GenericEventArgs<AuthenticationResult>> AuthenticationSucceeded; - + /// <summary> /// Gets the sessions. /// </summary> @@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Session /// </summary> /// <param name="info">The info.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> Task OnPlaybackProgress(PlaybackProgressInfo info); Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated); @@ -100,7 +100,7 @@ namespace MediaBrowser.Controller.Session /// </summary> /// <param name="info">The info.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException"></exception> + /// <exception cref="ArgumentNullException"></exception> Task OnPlaybackStopped(PlaybackStopInfo info); /// <summary> @@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Session /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken); - + /// <summary> /// Sends the message command. /// </summary> @@ -189,7 +189,7 @@ namespace MediaBrowser.Controller.Session /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> Task SendMessageToUserDeviceSessions<T>(string deviceId, string name, T data, CancellationToken cancellationToken); - + /// <summary> /// Sends the restart required message. /// </summary> diff --git a/MediaBrowser.Controller/Session/SessionEventArgs.cs b/MediaBrowser.Controller/Session/SessionEventArgs.cs index 96daa6ec9..08baaf647 100644 --- a/MediaBrowser.Controller/Session/SessionEventArgs.cs +++ b/MediaBrowser.Controller/Session/SessionEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Controller.Session { diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 77e786ead..d698795dd 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -1,11 +1,11 @@ +using System; +using System.Linq; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; -using System; -using Microsoft.Extensions.Logging; using MediaBrowser.Model.Threading; -using System.Linq; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Session { @@ -142,7 +142,7 @@ namespace MediaBrowser.Controller.Session { if (Capabilities == null) { - return new string[] {}; + return new string[] { }; } return Capabilities.SupportedCommands; } diff --git a/MediaBrowser.Controller/Sorting/IBaseItemComparer.cs b/MediaBrowser.Controller/Sorting/IBaseItemComparer.cs index 6d0b95bcb..31087edec 100644 --- a/MediaBrowser.Controller/Sorting/IBaseItemComparer.cs +++ b/MediaBrowser.Controller/Sorting/IBaseItemComparer.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Controller.Entities; using System.Collections.Generic; +using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Sorting { diff --git a/MediaBrowser.Controller/Sorting/IUserBaseItemComparer.cs b/MediaBrowser.Controller/Sorting/IUserBaseItemComparer.cs index 915d4854b..1e2df37bf 100644 --- a/MediaBrowser.Controller/Sorting/IUserBaseItemComparer.cs +++ b/MediaBrowser.Controller/Sorting/IUserBaseItemComparer.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Sorting diff --git a/MediaBrowser.Controller/Sorting/SortExtensions.cs b/MediaBrowser.Controller/Sorting/SortExtensions.cs index ec8ee5a11..111f4f17f 100644 --- a/MediaBrowser.Controller/Sorting/SortExtensions.cs +++ b/MediaBrowser.Controller/Sorting/SortExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -72,8 +72,8 @@ namespace MediaBrowser.Controller.Sorting char thisCh = s1[thisMarker]; char thatCh = s2[thatMarker]; - StringBuilder thisChunk = new StringBuilder(); - StringBuilder thatChunk = new StringBuilder(); + var thisChunk = new StringBuilder(); + var thatChunk = new StringBuilder(); while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || InChunk(thisCh, thisChunk[0]))) { diff --git a/MediaBrowser.Controller/Sorting/SortHelper.cs b/MediaBrowser.Controller/Sorting/SortHelper.cs index 3456b9b04..05981d975 100644 --- a/MediaBrowser.Controller/Sorting/SortHelper.cs +++ b/MediaBrowser.Controller/Sorting/SortHelper.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Controller.Sorting +namespace MediaBrowser.Controller.Sorting { public static class SortHelper { diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs index e41826be5..2ee58bbe6 100644 --- a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs +++ b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs @@ -1,10 +1,10 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Providers; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Subtitles { diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs b/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs index 2502d685d..8ffd7c530 100644 --- a/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs +++ b/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs @@ -1,9 +1,8 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Providers; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Subtitles { diff --git a/MediaBrowser.Controller/Subtitles/SubtitleDownloadEventArgs.cs b/MediaBrowser.Controller/Subtitles/SubtitleDownloadEventArgs.cs index 1d204f2cb..5703aea17 100644 --- a/MediaBrowser.Controller/Subtitles/SubtitleDownloadEventArgs.cs +++ b/MediaBrowser.Controller/Subtitles/SubtitleDownloadEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Controller.Entities; namespace MediaBrowser.Controller.Subtitles diff --git a/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs b/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs index e2f6dfc97..b8ba35a5f 100644 --- a/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs +++ b/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; namespace MediaBrowser.Controller.Subtitles { @@ -9,4 +9,4 @@ namespace MediaBrowser.Controller.Subtitles public bool IsForced { get; set; } public Stream Stream { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs index daef6db79..61dc72258 100644 --- a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs +++ b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Subtitles { diff --git a/MediaBrowser.Controller/Sync/IHasDynamicAccess.cs b/MediaBrowser.Controller/Sync/IHasDynamicAccess.cs index cf868a381..d6bac23be 100644 --- a/MediaBrowser.Controller/Sync/IHasDynamicAccess.cs +++ b/MediaBrowser.Controller/Sync/IHasDynamicAccess.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.Sync; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Sync; namespace MediaBrowser.Controller.Sync { diff --git a/MediaBrowser.Controller/Sync/IRemoteSyncProvider.cs b/MediaBrowser.Controller/Sync/IRemoteSyncProvider.cs index aeb7a3bff..c0b62b753 100644 --- a/MediaBrowser.Controller/Sync/IRemoteSyncProvider.cs +++ b/MediaBrowser.Controller/Sync/IRemoteSyncProvider.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Controller.Sync { /// <summary> diff --git a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs index 335fea296..8b2d5d779 100644 --- a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs +++ b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs @@ -1,11 +1,10 @@ -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Sync; using System; using System.IO; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.IO; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Sync; namespace MediaBrowser.Controller.Sync { diff --git a/MediaBrowser.Controller/Sync/ISyncProvider.cs b/MediaBrowser.Controller/Sync/ISyncProvider.cs index 0b2fcc95e..56f6f3729 100644 --- a/MediaBrowser.Controller/Sync/ISyncProvider.cs +++ b/MediaBrowser.Controller/Sync/ISyncProvider.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.Sync; using System.Collections.Generic; +using MediaBrowser.Model.Sync; namespace MediaBrowser.Controller.Sync { diff --git a/MediaBrowser.Controller/Sync/SyncedFileInfo.cs b/MediaBrowser.Controller/Sync/SyncedFileInfo.cs index 1c87551f1..2ff40addb 100644 --- a/MediaBrowser.Controller/Sync/SyncedFileInfo.cs +++ b/MediaBrowser.Controller/Sync/SyncedFileInfo.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.MediaInfo; using System.Collections.Generic; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Controller.Sync { diff --git a/MediaBrowser.Controller/TV/ITVSeriesManager.cs b/MediaBrowser.Controller/TV/ITVSeriesManager.cs index 56e06bcfa..09a0f6fea 100644 --- a/MediaBrowser.Controller/TV/ITVSeriesManager.cs +++ b/MediaBrowser.Controller/TV/ITVSeriesManager.cs @@ -1,7 +1,6 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Querying; -using System.Collections.Generic; using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.TV { |
