mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-21 05:00:39 +02:00
Attach ItemResolveEventArgs to BaseItem so providers can access them at any time
This commit is contained in:
parent
17106ea5c7
commit
7cfa489c6e
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -7,6 +8,13 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
public abstract class BaseItem : BaseEntity, IHasProviderIds
|
public abstract class BaseItem : BaseEntity, IHasProviderIds
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 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
|
||||||
|
/// </summary>
|
||||||
|
public ItemResolveEventArgs ResolveArgs { get; set; }
|
||||||
|
|
||||||
public string SortName { get; set; }
|
public string SortName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -171,6 +171,10 @@ namespace MediaBrowser.Controller.Entities
|
||||||
if (currentChild.IsChanged(child))
|
if (currentChild.IsChanged(child))
|
||||||
{
|
{
|
||||||
changed = true;
|
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();
|
currentChild.RefreshMetadata();
|
||||||
//save it in repo...
|
//save it in repo...
|
||||||
validChildren.Add(currentChild);
|
validChildren.Add(currentChild);
|
||||||
|
|
|
@ -129,6 +129,7 @@ namespace MediaBrowser.Controller
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
|
item.ResolveArgs = args;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +161,7 @@ namespace MediaBrowser.Controller
|
||||||
|
|
||||||
void RootFolder_ChildrenChanged(object sender, ChildrenChangedEventArgs e)
|
void RootFolder_ChildrenChanged(object sender, ChildrenChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Logger.LogDebugInfo("Root Folder Children Changed. Added: " + e.ItemsAdded.Count + " Removed: " + e.ItemsRemoved.Count());
|
||||||
//re-start the directory watchers
|
//re-start the directory watchers
|
||||||
DirectoryWatchers.Stop();
|
DirectoryWatchers.Stop();
|
||||||
DirectoryWatchers.Start();
|
DirectoryWatchers.Start();
|
||||||
|
|
Loading…
Reference in a new issue