mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 11:57:55 +02:00
have seasons refresh on series folder changes
This commit is contained in:
parent
de005051f8
commit
e23efc9a84
5 changed files with 62 additions and 72 deletions
|
@ -325,6 +325,16 @@ namespace MediaBrowser.Controller.Providers
|
||||||
return !item.ResolveArgs.IsDirectory;
|
return !item.ResolveArgs.IsDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual IEnumerable<BaseItem> GetItemsForFileStampComparison(BaseItem item)
|
||||||
|
{
|
||||||
|
if (UseParentFileSystemStamp(item) && item.Parent != null)
|
||||||
|
{
|
||||||
|
return new[] { item.Parent };
|
||||||
|
}
|
||||||
|
|
||||||
|
return new[] { item };
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the item's current file system stamp
|
/// Gets the item's current file system stamp
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -332,12 +342,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
private Guid GetCurrentFileSystemStamp(BaseItem item)
|
private Guid GetCurrentFileSystemStamp(BaseItem item)
|
||||||
{
|
{
|
||||||
if (UseParentFileSystemStamp(item) && item.Parent != null)
|
return GetFileSystemStamp(GetItemsForFileStampComparison(item));
|
||||||
{
|
|
||||||
return GetFileSystemStamp(item.Parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetFileSystemStamp(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, string> _fileStampExtensionsDictionary;
|
private Dictionary<string, string> _fileStampExtensionsDictionary;
|
||||||
|
@ -355,42 +360,36 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the file system stamp.
|
/// Gets the file system stamp.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="items">The items.</param>
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
protected virtual Guid GetFileSystemStamp(BaseItem item)
|
protected virtual Guid GetFileSystemStamp(IEnumerable<BaseItem> items)
|
||||||
{
|
{
|
||||||
// If there's no path or the item is a file, there's nothing to do
|
|
||||||
if (item.LocationType != LocationType.FileSystem)
|
|
||||||
{
|
|
||||||
return Guid.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemResolveArgs resolveArgs;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
resolveArgs = item.ResolveArgs;
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
Logger.ErrorException("Error determining if path is directory: {0}", ex, item.Path);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!resolveArgs.IsDirectory)
|
|
||||||
{
|
|
||||||
return Guid.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
var extensions = FileStampExtensionsDictionary;
|
var extensions = FileStampExtensionsDictionary;
|
||||||
var numExtensions = FilestampExtensions.Length;
|
var numExtensions = FilestampExtensions.Length;
|
||||||
|
|
||||||
// Record the name of each file
|
foreach (var item in items)
|
||||||
// Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order
|
{
|
||||||
AddFiles(sb, resolveArgs.FileSystemChildren, extensions, numExtensions);
|
// If there's no path or the item is a file, there's nothing to do
|
||||||
AddFiles(sb, resolveArgs.MetadataFiles, extensions, numExtensions);
|
if (item.LocationType == LocationType.FileSystem)
|
||||||
|
{
|
||||||
|
var resolveArgs = item.ResolveArgs;
|
||||||
|
|
||||||
|
if (resolveArgs.IsDirectory)
|
||||||
|
{
|
||||||
|
// Record the name of each file
|
||||||
|
// Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order
|
||||||
|
AddFiles(sb, resolveArgs.FileSystemChildren, extensions, numExtensions);
|
||||||
|
AddFiles(sb, resolveArgs.MetadataFiles, extensions, numExtensions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sb.Length == 0)
|
||||||
|
{
|
||||||
|
return Guid.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
return sb.ToString().GetMD5();
|
return sb.ToString().GetMD5();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +1,17 @@
|
||||||
<Properties>
|
<Properties>
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.Server.Implementations\Library\UserManager.cs">
|
<MonoDevelop.Ide.Workbench ActiveDocument="C:\Program Files (x86)\Mono-3.2.3\lib\mono\4.0\Microsoft.Common.targets">
|
||||||
<Files>
|
<Files>
|
||||||
<File FileName="MediaBrowser.Server.Mono\app.config" Line="9" Column="10" />
|
<File FileName="MediaBrowser.Server.Mono\app.config" Line="1" Column="1" />
|
||||||
<File FileName="MediaBrowser.Server.Mono\FFMpeg\FFMpegDownloadInfo.cs" Line="1" Column="1" />
|
<File FileName="MediaBrowser.Server.Mono\FFMpeg\FFMpegDownloadInfo.cs" Line="1" Column="1" />
|
||||||
<File FileName="MediaBrowser.Server.Mono\Program.cs" Line="84" Column="7" />
|
<File FileName="MediaBrowser.Server.Mono\Program.cs" Line="1" Column="1" />
|
||||||
<File FileName="MediaBrowser.Server.Implementations\Library\UserManager.cs" Line="235" Column="10" />
|
<File FileName="MediaBrowser.Server.Implementations\Library\UserManager.cs" Line="407" Column="4" />
|
||||||
|
<File FileName="C:\Program Files (x86)\Mono-3.2.3\lib\mono\4.0\Microsoft.Common.targets" Line="8" Column="15" />
|
||||||
</Files>
|
</Files>
|
||||||
<Pads>
|
|
||||||
<Pad Id="ProjectPad">
|
|
||||||
<State expanded="True">
|
|
||||||
<Node name="MediaBrowser.Api" expanded="True" />
|
|
||||||
<Node name="MediaBrowser.Common" expanded="True" />
|
|
||||||
<Node name="MediaBrowser.Common.Implementations" expanded="True" />
|
|
||||||
<Node name="MediaBrowser.Controller" expanded="True" />
|
|
||||||
<Node name="MediaBrowser.Server.Implementations" expanded="True">
|
|
||||||
<Node name="Library" expanded="True">
|
|
||||||
<Node name="UserManager.cs" selected="True" />
|
|
||||||
</Node>
|
|
||||||
</Node>
|
|
||||||
<Node name="MediaBrowser.Server.Mono" expanded="True">
|
|
||||||
<Node name="References" expanded="True" />
|
|
||||||
<Node name="FFMpeg" expanded="True" />
|
|
||||||
</Node>
|
|
||||||
<Node name="MediaBrowser.WebDashboard" expanded="True" />
|
|
||||||
</State>
|
|
||||||
</Pad>
|
|
||||||
<Pad Id="ClassPad">
|
|
||||||
<State expanded="True" selected="True" />
|
|
||||||
</Pad>
|
|
||||||
<Pad Id="MonoDevelop.Debugger.WatchPad">
|
|
||||||
<State />
|
|
||||||
</Pad>
|
|
||||||
</Pads>
|
|
||||||
</MonoDevelop.Ide.Workbench>
|
</MonoDevelop.Ide.Workbench>
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||||
<BreakpointStore>
|
<BreakpointStore>
|
||||||
<Breakpoint file="D:\Development\MediaBrowser\MediaBrowser.Common.Implementations\HttpClientManager\HttpClientManager.cs" line="477" column="17" />
|
<Breakpoint file="D:\Development\MediaBrowser\MediaBrowser.Common.Implementations\HttpClientManager\HttpClientManager.cs" line="477" column="17" />
|
||||||
<Breakpoint file="D:\Development\MediaBrowser\MediaBrowser.Server.Implementations\Library\UserManager.cs" line="222" column="1" />
|
|
||||||
</BreakpointStore>
|
</BreakpointStore>
|
||||||
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||||
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
|
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.IO;
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -35,9 +36,9 @@ namespace MediaBrowser.Providers
|
||||||
.FirstOrDefault(i => i != null);
|
.FirstOrDefault(i => i != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Guid GetFileSystemStamp(BaseItem item)
|
protected override Guid GetFileSystemStamp(IEnumerable<BaseItem> items)
|
||||||
{
|
{
|
||||||
var files = item.ResolveArgs.PhysicalLocations
|
var files = items.SelectMany(i => i.ResolveArgs.PhysicalLocations)
|
||||||
.Select(i => new DirectoryInfo(i))
|
.Select(i => new DirectoryInfo(i))
|
||||||
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
|
|
|
@ -58,6 +58,21 @@ namespace MediaBrowser.Providers
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IEnumerable<BaseItem> GetItemsForFileStampComparison(BaseItem item)
|
||||||
|
{
|
||||||
|
var season = item as Season;
|
||||||
|
if (season != null)
|
||||||
|
{
|
||||||
|
var series = season.Series;
|
||||||
|
if (series != null)
|
||||||
|
{
|
||||||
|
return new[] { item, series };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetItemsForFileStampComparison(item);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the priority.
|
/// Gets the priority.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.IO;
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -69,9 +70,9 @@ namespace MediaBrowser.Providers
|
||||||
return GetImageFromLocation(location, filenameWithoutExtension);
|
return GetImageFromLocation(location, filenameWithoutExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Guid GetFileSystemStamp(BaseItem item)
|
protected override Guid GetFileSystemStamp(IEnumerable<BaseItem> items)
|
||||||
{
|
{
|
||||||
var location = GetLocation(item);
|
var location = GetLocation(items.First());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue