mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
fix content sometimes not appearing after restart
This commit is contained in:
parent
34d4e4317a
commit
edfc55fdf6
@ -64,10 +64,37 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
protected override IEnumerable<FileSystemMetadata> GetFileSystemChildren(IDirectoryService directoryService)
|
||||
{
|
||||
return CreateResolveArgs(directoryService).FileSystemChildren;
|
||||
return CreateResolveArgs(directoryService, true).FileSystemChildren;
|
||||
}
|
||||
|
||||
private ItemResolveArgs CreateResolveArgs(IDirectoryService directoryService)
|
||||
private bool _requiresRefresh;
|
||||
public override bool RequiresRefresh()
|
||||
{
|
||||
var changed = base.RequiresRefresh() || _requiresRefresh;
|
||||
|
||||
if (!changed)
|
||||
{
|
||||
var locations = PhysicalLocations.ToList();
|
||||
|
||||
var newLocations = CreateResolveArgs(new DirectoryService(BaseItem.FileSystem), false).PhysicalLocations.ToList();
|
||||
|
||||
if (!locations.SequenceEqual(newLocations))
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
public override bool BeforeMetadataRefresh()
|
||||
{
|
||||
var changed = base.BeforeMetadataRefresh() || _requiresRefresh;
|
||||
_requiresRefresh = false;
|
||||
return changed;
|
||||
}
|
||||
|
||||
private ItemResolveArgs CreateResolveArgs(IDirectoryService directoryService, bool setPhysicalLocations)
|
||||
{
|
||||
var path = ContainingFolderPath;
|
||||
|
||||
@ -100,7 +127,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
args.FileSystemDictionary = fileSystemDictionary;
|
||||
}
|
||||
|
||||
PhysicalLocationsList = args.PhysicalLocations.ToList();
|
||||
if (setPhysicalLocations)
|
||||
{
|
||||
_requiresRefresh = !args.PhysicalLocations.SequenceEqual(PhysicalLocations);
|
||||
PhysicalLocationsList = args.PhysicalLocations.ToList();
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
@ -64,15 +64,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the children of this folder from the actual file system
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
protected override IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
|
||||
{
|
||||
return base.GetNonCachedChildren(directoryService);
|
||||
}
|
||||
|
||||
public override bool BeforeMetadataRefresh()
|
||||
{
|
||||
var hasChanges = base.BeforeMetadataRefresh();
|
||||
|
@ -1410,13 +1410,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
.Where(i => i.IsVisibleStandalone(user))
|
||||
.ToList();
|
||||
|
||||
if (folders.Count == 0)
|
||||
{
|
||||
return new QueryResult<BaseItem>();
|
||||
}
|
||||
|
||||
return _libraryManager.GetItemsResult(new InternalItemsQuery(user)
|
||||
{
|
||||
MediaTypes = new[] { MediaType.Video },
|
||||
Recursive = true,
|
||||
AncestorIds = folders.Select(i => i.Id.ToString("N")).ToArray(),
|
||||
ExcludeLocationTypes = new[] { LocationType.Virtual },
|
||||
Limit = Math.Min(10, query.Limit ?? int.MaxValue)
|
||||
Limit = Math.Min(10, query.Limit ?? int.MaxValue),
|
||||
SortBy = new[] { ItemSortBy.DateCreated },
|
||||
SortOrder = SortOrder.Descending
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
_saveItemCommand.GetParameter(index++).Value = item.DateLastRefreshed;
|
||||
}
|
||||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.DateLastSaved;
|
||||
if (item.DateLastSaved == default(DateTime))
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveItemCommand.GetParameter(index++).Value = item.DateLastSaved;
|
||||
}
|
||||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.IsInMixedFolder;
|
||||
_saveItemCommand.GetParameter(index++).Value = string.Join("|", item.LockedFields.Select(i => i.ToString()).ToArray());
|
||||
_saveItemCommand.GetParameter(index++).Value = string.Join("|", item.Studios.ToArray());
|
||||
|
Loading…
Reference in New Issue
Block a user