From 7cfa489c6ea7887982d4cb7643e23631448421e5 Mon Sep 17 00:00:00 2001 From: ebr11 Eric Reed spam Date: Mon, 17 Sep 2012 12:55:58 -0400 Subject: Attach ItemResolveEventArgs to BaseItem so providers can access them at any time --- MediaBrowser.Controller/Entities/BaseItem.cs | 8 ++++++++ MediaBrowser.Controller/Entities/Folder.cs | 4 ++++ 2 files changed, 12 insertions(+) (limited to 'MediaBrowser.Controller/Entities') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index d135acf9cf..17f32c0e6d 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.Entities; +using MediaBrowser.Controller.Library; using System; using System.Collections.Generic; using System.Linq; @@ -7,6 +8,13 @@ namespace MediaBrowser.Controller.Entities { public abstract class BaseItem : BaseEntity, IHasProviderIds { + /// + /// We attach these to the item so that we only ever have to hit the file system once + /// (this includes the children of the containing folder) + /// Use ResolveArgs.FileSystemChildren to check for the existence of files instead of File.Exists + /// + public ItemResolveEventArgs ResolveArgs { get; set; } + public string SortName { get; set; } /// diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 0858500f0d..1e099e14d8 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -171,6 +171,10 @@ namespace MediaBrowser.Controller.Entities if (currentChild.IsChanged(child)) { changed = true; + //update resolve args and refresh meta + // Note - we are refreshing the existing child instead of the newly found one so the "Except" operation below + // will identify this item as the same one + currentChild.ResolveArgs = child.ResolveArgs; currentChild.RefreshMetadata(); //save it in repo... validChildren.Add(currentChild); -- cgit v1.2.3