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.cs37
1 files changed, 33 insertions, 4 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 2adc4ecb9..4c9008b22 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1,5 +1,8 @@
using MediaBrowser.Model.Entities;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.IO;
using System;
+using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
@@ -7,6 +10,15 @@ namespace MediaBrowser.Controller.Entities
{
public abstract class BaseItem : BaseEntity, IHasProviderIds
{
+
+ public IEnumerable<string> PhysicalLocations
+ {
+ get
+ {
+ return _resolveArgs.PhysicalLocations;
+ }
+ }
+
public string SortName { get; set; }
/// <summary>
@@ -14,10 +26,6 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public DateTime? PremiereDate { get; set; }
- public string Path { get; set; }
-
- public Folder Parent { get; set; }
-
public string LogoImagePath { get; set; }
public string ArtImagePath { get; set; }
@@ -135,6 +143,18 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
+ /// Determine if we have changed vs the passed in copy
+ /// </summary>
+ /// <param name="copy"></param>
+ /// <returns></returns>
+ public virtual bool IsChanged(BaseItem copy)
+ {
+ bool changed = copy.DateModified != this.DateModified;
+ if (changed) MediaBrowser.Common.Logging.Logger.LogDebugInfo(this.Name + " changed - original creation: " + this.DateCreated + " new creation: " + copy.DateCreated + " original modified: " + this.DateModified + " new modified: " + copy.DateModified);
+ return changed;
+ }
+
+ /// <summary>
/// Determines if the item is considered new based on user settings
/// </summary>
public bool IsRecentlyAdded(User user)
@@ -169,5 +189,14 @@ namespace MediaBrowser.Controller.Entities
data.PlaybackPositionTicks = 0;
}
}
+
+ /// <summary>
+ /// Do whatever refreshing is necessary when the filesystem pertaining to this item has changed.
+ /// </summary>
+ /// <returns></returns>
+ public virtual Task ChangedExternally()
+ {
+ return Task.Run(() => RefreshMetadata());
+ }
}
}