fix directory watchers not picking up changes
This commit is contained in:
parent
9f5fbfa855
commit
64818ebd22
|
@ -285,8 +285,13 @@ namespace MediaBrowser.Api.Library
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
// No need to start if scanning the library because it will handle it
|
||||||
|
if (!request.RefreshLibrary)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Start();
|
_directoryWatchers.Start();
|
||||||
|
}
|
||||||
|
|
||||||
_directoryWatchers.RemoveTempIgnore(virtualFolderPath);
|
_directoryWatchers.RemoveTempIgnore(virtualFolderPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,8 +357,13 @@ namespace MediaBrowser.Api.Library
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
// No need to start if scanning the library because it will handle it
|
||||||
|
if (!request.RefreshLibrary)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Start();
|
_directoryWatchers.Start();
|
||||||
|
}
|
||||||
|
|
||||||
_directoryWatchers.RemoveTempIgnore(currentPath);
|
_directoryWatchers.RemoveTempIgnore(currentPath);
|
||||||
_directoryWatchers.RemoveTempIgnore(newPath);
|
_directoryWatchers.RemoveTempIgnore(newPath);
|
||||||
}
|
}
|
||||||
|
@ -403,8 +413,13 @@ namespace MediaBrowser.Api.Library
|
||||||
Task.WaitAll(delayTask);
|
Task.WaitAll(delayTask);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
// No need to start if scanning the library because it will handle it
|
||||||
|
if (!request.RefreshLibrary)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Start();
|
_directoryWatchers.Start();
|
||||||
|
}
|
||||||
|
|
||||||
_directoryWatchers.RemoveTempIgnore(path);
|
_directoryWatchers.RemoveTempIgnore(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,9 +456,13 @@ namespace MediaBrowser.Api.Library
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
// No need to start if scanning the library because it will handle it
|
||||||
|
if (!request.RefreshLibrary)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Start();
|
_directoryWatchers.Start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (request.RefreshLibrary)
|
if (request.RefreshLibrary)
|
||||||
{
|
{
|
||||||
|
@ -478,9 +497,13 @@ namespace MediaBrowser.Api.Library
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
// No need to start if scanning the library because it will handle it
|
||||||
|
if (!request.RefreshLibrary)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Start();
|
_directoryWatchers.Start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (request.RefreshLibrary)
|
if (request.RefreshLibrary)
|
||||||
{
|
{
|
||||||
|
|
|
@ -372,22 +372,12 @@ namespace MediaBrowser.Api
|
||||||
return episodes.Where(i => (i.PhysicalSeasonNumber ?? -1) == seasonNumber);
|
return episodes.Where(i => (i.PhysicalSeasonNumber ?? -1) == seasonNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodeList = episodes.ToList();
|
return episodes.Where(i =>
|
||||||
|
|
||||||
// We can only enforce the air date requirement if the episodes have air dates
|
|
||||||
var enforceAirDate = episodeList.Any(i => i.PremiereDate.HasValue);
|
|
||||||
|
|
||||||
return episodeList.Where(i =>
|
|
||||||
{
|
{
|
||||||
var episode = i;
|
var episode = i;
|
||||||
|
|
||||||
if (episode != null)
|
if (episode != null)
|
||||||
{
|
{
|
||||||
if (enforceAirDate && !episode.PremiereDate.HasValue)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentSeasonNumber = episode.AiredSeasonNumber;
|
var currentSeasonNumber = episode.AiredSeasonNumber;
|
||||||
|
|
||||||
return currentSeasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber;
|
return currentSeasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Threading;
|
using MediaBrowser.Model.LiveTv;
|
||||||
using MediaBrowser.Model.LiveTv;
|
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.LiveTv
|
namespace MediaBrowser.Controller.LiveTv
|
||||||
|
|
|
@ -101,6 +101,18 @@ namespace MediaBrowser.Model.LiveTv
|
||||||
/// <value>The recording status.</value>
|
/// <value>The recording status.</value>
|
||||||
public RecordingStatus? RecordingStatus { get; set; }
|
public RecordingStatus? RecordingStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timer identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The timer identifier.</value>
|
||||||
|
public string TimerId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timer status.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The timer status.</value>
|
||||||
|
public RecordingStatus? TimerStatus { get; set; }
|
||||||
|
|
||||||
public ProgramInfoDto()
|
public ProgramInfoDto()
|
||||||
{
|
{
|
||||||
Genres = new List<string>();
|
Genres = new List<string>();
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.IO;
|
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace MediaBrowser.Server.Implementations.IO
|
||||||
// This is an arbitraty amount of time, but delay it because file system writes often trigger events after RemoveTempIgnore has been called.
|
// This is an arbitraty amount of time, but delay it because file system writes often trigger events after RemoveTempIgnore has been called.
|
||||||
// Seeing long delays in some situations, especially over the network.
|
// Seeing long delays in some situations, especially over the network.
|
||||||
// Seeing delays up to 40 seconds, but not going to ignore changes for that long.
|
// Seeing delays up to 40 seconds, but not going to ignore changes for that long.
|
||||||
await Task.Delay(20000).ConfigureAwait(false);
|
await Task.Delay(1500).ConfigureAwait(false);
|
||||||
|
|
||||||
string val;
|
string val;
|
||||||
_tempIgnoredPaths.TryRemove(path, out val);
|
_tempIgnoredPaths.TryRemove(path, out val);
|
||||||
|
|
|
@ -905,6 +905,20 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task ValidateMediaLibraryInternal(IProgress<double> progress, CancellationToken cancellationToken)
|
public async Task ValidateMediaLibraryInternal(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_directoryWatchersFactory().Stop();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await PerformLibraryValidation(progress, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_directoryWatchersFactory().Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task PerformLibraryValidation(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_logger.Info("Validating media library");
|
_logger.Info("Validating media library");
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
{
|
{
|
||||||
class RefreshChannelsScheduledTask : IScheduledTask
|
class RefreshChannelsScheduledTask
|
||||||
{
|
{
|
||||||
private readonly ILiveTvManager _liveTvManager;
|
private readonly ILiveTvManager _liveTvManager;
|
||||||
|
|
||||||
|
|
|
@ -199,8 +199,6 @@ namespace MediaBrowser.ServerApplication
|
||||||
{
|
{
|
||||||
await base.RunStartupTasks().ConfigureAwait(false);
|
await base.RunStartupTasks().ConfigureAwait(false);
|
||||||
|
|
||||||
DirectoryWatchers.Start();
|
|
||||||
|
|
||||||
Logger.Info("Core startup complete");
|
Logger.Info("Core startup complete");
|
||||||
|
|
||||||
Parallel.ForEach(GetExports<IServerEntryPoint>(), entryPoint =>
|
Parallel.ForEach(GetExports<IServerEntryPoint>(), entryPoint =>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user