aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/BaseItem.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs49
1 files changed, 12 insertions, 37 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 0f62e8e1e..2bb966d2c 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -231,7 +231,7 @@ namespace MediaBrowser.Controller.Entities
{
get
{
- if (!ChannelId.Equals(Guid.Empty))
+ if (!ChannelId.Equals(default))
{
return SourceType.Channel;
}
@@ -521,7 +521,7 @@ namespace MediaBrowser.Controller.Entities
get
{
var id = DisplayParentId;
- if (id.Equals(Guid.Empty))
+ if (id.Equals(default))
{
return null;
}
@@ -737,7 +737,7 @@ namespace MediaBrowser.Controller.Entities
public virtual bool StopRefreshIfLocalMetadataFound => true;
[JsonIgnore]
- protected virtual bool SupportsOwnedItems => !ParentId.Equals(Guid.Empty) && IsFileProtocol;
+ protected virtual bool SupportsOwnedItems => !ParentId.Equals(default) && IsFileProtocol;
[JsonIgnore]
public virtual bool SupportsPeople => false;
@@ -848,7 +848,7 @@ namespace MediaBrowser.Controller.Entities
public BaseItem GetOwner()
{
var ownerId = OwnerId;
- return ownerId.Equals(Guid.Empty) ? null : LibraryManager.GetItemById(ownerId);
+ return ownerId.Equals(default) ? null : LibraryManager.GetItemById(ownerId);
}
public bool CanDelete(User user, List<Folder> allCollectionFolders)
@@ -878,16 +878,13 @@ namespace MediaBrowser.Controller.Entities
return CanDownload() && IsAuthorizedToDownload(user);
}
- /// <summary>
- /// Returns a <see cref="string" /> that represents this instance.
- /// </summary>
- /// <returns>A <see cref="string" /> that represents this instance.</returns>
+ /// <inheritdoc />
public override string ToString()
{
return Name;
}
- public string GetInternalMetadataPath()
+ public virtual string GetInternalMetadataPath()
{
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
@@ -984,12 +981,12 @@ namespace MediaBrowser.Controller.Entities
public BaseItem GetParent()
{
var parentId = ParentId;
- if (!parentId.Equals(Guid.Empty))
+ if (parentId.Equals(default))
{
- return LibraryManager.GetItemById(parentId);
+ return null;
}
- return null;
+ return LibraryManager.GetItemById(parentId);
}
public IEnumerable<BaseItem> GetParents()
@@ -1397,7 +1394,7 @@ namespace MediaBrowser.Controller.Entities
var tasks = extras.Select(i =>
{
var subOptions = new MetadataRefreshOptions(options);
- if (i.OwnerId != ownerId || i.ParentId != Guid.Empty)
+ if (!i.OwnerId.Equals(ownerId) || !i.ParentId.Equals(default))
{
i.OwnerId = ownerId;
i.ParentId = Guid.Empty;
@@ -1595,23 +1592,6 @@ namespace MediaBrowser.Controller.Entities
return value.Value <= maxAllowedRating.Value;
}
- public int? GetParentalRatingValue()
- {
- var rating = CustomRating;
-
- if (string.IsNullOrEmpty(rating))
- {
- rating = OfficialRating;
- }
-
- if (string.IsNullOrEmpty(rating))
- {
- return null;
- }
-
- return LocalizationManager.GetRatingLevel(rating);
- }
-
public int? GetInheritedParentalRatingValue()
{
var rating = CustomRatingForComparison;
@@ -1652,11 +1632,6 @@ namespace MediaBrowser.Controller.Entities
return true;
}
- protected virtual bool IsAllowTagFilterEnforced()
- {
- return true;
- }
-
public virtual UnratedItem GetBlockUnratedType()
{
if (SourceType == SourceType.Channel)
@@ -1736,7 +1711,7 @@ namespace MediaBrowser.Controller.Entities
// First get using the cached Id
if (info.ItemId.HasValue)
{
- if (info.ItemId.Value.Equals(Guid.Empty))
+ if (info.ItemId.Value.Equals(default))
{
return null;
}
@@ -2657,7 +2632,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <inheritdoc />
- public bool Equals(BaseItem other) => Id == other?.Id;
+ public bool Equals(BaseItem other) => other is not null && other.Id.Equals(Id);
/// <inheritdoc />
public override int GetHashCode() => HashCode.Combine(Id);