aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/BaseItem.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2019-01-19 15:11:50 -0500
committerGitHub <noreply@github.com>2019-01-19 15:11:50 -0500
commit55538764fa06a64795c099fc6496df9dbb4156bd (patch)
tree8c1f94861ecebdf634b70a7265945b6f8f13aff1 /MediaBrowser.Controller/Entities/BaseItem.cs
parent3b52035ee064a5d9aa215d9515211d4508585d39 (diff)
parentc5430f86b0b5863482e7c4f7e55a79c7d88c133b (diff)
Merge pull request #575 from EraYaN/reformat
Reformat all C# server code to conform with code standards
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs257
1 files changed, 62 insertions, 195 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 8298f4087..68374c8df 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
@@ -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.
@@ -1602,10 +1515,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,7 +1661,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The user.</param>
/// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns>
- /// <exception cref="System.ArgumentNullException">user</exception>
+ /// <exception cref="ArgumentNullException">user</exception>
public bool IsParentalAllowed(User user)
{
if (user == null)
@@ -1901,7 +1811,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <param name="user">The user.</param>
/// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns>
- /// <exception cref="System.ArgumentNullException">user</exception>
+ /// <exception cref="ArgumentNullException">user</exception>
public virtual bool IsVisible(User user)
{
if (user == null)
@@ -1923,10 +1833,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 +1876,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,19 +1965,13 @@ 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))
@@ -2101,7 +1990,7 @@ namespace MediaBrowser.Controller.Entities
else
{
var list =
- Studios = current.Concat(new [] { name }).ToArray();
+ Studios = current.Concat(new[] { name }).ToArray();
}
}
}
@@ -2115,7 +2004,7 @@ 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))
@@ -2139,7 +2028,7 @@ 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)
@@ -2176,7 +2065,7 @@ 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)
@@ -2215,7 +2104,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 +2130,7 @@ namespace MediaBrowser.Controller.Entities
else
{
var currentCount = ImageInfos.Length;
- ImageInfos = ImageInfos.Concat(new [] { image }) .ToArray();
+ ImageInfos = ImageInfos.Concat(new[] { image }).ToArray();
}
}
@@ -2256,7 +2145,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 +2232,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 +2294,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)
@@ -2813,22 +2702,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 +2792,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 +2803,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;
}
}