Move PhysicalLocations to baseitem

This commit is contained in:
ebr11 Eric Reed spam
2012-09-20 13:52:56 -04:00
parent e2ae376eef
commit ef07c2e6ab
4 changed files with 30 additions and 24 deletions

View File

@@ -10,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>
@@ -136,12 +145,12 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Determine if we have changed vs the passed in copy
/// </summary>
/// <param name="original"></param>
/// <param name="copy"></param>
/// <returns></returns>
public virtual bool IsChanged(BaseItem original)
public virtual bool IsChanged(BaseItem copy)
{
bool changed = original.DateModified != this.DateModified;
changed |= original.DateCreated != this.DateCreated;
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;
}

View File

@@ -32,8 +32,6 @@ namespace MediaBrowser.Controller.Entities
#endregion
public IEnumerable<string> PhysicalLocations { get; set; }
public override bool IsFolder
{
get
@@ -155,7 +153,7 @@ namespace MediaBrowser.Controller.Entities
changedArgs.ItemsAdded.Add(child);
//refresh it
child.RefreshMetadata();
//Logger.LogInfo("New Item Added to Library: ("+child.GetType().Name+") "+ child.Name + " (" + child.Path + ")");
Logger.LogInfo("New Item Added to Library: ("+child.GetType().Name+") "+ child.Name + " (" + child.Path + ")");
//save it in repo...
//and add it to our valid children
@@ -199,6 +197,8 @@ namespace MediaBrowser.Controller.Entities
//now, if anything changed - replace our children
if (changed)
{
if (changedArgs.ItemsRemoved != null) foreach (var item in changedArgs.ItemsRemoved) Logger.LogDebugInfo("** " + item.Name + " Removed from library.");
lock (childLock)
ActualChildren = validChildren;
//and save children in repo...
@@ -613,7 +613,7 @@ namespace MediaBrowser.Controller.Entities
}
//this should be functionally equivilent to what was here since it is IEnum and works on a thread-safe copy
return RecursiveChildren.FirstOrDefault(i => i.Path.Equals(path, StringComparison.OrdinalIgnoreCase));
return RecursiveChildren.FirstOrDefault(i => i.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase));
}
}
}

View File

@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Resolvers
{
if (args.IsDirectory)
{
return new Folder() { PhysicalLocations = args.PhysicalLocations };
return new Folder();
}
return null;