mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Merge pull request #14028 from Shadowghost/cleanup-tasks
Cleanup Tasks and Validators
This commit is contained in:
commit
b4a58ee13a
@ -5,13 +5,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class ArtistsPostScanTask.
|
||||||
|
/// </summary>
|
||||||
|
public class ArtistsPostScanTask : ILibraryPostScanTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class ArtistsPostScanTask.
|
|
||||||
/// </summary>
|
|
||||||
public class ArtistsPostScanTask : ILibraryPostScanTask
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _library manager.
|
/// The _library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -45,5 +45,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
{
|
{
|
||||||
return new ArtistsValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
return new ArtistsValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class ArtistsValidator.
|
||||||
|
/// </summary>
|
||||||
|
public class ArtistsValidator
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class ArtistsValidator.
|
|
||||||
/// </summary>
|
|
||||||
public class ArtistsValidator
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The library manager.
|
/// The library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -82,7 +82,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery
|
var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { BaseItemKind.MusicArtist },
|
IncludeItemTypes = [BaseItemKind.MusicArtist],
|
||||||
IsDeadArtist = true,
|
IsDeadArtist = true,
|
||||||
IsLocked = false
|
IsLocked = false
|
||||||
}).Cast<MusicArtist>().ToList();
|
}).Cast<MusicArtist>().ToList();
|
||||||
@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name);
|
_logger.LogInformation("Deleting dead {ItemType} {ItemId} {ItemName}", item.GetType().Name, item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name);
|
||||||
|
|
||||||
_libraryManager.DeleteItem(
|
_libraryManager.DeleteItem(
|
||||||
item,
|
item,
|
||||||
@ -107,5 +107,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,15 @@ using MediaBrowser.Controller.Collections;
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Querying;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class CollectionPostScanTask.
|
||||||
|
/// </summary>
|
||||||
|
public class CollectionPostScanTask : ILibraryPostScanTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class CollectionPostScanTask.
|
|
||||||
/// </summary>
|
|
||||||
public class CollectionPostScanTask : ILibraryPostScanTask
|
|
||||||
{
|
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly ICollectionManager _collectionManager;
|
private readonly ICollectionManager _collectionManager;
|
||||||
private readonly ILogger<CollectionPostScanTask> _logger;
|
private readonly ILogger<CollectionPostScanTask> _logger;
|
||||||
@ -64,10 +62,10 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
{
|
{
|
||||||
var movies = _libraryManager.GetItemList(new InternalItemsQuery
|
var movies = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
MediaTypes = new[] { MediaType.Video },
|
MediaTypes = [MediaType.Video],
|
||||||
IncludeItemTypes = new[] { BaseItemKind.Movie },
|
IncludeItemTypes = [BaseItemKind.Movie],
|
||||||
IsVirtualItem = false,
|
IsVirtualItem = false,
|
||||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
OrderBy = [(ItemSortBy.SortName, SortOrder.Ascending)],
|
||||||
Parent = library,
|
Parent = library,
|
||||||
StartIndex = startIndex,
|
StartIndex = startIndex,
|
||||||
Limit = pagesize,
|
Limit = pagesize,
|
||||||
@ -109,7 +107,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
var boxSets = _libraryManager.GetItemList(new InternalItemsQuery
|
var boxSets = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { BaseItemKind.BoxSet },
|
IncludeItemTypes = [BaseItemKind.BoxSet],
|
||||||
CollapseBoxSetItems = false,
|
CollapseBoxSetItems = false,
|
||||||
Recursive = true
|
Recursive = true
|
||||||
});
|
});
|
||||||
@ -128,14 +126,14 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
{
|
{
|
||||||
Name = collectionName,
|
Name = collectionName,
|
||||||
IsLocked = true
|
IsLocked = true
|
||||||
});
|
}).ConfigureAwait(false);
|
||||||
|
|
||||||
await _collectionManager.AddToCollectionAsync(boxSet.Id, movieIds);
|
await _collectionManager.AddToCollectionAsync(boxSet.Id, movieIds).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _collectionManager.AddToCollectionAsync(boxSet.Id, movieIds);
|
await _collectionManager.AddToCollectionAsync(boxSet.Id, movieIds).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
@ -153,5 +151,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class GenresPostScanTask.
|
||||||
|
/// </summary>
|
||||||
|
public class GenresPostScanTask : ILibraryPostScanTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class GenresPostScanTask.
|
|
||||||
/// </summary>
|
|
||||||
public class GenresPostScanTask : ILibraryPostScanTask
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _library manager.
|
/// The _library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -45,5 +45,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
{
|
{
|
||||||
return new GenresValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
return new GenresValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class GenresValidator.
|
||||||
|
/// </summary>
|
||||||
|
public class GenresValidator
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class GenresValidator.
|
|
||||||
/// </summary>
|
|
||||||
public class GenresValidator
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The library manager.
|
/// The library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -100,5 +100,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class MusicGenresPostScanTask.
|
||||||
|
/// </summary>
|
||||||
|
public class MusicGenresPostScanTask : ILibraryPostScanTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class MusicGenresPostScanTask.
|
|
||||||
/// </summary>
|
|
||||||
public class MusicGenresPostScanTask : ILibraryPostScanTask
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The library manager.
|
/// The library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -45,5 +45,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
{
|
{
|
||||||
return new MusicGenresValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
return new MusicGenresValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class MusicGenresValidator.
|
||||||
|
/// </summary>
|
||||||
|
public class MusicGenresValidator
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class MusicGenresValidator.
|
|
||||||
/// </summary>
|
|
||||||
public class MusicGenresValidator
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The library manager.
|
/// The library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -77,5 +77,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@ using MediaBrowser.Controller.Providers;
|
|||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class PeopleValidator.
|
||||||
|
/// </summary>
|
||||||
|
public class PeopleValidator
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class PeopleValidator.
|
|
||||||
/// </summary>
|
|
||||||
public class PeopleValidator
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _library manager.
|
/// The _library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -55,7 +55,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
var numPeople = people.Count;
|
var numPeople = people.Count;
|
||||||
|
|
||||||
_logger.LogDebug("Will refresh {0} people", numPeople);
|
_logger.LogDebug("Will refresh {Amount} people", numPeople);
|
||||||
|
|
||||||
foreach (var person in people)
|
foreach (var person in people)
|
||||||
{
|
{
|
||||||
@ -104,11 +104,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
foreach (var item in deadEntities)
|
foreach (var item in deadEntities)
|
||||||
{
|
{
|
||||||
_logger.LogInformation(
|
_logger.LogInformation("Deleting dead {ItemType} {ItemId} {ItemName}", item.GetType().Name, item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name);
|
||||||
"Deleting dead {2} {0} {1}.",
|
|
||||||
item.Id.ToString("N", CultureInfo.InvariantCulture),
|
|
||||||
item.Name,
|
|
||||||
item.GetType().Name);
|
|
||||||
|
|
||||||
_libraryManager.DeleteItem(
|
_libraryManager.DeleteItem(
|
||||||
item,
|
item,
|
||||||
@ -123,5 +119,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
_logger.LogInformation("People validation complete");
|
_logger.LogInformation("People validation complete");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class MusicGenresPostScanTask.
|
||||||
|
/// </summary>
|
||||||
|
public class StudiosPostScanTask : ILibraryPostScanTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class MusicGenresPostScanTask.
|
|
||||||
/// </summary>
|
|
||||||
public class StudiosPostScanTask : ILibraryPostScanTask
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _library manager.
|
/// The _library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -46,5 +46,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
{
|
{
|
||||||
return new StudiosValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
return new StudiosValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Validators
|
namespace Emby.Server.Implementations.Library.Validators;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class StudiosValidator.
|
||||||
|
/// </summary>
|
||||||
|
public class StudiosValidator
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class StudiosValidator.
|
|
||||||
/// </summary>
|
|
||||||
public class StudiosValidator
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The library manager.
|
/// The library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery
|
var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { BaseItemKind.Studio },
|
IncludeItemTypes = [BaseItemKind.Studio],
|
||||||
IsDeadStudio = true,
|
IsDeadStudio = true,
|
||||||
IsLocked = false
|
IsLocked = false
|
||||||
});
|
});
|
||||||
@ -101,5 +101,4 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@ using MediaBrowser.Common.Extensions;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks
|
namespace Emby.Server.Implementations.ScheduledTasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class ScheduledTaskWorker.
|
||||||
|
/// </summary>
|
||||||
|
public class ScheduledTaskWorker : IScheduledTaskWorker
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class ScheduledTaskWorker.
|
|
||||||
/// </summary>
|
|
||||||
public class ScheduledTaskWorker : IScheduledTaskWorker
|
|
||||||
{
|
|
||||||
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
|
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
|
||||||
private readonly IApplicationPaths _applicationPaths;
|
private readonly IApplicationPaths _applicationPaths;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
@ -675,5 +675,4 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,13 @@ using MediaBrowser.Common.Configuration;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks
|
namespace Emby.Server.Implementations.ScheduledTasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class TaskManager.
|
||||||
|
/// </summary>
|
||||||
|
public class TaskManager : ITaskManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class TaskManager.
|
|
||||||
/// </summary>
|
|
||||||
public class TaskManager : ITaskManager
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _task queue.
|
/// The _task queue.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
_applicationPaths = applicationPaths;
|
_applicationPaths = applicationPaths;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
ScheduledTasks = Array.Empty<IScheduledTaskWorker>();
|
ScheduledTasks = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
|
|
||||||
if (scheduledTask is null)
|
if (scheduledTask is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);
|
_logger.LogError("Unable to find scheduled task of type {Type} in QueueScheduledTask.", typeof(T).Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -116,13 +116,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
|
|
||||||
if (scheduledTask is null)
|
if (scheduledTask is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);
|
_logger.LogError("Unable to find scheduled task of type {Type} in Execute.", typeof(T).Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var type = scheduledTask.ScheduledTask.GetType();
|
var type = scheduledTask.ScheduledTask.GetType();
|
||||||
|
|
||||||
_logger.LogDebug("Queuing task {0}", type.Name);
|
_logger.LogDebug("Queuing task {Name}", type.Name);
|
||||||
|
|
||||||
lock (_taskQueue)
|
lock (_taskQueue)
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
|
|
||||||
if (scheduledTask is null)
|
if (scheduledTask is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);
|
_logger.LogError("Unable to find scheduled task of type {Type} in QueueScheduledTask.", task.GetType().Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -158,7 +158,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
{
|
{
|
||||||
var type = task.ScheduledTask.GetType();
|
var type = task.ScheduledTask.GetType();
|
||||||
|
|
||||||
_logger.LogDebug("Queuing task {0}", type.Name);
|
_logger.LogDebug("Queuing task {Name}", type.Name);
|
||||||
|
|
||||||
lock (_taskQueue)
|
lock (_taskQueue)
|
||||||
{
|
{
|
||||||
@ -260,5 +260,4 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -156,14 +156,11 @@ public partial class AudioNormalizationTask : IScheduledTask
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return
|
yield return new TaskTriggerInfo
|
||||||
[
|
|
||||||
new TaskTriggerInfo
|
|
||||||
{
|
{
|
||||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||||
}
|
};
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<float?> CalculateLUFSAsync(string inputArgs, bool waitForExit, CancellationToken cancellationToken)
|
private async Task<float?> CalculateLUFSAsync(string inputArgs, bool waitForExit, CancellationToken cancellationToken)
|
||||||
@ -194,7 +191,7 @@ public partial class AudioNormalizationTask : IScheduledTask
|
|||||||
|
|
||||||
using var reader = process.StandardError;
|
using var reader = process.StandardError;
|
||||||
float? lufs = null;
|
float? lufs = null;
|
||||||
await foreach (var line in reader.ReadAllLinesAsync(cancellationToken))
|
await foreach (var line in reader.ReadAllLinesAsync(cancellationToken).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
Match match = LUFSRegex().Match(line);
|
Match match = LUFSRegex().Match(line);
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
|
@ -17,13 +17,13 @@ using MediaBrowser.Model.IO;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class ChapterImagesTask.
|
||||||
|
/// </summary>
|
||||||
|
public class ChapterImagesTask : IScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class ChapterImagesTask.
|
|
||||||
/// </summary>
|
|
||||||
public class ChapterImagesTask : IScheduledTask
|
|
||||||
{
|
|
||||||
private readonly ILogger<ChapterImagesTask> _logger;
|
private readonly ILogger<ChapterImagesTask> _logger;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
@ -71,15 +71,12 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return
|
yield return new TaskTriggerInfo
|
||||||
[
|
|
||||||
new TaskTriggerInfo
|
|
||||||
{
|
{
|
||||||
Type = TaskTriggerInfoType.DailyTrigger,
|
Type = TaskTriggerInfoType.DailyTrigger,
|
||||||
TimeOfDayTicks = TimeSpan.FromHours(2).Ticks,
|
TimeOfDayTicks = TimeSpan.FromHours(2).Ticks,
|
||||||
MaxRuntimeTicks = TimeSpan.FromHours(4).Ticks
|
MaxRuntimeTicks = TimeSpan.FromHours(4).Ticks
|
||||||
}
|
};
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -168,5 +165,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@ using MediaBrowser.Model.Activity;
|
|||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes old activity log entries.
|
||||||
|
/// </summary>
|
||||||
|
public class CleanActivityLogTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Deletes old activity log entries.
|
|
||||||
/// </summary>
|
|
||||||
public class CleanActivityLogTask : IScheduledTask, IConfigurableScheduledTask
|
|
||||||
{
|
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IActivityManager _activityManager;
|
private readonly IActivityManager _activityManager;
|
||||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||||
@ -73,5 +73,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ public class CleanupCollectionAndPlaylistPathsTask : IScheduledTask
|
|||||||
private readonly IPlaylistManager _playlistManager;
|
private readonly IPlaylistManager _playlistManager;
|
||||||
private readonly ILogger<CleanupCollectionAndPlaylistPathsTask> _logger;
|
private readonly ILogger<CleanupCollectionAndPlaylistPathsTask> _logger;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="CleanupCollectionAndPlaylistPathsTask"/> class.
|
/// Initializes a new instance of the <see cref="CleanupCollectionAndPlaylistPathsTask"/> class.
|
||||||
@ -37,21 +36,18 @@ public class CleanupCollectionAndPlaylistPathsTask : IScheduledTask
|
|||||||
/// <param name="playlistManager">Instance of the <see cref="IPlaylistManager"/> interface.</param>
|
/// <param name="playlistManager">Instance of the <see cref="IPlaylistManager"/> interface.</param>
|
||||||
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
|
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
|
||||||
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
||||||
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
|
||||||
public CleanupCollectionAndPlaylistPathsTask(
|
public CleanupCollectionAndPlaylistPathsTask(
|
||||||
ILocalizationManager localization,
|
ILocalizationManager localization,
|
||||||
ICollectionManager collectionManager,
|
ICollectionManager collectionManager,
|
||||||
IPlaylistManager playlistManager,
|
IPlaylistManager playlistManager,
|
||||||
ILogger<CleanupCollectionAndPlaylistPathsTask> logger,
|
ILogger<CleanupCollectionAndPlaylistPathsTask> logger,
|
||||||
IProviderManager providerManager,
|
IProviderManager providerManager)
|
||||||
IFileSystem fileSystem)
|
|
||||||
{
|
{
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_collectionManager = collectionManager;
|
_collectionManager = collectionManager;
|
||||||
_playlistManager = playlistManager;
|
_playlistManager = playlistManager;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
_fileSystem = fileSystem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -135,6 +131,9 @@ public class CleanupCollectionAndPlaylistPathsTask : IScheduledTask
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return [new TaskTriggerInfo() { Type = TaskTriggerInfoType.StartupTrigger }];
|
yield return new TaskTriggerInfo
|
||||||
|
{
|
||||||
|
Type = TaskTriggerInfoType.StartupTrigger,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ using MediaBrowser.Model.IO;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes old cache files.
|
||||||
|
/// </summary>
|
||||||
|
public class DeleteCacheFileTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Deletes old cache files.
|
|
||||||
/// </summary>
|
|
||||||
public class DeleteCacheFileTask : IScheduledTask, IConfigurableScheduledTask
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the application paths.
|
/// Gets or sets the application paths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -70,11 +70,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return
|
yield return new TaskTriggerInfo
|
||||||
[
|
{
|
||||||
// Every so often
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||||
];
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -140,5 +140,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@ using MediaBrowser.Model.Globalization;
|
|||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes old log files.
|
||||||
|
/// </summary>
|
||||||
|
public class DeleteLogFileTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Deletes old log files.
|
|
||||||
/// </summary>
|
|
||||||
public class DeleteLogFileTask : IScheduledTask, IConfigurableScheduledTask
|
|
||||||
{
|
|
||||||
private readonly IConfigurationManager _configurationManager;
|
private readonly IConfigurationManager _configurationManager;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
@ -60,10 +60,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return
|
yield return new TaskTriggerInfo
|
||||||
[
|
{
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
];
|
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -97,5 +98,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ using MediaBrowser.Model.IO;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes all transcoding temp files.
|
||||||
|
/// </summary>
|
||||||
|
public class DeleteTranscodeFileTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Deletes all transcoding temp files.
|
|
||||||
/// </summary>
|
|
||||||
public class DeleteTranscodeFileTask : IScheduledTask, IConfigurableScheduledTask
|
|
||||||
{
|
|
||||||
private readonly ILogger<DeleteTranscodeFileTask> _logger;
|
private readonly ILogger<DeleteTranscodeFileTask> _logger;
|
||||||
private readonly IConfigurationManager _configurationManager;
|
private readonly IConfigurationManager _configurationManager;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
@ -65,18 +65,16 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return
|
yield return new TaskTriggerInfo
|
||||||
[
|
|
||||||
new TaskTriggerInfo
|
|
||||||
{
|
{
|
||||||
Type = TaskTriggerInfoType.StartupTrigger
|
Type = TaskTriggerInfoType.StartupTrigger
|
||||||
},
|
};
|
||||||
new TaskTriggerInfo
|
|
||||||
|
yield return new TaskTriggerInfo
|
||||||
{
|
{
|
||||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||||
}
|
};
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -123,5 +121,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,11 @@ public class MediaSegmentExtractionTask : IScheduledTask
|
|||||||
|
|
||||||
var query = new InternalItemsQuery
|
var query = new InternalItemsQuery
|
||||||
{
|
{
|
||||||
MediaTypes = new[] { MediaType.Video, MediaType.Audio },
|
MediaTypes = [MediaType.Video, MediaType.Audio],
|
||||||
IsVirtualItem = false,
|
IsVirtualItem = false,
|
||||||
IncludeItemTypes = _itemTypes,
|
IncludeItemTypes = _itemTypes,
|
||||||
DtoOptions = new DtoOptions(true),
|
DtoOptions = new DtoOptions(true),
|
||||||
SourceTypes = new[] { SourceType.Library },
|
SourceTypes = [SourceType.Library],
|
||||||
Recursive = true,
|
Recursive = true,
|
||||||
Limit = pagesize
|
Limit = pagesize
|
||||||
};
|
};
|
||||||
|
@ -5,19 +5,17 @@ using System.Threading.Tasks;
|
|||||||
using Jellyfin.Database.Implementations;
|
using Jellyfin.Database.Implementations;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optimizes Jellyfin's database by issuing a VACUUM command.
|
||||||
|
/// </summary>
|
||||||
|
public class OptimizeDatabaseTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Optimizes Jellyfin's database by issuing a VACUUM command.
|
|
||||||
/// </summary>
|
|
||||||
public class OptimizeDatabaseTask : IScheduledTask, IConfigurableScheduledTask
|
|
||||||
{
|
|
||||||
private readonly ILogger<OptimizeDatabaseTask> _logger;
|
private readonly ILogger<OptimizeDatabaseTask> _logger;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IDbContextFactory<JellyfinDbContext> _provider;
|
|
||||||
private readonly IJellyfinDatabaseProvider _jellyfinDatabaseProvider;
|
private readonly IJellyfinDatabaseProvider _jellyfinDatabaseProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -25,17 +23,14 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
|
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
|
||||||
/// <param name="localization">Instance of the <see cref="ILocalizationManager"/> interface.</param>
|
/// <param name="localization">Instance of the <see cref="ILocalizationManager"/> interface.</param>
|
||||||
/// <param name="provider">Instance of the <see cref="IDbContextFactory{JellyfinDbContext}"/> interface.</param>
|
|
||||||
/// <param name="jellyfinDatabaseProvider">Instance of the JellyfinDatabaseProvider that can be used for provider specific operations.</param>
|
/// <param name="jellyfinDatabaseProvider">Instance of the JellyfinDatabaseProvider that can be used for provider specific operations.</param>
|
||||||
public OptimizeDatabaseTask(
|
public OptimizeDatabaseTask(
|
||||||
ILogger<OptimizeDatabaseTask> logger,
|
ILogger<OptimizeDatabaseTask> logger,
|
||||||
ILocalizationManager localization,
|
ILocalizationManager localization,
|
||||||
IDbContextFactory<JellyfinDbContext> provider,
|
|
||||||
IJellyfinDatabaseProvider jellyfinDatabaseProvider)
|
IJellyfinDatabaseProvider jellyfinDatabaseProvider)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_provider = provider;
|
|
||||||
_jellyfinDatabaseProvider = jellyfinDatabaseProvider;
|
_jellyfinDatabaseProvider = jellyfinDatabaseProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,11 +58,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return
|
yield return new TaskTriggerInfo
|
||||||
[
|
{
|
||||||
// Every so often
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||||
];
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -84,5 +79,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
_logger.LogError(e, "Error while optimizing jellyfin.db");
|
_logger.LogError(e, "Error while optimizing jellyfin.db");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class PeopleValidationTask.
|
||||||
|
/// </summary>
|
||||||
|
public class PeopleValidationTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class PeopleValidationTask.
|
|
||||||
/// </summary>
|
|
||||||
public class PeopleValidationTask : IScheduledTask, IConfigurableScheduledTask
|
|
||||||
{
|
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
|
|
||||||
@ -54,13 +54,10 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <returns>An <see cref="IEnumerable{TaskTriggerInfo}"/> containing the default trigger infos for this task.</returns>
|
/// <returns>An <see cref="IEnumerable{TaskTriggerInfo}"/> containing the default trigger infos for this task.</returns>
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return new[]
|
yield return new TaskTriggerInfo
|
||||||
{
|
|
||||||
new TaskTriggerInfo
|
|
||||||
{
|
{
|
||||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
IntervalTicks = TimeSpan.FromDays(7).Ticks
|
IntervalTicks = TimeSpan.FromDays(7).Ticks
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,5 +66,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
{
|
{
|
||||||
return _libraryManager.ValidatePeopleAsync(progress, cancellationToken);
|
return _libraryManager.ValidatePeopleAsync(progress, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ using MediaBrowser.Model.Globalization;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Plugin Update Task.
|
||||||
|
/// </summary>
|
||||||
|
public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Plugin Update Task.
|
|
||||||
/// </summary>
|
|
||||||
public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask
|
|
||||||
{
|
|
||||||
private readonly ILogger<PluginUpdateTask> _logger;
|
private readonly ILogger<PluginUpdateTask> _logger;
|
||||||
|
|
||||||
private readonly IInstallationManager _installationManager;
|
private readonly IInstallationManager _installationManager;
|
||||||
@ -59,11 +59,16 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
// At startup
|
yield return new TaskTriggerInfo
|
||||||
yield return new TaskTriggerInfo { Type = TaskTriggerInfoType.StartupTrigger };
|
{
|
||||||
|
Type = TaskTriggerInfoType.StartupTrigger
|
||||||
|
};
|
||||||
|
|
||||||
// Every so often
|
yield return new TaskTriggerInfo
|
||||||
yield return new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks };
|
{
|
||||||
|
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||||
|
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -96,15 +101,15 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error downloading {0}", package.Name);
|
_logger.LogError(ex, "Error downloading {Name}", package.Name);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error updating {0}", package.Name);
|
_logger.LogError(ex, "Error updating {Name}", package.Name);
|
||||||
}
|
}
|
||||||
catch (InvalidDataException ex)
|
catch (InvalidDataException ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error updating {0}", package.Name);
|
_logger.LogError(ex, "Error updating {Name}", package.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update progress
|
// Update progress
|
||||||
@ -116,5 +121,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
|
|
||||||
progress.Report(100);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@ using MediaBrowser.Controller.Library;
|
|||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class RefreshMediaLibraryTask.
|
||||||
|
/// </summary>
|
||||||
|
public class RefreshMediaLibraryTask : IScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class RefreshMediaLibraryTask.
|
|
||||||
/// </summary>
|
|
||||||
public class RefreshMediaLibraryTask : IScheduledTask
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _library manager.
|
/// The _library manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,5 +62,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
|
|
||||||
return ((LibraryManager)_libraryManager).ValidateMediaLibraryInternal(progress, cancellationToken);
|
return ((LibraryManager)_libraryManager).ValidateMediaLibraryInternal(progress, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,25 +3,25 @@ using System.Threading;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
namespace Emby.Server.Implementations.ScheduledTasks.Triggers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a task trigger that fires everyday.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class DailyTrigger : ITaskTrigger, IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a task trigger that fires everyday.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class DailyTrigger : ITaskTrigger, IDisposable
|
|
||||||
{
|
|
||||||
private readonly TimeSpan _timeOfDay;
|
private readonly TimeSpan _timeOfDay;
|
||||||
private Timer? _timer;
|
private Timer? _timer;
|
||||||
private bool _disposed = false;
|
private bool _disposed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DailyTrigger"/> class.
|
/// Initializes a new instance of the <see cref="DailyTrigger"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="timeofDay">The time of day to trigger the task to run.</param>
|
/// <param name="timeOfDay">The time of day to trigger the task to run.</param>
|
||||||
/// <param name="taskOptions">The options of this task.</param>
|
/// <param name="taskOptions">The options of this task.</param>
|
||||||
public DailyTrigger(TimeSpan timeofDay, TaskOptions taskOptions)
|
public DailyTrigger(TimeSpan timeOfDay, TaskOptions taskOptions)
|
||||||
{
|
{
|
||||||
_timeOfDay = timeofDay;
|
_timeOfDay = timeOfDay;
|
||||||
TaskOptions = taskOptions;
|
TaskOptions = taskOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,5 +83,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
|||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,17 @@ using System.Threading;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
namespace Emby.Server.Implementations.ScheduledTasks.Triggers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a task trigger that runs repeatedly on an interval.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class IntervalTrigger : ITaskTrigger, IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a task trigger that runs repeatedly on an interval.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class IntervalTrigger : ITaskTrigger, IDisposable
|
|
||||||
{
|
|
||||||
private readonly TimeSpan _interval;
|
private readonly TimeSpan _interval;
|
||||||
private DateTime _lastStartDate;
|
private DateTime _lastStartDate;
|
||||||
private Timer? _timer;
|
private Timer? _timer;
|
||||||
private bool _disposed = false;
|
private bool _disposed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="IntervalTrigger"/> class.
|
/// Initializes a new instance of the <see cref="IntervalTrigger"/> class.
|
||||||
@ -103,5 +103,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
|||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ using System.Threading.Tasks;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
namespace Emby.Server.Implementations.ScheduledTasks.Triggers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class StartupTaskTrigger.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class StartupTrigger : ITaskTrigger
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Class StartupTaskTrigger.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class StartupTrigger : ITaskTrigger
|
|
||||||
{
|
|
||||||
private const int DelayMs = 3000;
|
private const int DelayMs = 3000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -50,5 +50,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
|||||||
{
|
{
|
||||||
Triggered?.Invoke(this, EventArgs.Empty);
|
Triggered?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ using System.Threading;
|
|||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
namespace Emby.Server.Implementations.ScheduledTasks.Triggers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a task trigger that fires on a weekly basis.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class WeeklyTrigger : ITaskTrigger, IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Represents a task trigger that fires on a weekly basis.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class WeeklyTrigger : ITaskTrigger, IDisposable
|
|
||||||
{
|
|
||||||
private readonly TimeSpan _timeOfDay;
|
private readonly TimeSpan _timeOfDay;
|
||||||
private readonly DayOfWeek _dayOfWeek;
|
private readonly DayOfWeek _dayOfWeek;
|
||||||
private Timer? _timer;
|
private Timer? _timer;
|
||||||
@ -18,12 +18,12 @@ namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="WeeklyTrigger"/> class.
|
/// Initializes a new instance of the <see cref="WeeklyTrigger"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="timeofDay">The time of day to trigger the task to run.</param>
|
/// <param name="timeOfDay">The time of day to trigger the task to run.</param>
|
||||||
/// <param name="dayOfWeek">The day of week.</param>
|
/// <param name="dayOfWeek">The day of week.</param>
|
||||||
/// <param name="taskOptions">The options of this task.</param>
|
/// <param name="taskOptions">The options of this task.</param>
|
||||||
public WeeklyTrigger(TimeSpan timeofDay, DayOfWeek dayOfWeek, TaskOptions taskOptions)
|
public WeeklyTrigger(TimeSpan timeOfDay, DayOfWeek dayOfWeek, TaskOptions taskOptions)
|
||||||
{
|
{
|
||||||
_timeOfDay = timeofDay;
|
_timeOfDay = timeOfDay;
|
||||||
_dayOfWeek = dayOfWeek;
|
_dayOfWeek = dayOfWeek;
|
||||||
TaskOptions = taskOptions;
|
TaskOptions = taskOptions;
|
||||||
}
|
}
|
||||||
@ -106,5 +106,4 @@ namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
|||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user