mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #10969 from barronpm/progress-cleanup
Progress cleanup
This commit is contained in:
commit
143ef71528
@ -22,7 +22,6 @@ using Jellyfin.Data.Entities;
|
|||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
@ -1022,7 +1021,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
// Start by just validating the children of the root, but go no further
|
// Start by just validating the children of the root, but go no further
|
||||||
await RootFolder.ValidateChildren(
|
await RootFolder.ValidateChildren(
|
||||||
new SimpleProgress<double>(),
|
new Progress<double>(),
|
||||||
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
|
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
|
||||||
recursive: false,
|
recursive: false,
|
||||||
cancellationToken).ConfigureAwait(false);
|
cancellationToken).ConfigureAwait(false);
|
||||||
@ -1030,7 +1029,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await GetUserRootFolder().ValidateChildren(
|
await GetUserRootFolder().ValidateChildren(
|
||||||
new SimpleProgress<double>(),
|
new Progress<double>(),
|
||||||
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
|
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
|
||||||
recursive: false,
|
recursive: false,
|
||||||
cancellationToken).ConfigureAwait(false);
|
cancellationToken).ConfigureAwait(false);
|
||||||
@ -1048,18 +1047,14 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
await ValidateTopLibraryFolders(cancellationToken).ConfigureAwait(false);
|
await ValidateTopLibraryFolders(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var innerProgress = new ActionableProgress<double>();
|
var innerProgress = new Progress<double>(pct => progress.Report(pct * 0.96));
|
||||||
|
|
||||||
innerProgress.RegisterAction(pct => progress.Report(pct * 0.96));
|
|
||||||
|
|
||||||
// Validate the entire media library
|
// Validate the entire media library
|
||||||
await RootFolder.ValidateChildren(innerProgress, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), recursive: true, cancellationToken).ConfigureAwait(false);
|
await RootFolder.ValidateChildren(innerProgress, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), recursive: true, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
progress.Report(96);
|
progress.Report(96);
|
||||||
|
|
||||||
innerProgress = new ActionableProgress<double>();
|
innerProgress = new Progress<double>(pct => progress.Report(96 + (pct * .04)));
|
||||||
|
|
||||||
innerProgress.RegisterAction(pct => progress.Report(96 + (pct * .04)));
|
|
||||||
|
|
||||||
await RunPostScanTasks(innerProgress, cancellationToken).ConfigureAwait(false);
|
await RunPostScanTasks(innerProgress, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -1081,12 +1076,10 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
foreach (var task in tasks)
|
foreach (var task in tasks)
|
||||||
{
|
{
|
||||||
var innerProgress = new ActionableProgress<double>();
|
|
||||||
|
|
||||||
// Prevent access to modified closure
|
// Prevent access to modified closure
|
||||||
var currentNumComplete = numComplete;
|
var currentNumComplete = numComplete;
|
||||||
|
|
||||||
innerProgress.RegisterAction(pct =>
|
var innerProgress = new Progress<double>(pct =>
|
||||||
{
|
{
|
||||||
double innerPercent = pct;
|
double innerPercent = pct;
|
||||||
innerPercent /= 100;
|
innerPercent /= 100;
|
||||||
@ -2954,7 +2947,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
// No need to start if scanning the library because it will handle it
|
// No need to start if scanning the library because it will handle it
|
||||||
ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
|
ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ using Jellyfin.Data.Events;
|
|||||||
using Jellyfin.Extensions.Json;
|
using Jellyfin.Extensions.Json;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@ -371,7 +370,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
throw new InvalidOperationException("Cannot execute a Task that is already running");
|
throw new InvalidOperationException("Cannot execute a Task that is already running");
|
||||||
}
|
}
|
||||||
|
|
||||||
var progress = new SimpleProgress<double>();
|
var progress = new Progress<double>();
|
||||||
|
|
||||||
CurrentCancellationTokenSource = new CancellationTokenSource();
|
CurrentCancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Api.Attributes;
|
using Jellyfin.Api.Attributes;
|
||||||
using Jellyfin.Api.Constants;
|
|
||||||
using Jellyfin.Api.Extensions;
|
using Jellyfin.Api.Extensions;
|
||||||
using Jellyfin.Api.Helpers;
|
using Jellyfin.Api.Helpers;
|
||||||
using Jellyfin.Api.ModelBinders;
|
using Jellyfin.Api.ModelBinders;
|
||||||
@ -17,7 +16,6 @@ using Jellyfin.Data.Enums;
|
|||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Common.Api;
|
using MediaBrowser.Common.Api;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
@ -313,7 +311,7 @@ public class LibraryController : BaseJellyfinApiController
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -6,11 +6,9 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Api.Constants;
|
|
||||||
using Jellyfin.Api.ModelBinders;
|
using Jellyfin.Api.ModelBinders;
|
||||||
using Jellyfin.Api.Models.LibraryStructureDto;
|
using Jellyfin.Api.Models.LibraryStructureDto;
|
||||||
using MediaBrowser.Common.Api;
|
using MediaBrowser.Common.Api;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
@ -180,7 +178,7 @@ public class LibraryStructureController : BaseJellyfinApiController
|
|||||||
// No need to start if scanning the library because it will handle it
|
// No need to start if scanning the library because it will handle it
|
||||||
if (refreshLibrary)
|
if (refreshLibrary)
|
||||||
{
|
{
|
||||||
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -224,7 +222,7 @@ public class LibraryStructureController : BaseJellyfinApiController
|
|||||||
// No need to start if scanning the library because it will handle it
|
// No need to start if scanning the library because it will handle it
|
||||||
if (refreshLibrary)
|
if (refreshLibrary)
|
||||||
{
|
{
|
||||||
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -293,7 +291,7 @@ public class LibraryStructureController : BaseJellyfinApiController
|
|||||||
// No need to start if scanning the library because it will handle it
|
// No need to start if scanning the library because it will handle it
|
||||||
if (refreshLibrary)
|
if (refreshLibrary)
|
||||||
{
|
{
|
||||||
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
#pragma warning disable CS1591
|
|
||||||
#pragma warning disable CA1003
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Progress
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class ActionableProgress.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">The type for the action parameter.</typeparam>
|
|
||||||
public class ActionableProgress<T> : IProgress<T>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The _actions.
|
|
||||||
/// </summary>
|
|
||||||
private Action<T>? _action;
|
|
||||||
|
|
||||||
public event EventHandler<T>? ProgressChanged;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Registers the action.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="action">The action.</param>
|
|
||||||
public void RegisterAction(Action<T> action)
|
|
||||||
{
|
|
||||||
_action = action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Report(T value)
|
|
||||||
{
|
|
||||||
ProgressChanged?.Invoke(this, value);
|
|
||||||
|
|
||||||
_action?.Invoke(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
#pragma warning disable CS1591
|
|
||||||
#pragma warning disable CA1003
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Progress
|
|
||||||
{
|
|
||||||
public class SimpleProgress<T> : IProgress<T>
|
|
||||||
{
|
|
||||||
public event EventHandler<T>? ProgressChanged;
|
|
||||||
|
|
||||||
public void Report(T value)
|
|
||||||
{
|
|
||||||
ProgressChanged?.Invoke(this, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,7 +9,6 @@ using System.Text.Json.Serialization;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
query.ChannelIds = new Guid[] { Id };
|
query.ChannelIds = new Guid[] { Id };
|
||||||
|
|
||||||
// Don't blow up here because it could cause parent screens with other content to fail
|
// Don't blow up here because it could cause parent screens with other content to fail
|
||||||
return ChannelManager.GetChannelItemsInternal(query, new SimpleProgress<double>(), CancellationToken.None).GetAwaiter().GetResult();
|
return ChannelManager.GetChannelItemsInternal(query, new Progress<double>(), CancellationToken.None).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
#pragma warning disable CA1711, CS1591
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using MediaBrowser.Model.Drawing;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Drawing
|
|
||||||
{
|
|
||||||
public class ImageStream : IDisposable
|
|
||||||
{
|
|
||||||
public ImageStream(Stream stream)
|
|
||||||
{
|
|
||||||
Stream = stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The stream.</value>
|
|
||||||
public Stream Stream { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the format.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The format.</value>
|
|
||||||
public ImageFormat Format { get; set; }
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
Stream?.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ using System.Threading.Tasks.Dataflow;
|
|||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Collections;
|
using MediaBrowser.Controller.Collections;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
@ -429,16 +428,22 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (recursive)
|
if (recursive)
|
||||||
{
|
{
|
||||||
var innerProgress = new ActionableProgress<double>();
|
|
||||||
|
|
||||||
var folder = this;
|
var folder = this;
|
||||||
innerProgress.RegisterAction(innerPercent =>
|
var innerProgress = new Progress<double>(innerPercent =>
|
||||||
{
|
{
|
||||||
var percent = ProgressHelpers.GetProgress(ProgressHelpers.UpdatedChildItems, ProgressHelpers.ScannedSubfolders, innerPercent);
|
var percent = ProgressHelpers.GetProgress(ProgressHelpers.UpdatedChildItems, ProgressHelpers.ScannedSubfolders, innerPercent);
|
||||||
|
|
||||||
progress.Report(percent);
|
progress.Report(percent);
|
||||||
|
|
||||||
ProviderManager.OnRefreshProgress(folder, percent);
|
// TODO: this is sometimes being called after the refresh has completed.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ProviderManager.OnRefreshProgress(folder, percent);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException e)
|
||||||
|
{
|
||||||
|
Logger.LogError(e, "Error refreshing folder");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (validChildrenNeedGeneration)
|
if (validChildrenNeedGeneration)
|
||||||
@ -461,10 +466,8 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
var container = this as IMetadataContainer;
|
var container = this as IMetadataContainer;
|
||||||
|
|
||||||
var innerProgress = new ActionableProgress<double>();
|
|
||||||
|
|
||||||
var folder = this;
|
var folder = this;
|
||||||
innerProgress.RegisterAction(innerPercent =>
|
var innerProgress = new Progress<double>(innerPercent =>
|
||||||
{
|
{
|
||||||
var percent = ProgressHelpers.GetProgress(ProgressHelpers.ScannedSubfolders, ProgressHelpers.RefreshedMetadata, innerPercent);
|
var percent = ProgressHelpers.GetProgress(ProgressHelpers.ScannedSubfolders, ProgressHelpers.RefreshedMetadata, innerPercent);
|
||||||
|
|
||||||
@ -472,7 +475,15 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (recursive)
|
if (recursive)
|
||||||
{
|
{
|
||||||
ProviderManager.OnRefreshProgress(folder, percent);
|
// TODO: this is sometimes being called after the refresh has completed.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ProviderManager.OnRefreshProgress(folder, percent);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException e)
|
||||||
|
{
|
||||||
|
Logger.LogError(e, "Error refreshing folder");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -572,9 +583,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
var actionBlock = new ActionBlock<int>(
|
var actionBlock = new ActionBlock<int>(
|
||||||
async i =>
|
async i =>
|
||||||
{
|
{
|
||||||
var innerProgress = new ActionableProgress<double>();
|
var innerProgress = new Progress<double>(innerPercent =>
|
||||||
|
|
||||||
innerProgress.RegisterAction(innerPercent =>
|
|
||||||
{
|
{
|
||||||
// round the percent and only update progress if it changed to prevent excessive UpdateProgress calls
|
// round the percent and only update progress if it changed to prevent excessive UpdateProgress calls
|
||||||
var innerPercentRounded = Math.Round(innerPercent);
|
var innerPercentRounded = Math.Round(innerPercent);
|
||||||
@ -922,7 +931,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
query.ChannelIds = new[] { ChannelId };
|
query.ChannelIds = new[] { ChannelId };
|
||||||
|
|
||||||
// Don't blow up here because it could cause parent screens with other content to fail
|
// Don't blow up here because it could cause parent screens with other content to fail
|
||||||
return ChannelManager.GetChannelItemsInternal(query, new SimpleProgress<double>(), CancellationToken.None).GetAwaiter().GetResult();
|
return ChannelManager.GetChannelItemsInternal(query, new Progress<double>(), CancellationToken.None).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
#nullable disable
|
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.MediaEncoding
|
|
||||||
{
|
|
||||||
public class ImageEncodingOptions
|
|
||||||
{
|
|
||||||
public string InputPath { get; set; }
|
|
||||||
|
|
||||||
public int? Width { get; set; }
|
|
||||||
|
|
||||||
public int? Height { get; set; }
|
|
||||||
|
|
||||||
public int? MaxWidth { get; set; }
|
|
||||||
|
|
||||||
public int? MaxHeight { get; set; }
|
|
||||||
|
|
||||||
public int? Quality { get; set; }
|
|
||||||
|
|
||||||
public string Format { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.MediaEncoding
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class MediaEncoderHelpers.
|
|
||||||
/// </summary>
|
|
||||||
public static class MediaEncoderHelpers
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.ClientLog
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The client log event.
|
|
||||||
/// </summary>
|
|
||||||
public class ClientLogEvent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ClientLogEvent"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="timestamp">The log timestamp.</param>
|
|
||||||
/// <param name="level">The log level.</param>
|
|
||||||
/// <param name="userId">The user id.</param>
|
|
||||||
/// <param name="clientName">The client name.</param>
|
|
||||||
/// <param name="clientVersion">The client version.</param>
|
|
||||||
/// <param name="deviceId">The device id.</param>
|
|
||||||
/// <param name="message">The message.</param>
|
|
||||||
public ClientLogEvent(
|
|
||||||
DateTime timestamp,
|
|
||||||
LogLevel level,
|
|
||||||
Guid? userId,
|
|
||||||
string clientName,
|
|
||||||
string clientVersion,
|
|
||||||
string deviceId,
|
|
||||||
string message)
|
|
||||||
{
|
|
||||||
Timestamp = timestamp;
|
|
||||||
UserId = userId;
|
|
||||||
ClientName = clientName;
|
|
||||||
ClientVersion = clientVersion;
|
|
||||||
DeviceId = deviceId;
|
|
||||||
Message = message;
|
|
||||||
Level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the event timestamp.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime Timestamp { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the log level.
|
|
||||||
/// </summary>
|
|
||||||
public LogLevel Level { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user id.
|
|
||||||
/// </summary>
|
|
||||||
public Guid? UserId { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the client name.
|
|
||||||
/// </summary>
|
|
||||||
public string ClientName { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the client version.
|
|
||||||
/// </summary>
|
|
||||||
public string ClientVersion { get; }
|
|
||||||
|
|
||||||
///
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the device id.
|
|
||||||
/// </summary>
|
|
||||||
public string DeviceId { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the log message.
|
|
||||||
/// </summary>
|
|
||||||
public string Message { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
#nullable disable
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Dto
|
|
||||||
{
|
|
||||||
public class ImageByNameInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the name.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The name.</value>
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the theme.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The theme.</value>
|
|
||||||
public string Theme { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the context.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The context.</value>
|
|
||||||
public string Context { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the length of the file.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The length of the file.</value>
|
|
||||||
public long FileLength { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the format.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The format.</value>
|
|
||||||
public string Format { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Entities
|
|
||||||
{
|
|
||||||
public static class SpecialFolder
|
|
||||||
{
|
|
||||||
public const string TvShowSeries = "TvShowSeries";
|
|
||||||
public const string TvGenres = "TvGenres";
|
|
||||||
public const string TvGenre = "TvGenre";
|
|
||||||
public const string TvLatest = "TvLatest";
|
|
||||||
public const string TvNextUp = "TvNextUp";
|
|
||||||
public const string TvResume = "TvResume";
|
|
||||||
public const string TvFavoriteSeries = "TvFavoriteSeries";
|
|
||||||
public const string TvFavoriteEpisodes = "TvFavoriteEpisodes";
|
|
||||||
|
|
||||||
public const string MovieLatest = "MovieLatest";
|
|
||||||
public const string MovieResume = "MovieResume";
|
|
||||||
public const string MovieMovies = "MovieMovies";
|
|
||||||
public const string MovieCollections = "MovieCollections";
|
|
||||||
public const string MovieFavorites = "MovieFavorites";
|
|
||||||
public const string MovieGenres = "MovieGenres";
|
|
||||||
public const string MovieGenre = "MovieGenre";
|
|
||||||
|
|
||||||
public const string MusicArtists = "MusicArtists";
|
|
||||||
public const string MusicAlbumArtists = "MusicAlbumArtists";
|
|
||||||
public const string MusicAlbums = "MusicAlbums";
|
|
||||||
public const string MusicGenres = "MusicGenres";
|
|
||||||
public const string MusicLatest = "MusicLatest";
|
|
||||||
public const string MusicPlaylists = "MusicPlaylists";
|
|
||||||
public const string MusicSongs = "MusicSongs";
|
|
||||||
public const string MusicFavorites = "MusicFavorites";
|
|
||||||
public const string MusicFavoriteArtists = "MusicFavoriteArtists";
|
|
||||||
public const string MusicFavoriteAlbums = "MusicFavoriteAlbums";
|
|
||||||
public const string MusicFavoriteSongs = "MusicFavoriteSongs";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Net
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Used by the sockets wrapper to hold raw data received from a UDP socket.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class SocketReceiveResult
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the buffer to place received data into.
|
|
||||||
/// </summary>
|
|
||||||
public byte[] Buffer { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the number of bytes received.
|
|
||||||
/// </summary>
|
|
||||||
public int ReceivedBytes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the <see cref="IPEndPoint"/> the data was received from.
|
|
||||||
/// </summary>
|
|
||||||
public IPEndPoint RemoteEndPoint { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the local <see cref="IPAddress"/>.
|
|
||||||
/// </summary>
|
|
||||||
public IPAddress LocalIPAddress { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ using Jellyfin.Data.Enums;
|
|||||||
using Jellyfin.Data.Events;
|
using Jellyfin.Data.Events;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.BaseItemManager;
|
using MediaBrowser.Controller.BaseItemManager;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
@ -1025,7 +1024,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
await RefreshCollectionFolderChildren(options, collectionFolder, cancellationToken).ConfigureAwait(false);
|
await RefreshCollectionFolderChildren(options, collectionFolder, cancellationToken).ConfigureAwait(false);
|
||||||
break;
|
break;
|
||||||
case Folder folder:
|
case Folder folder:
|
||||||
await folder.ValidateChildren(new SimpleProgress<double>(), options, cancellationToken: cancellationToken).ConfigureAwait(false);
|
await folder.ValidateChildren(new Progress<double>(), options, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1036,7 +1035,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
{
|
{
|
||||||
await child.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
|
await child.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await child.ValidateChildren(new SimpleProgress<double>(), options, cancellationToken: cancellationToken).ConfigureAwait(false);
|
await child.ValidateChildren(new Progress<double>(), options, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,7 +1057,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
.Select(i => i.MusicArtist)
|
.Select(i => i.MusicArtist)
|
||||||
.Where(i => i is not null);
|
.Where(i => i is not null);
|
||||||
|
|
||||||
var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new SimpleProgress<double>(), options, true, cancellationToken));
|
var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new Progress<double>(), options, true, cancellationToken));
|
||||||
|
|
||||||
await Task.WhenAll(musicArtistRefreshTasks).ConfigureAwait(false);
|
await Task.WhenAll(musicArtistRefreshTasks).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
using System.Globalization;
|
|
||||||
using SkiaSharp;
|
|
||||||
|
|
||||||
namespace Jellyfin.Drawing.Skia;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents errors that occur during interaction with Skia codecs.
|
|
||||||
/// </summary>
|
|
||||||
public class SkiaCodecException : SkiaException
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="SkiaCodecException" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="result">The non-successful codec result returned by Skia.</param>
|
|
||||||
public SkiaCodecException(SKCodecResult result)
|
|
||||||
{
|
|
||||||
CodecResult = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="SkiaCodecException" /> class
|
|
||||||
/// with a specified error message.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="result">The non-successful codec result returned by Skia.</param>
|
|
||||||
/// <param name="message">The message that describes the error.</param>
|
|
||||||
public SkiaCodecException(SKCodecResult result, string message)
|
|
||||||
: base(message)
|
|
||||||
{
|
|
||||||
CodecResult = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the non-successful codec result returned by Skia.
|
|
||||||
/// </summary>
|
|
||||||
public SKCodecResult CodecResult { get; }
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string ToString()
|
|
||||||
=> string.Format(
|
|
||||||
CultureInfo.InvariantCulture,
|
|
||||||
"Non-success codec result: {0}\n{1}",
|
|
||||||
CodecResult,
|
|
||||||
base.ToString());
|
|
||||||
}
|
|
@ -182,7 +182,6 @@ public class SkiaEncoder : IImageEncoder
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentNullException">The path is null.</exception>
|
/// <exception cref="ArgumentNullException">The path is null.</exception>
|
||||||
/// <exception cref="FileNotFoundException">The path is not valid.</exception>
|
/// <exception cref="FileNotFoundException">The path is not valid.</exception>
|
||||||
/// <exception cref="SkiaCodecException">The file at the specified path could not be used to generate a codec.</exception>
|
|
||||||
public string GetImageBlurHash(int xComp, int yComp, string path)
|
public string GetImageBlurHash(int xComp, int yComp, string path)
|
||||||
{
|
{
|
||||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace Jellyfin.Drawing.Skia;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents errors that occur during interaction with Skia.
|
|
||||||
/// </summary>
|
|
||||||
public class SkiaException : Exception
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="SkiaException"/> class.
|
|
||||||
/// </summary>
|
|
||||||
public SkiaException()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="SkiaException"/> class with a specified error message.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message">The message that describes the error.</param>
|
|
||||||
public SkiaException(string message) : base(message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="SkiaException"/> class with a specified error message and a
|
|
||||||
/// reference to the inner exception that is the cause of this exception.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message">The error message that explains the reason for the exception.</param>
|
|
||||||
/// <param name="innerException">
|
|
||||||
/// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if
|
|
||||||
/// no inner exception is specified.
|
|
||||||
/// </param>
|
|
||||||
public SkiaException(string message, Exception innerException)
|
|
||||||
: base(message, innerException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,7 +14,6 @@ using Jellyfin.Data.Enums;
|
|||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using Jellyfin.Extensions.Json;
|
using Jellyfin.Extensions.Json;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
@ -668,7 +667,7 @@ namespace Jellyfin.LiveTv.Channels
|
|||||||
ChannelIds = new Guid[] { internalChannel.Id }
|
ChannelIds = new Guid[] { internalChannel.Id }
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await GetChannelItemsInternal(query, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
|
var result = await GetChannelItemsInternal(query, new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
foreach (var item in result.Items)
|
foreach (var item in result.Items)
|
||||||
{
|
{
|
||||||
@ -681,7 +680,7 @@ namespace Jellyfin.LiveTv.Channels
|
|||||||
EnableTotalRecordCount = false,
|
EnableTotalRecordCount = false,
|
||||||
ChannelIds = new Guid[] { internalChannel.Id }
|
ChannelIds = new Guid[] { internalChannel.Id }
|
||||||
},
|
},
|
||||||
new SimpleProgress<double>(),
|
new Progress<double>(),
|
||||||
cancellationToken).ConfigureAwait(false);
|
cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,7 +762,7 @@ namespace Jellyfin.LiveTv.Channels
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<QueryResult<BaseItemDto>> GetChannelItems(InternalItemsQuery query, CancellationToken cancellationToken)
|
public async Task<QueryResult<BaseItemDto>> GetChannelItems(InternalItemsQuery query, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var internalResult = await GetChannelItemsInternal(query, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
|
var internalResult = await GetChannelItemsInternal(query, new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, query.DtoOptions, query.User);
|
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, query.DtoOptions, query.User);
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
@ -66,7 +65,7 @@ namespace Jellyfin.LiveTv.Channels
|
|||||||
{
|
{
|
||||||
var manager = (ChannelManager)_channelManager;
|
var manager = (ChannelManager)_channelManager;
|
||||||
|
|
||||||
await manager.RefreshChannels(new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
|
await manager.RefreshChannels(new Progress<double>(), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
await new ChannelPostScanTask(_channelManager, _logger, _libraryManager).Run(progress, cancellationToken)
|
await new ChannelPostScanTask(_channelManager, _logger, _libraryManager).Run(progress, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
@ -21,7 +21,6 @@ using Jellyfin.Extensions;
|
|||||||
using Jellyfin.LiveTv.Configuration;
|
using Jellyfin.LiveTv.Configuration;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
@ -261,7 +260,7 @@ namespace Jellyfin.LiveTv.EmbyTV
|
|||||||
|
|
||||||
if (requiresRefresh)
|
if (requiresRefresh)
|
||||||
{
|
{
|
||||||
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ using Jellyfin.Data.Enums;
|
|||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using Jellyfin.LiveTv.Configuration;
|
using Jellyfin.LiveTv.Configuration;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
@ -108,8 +107,7 @@ public class GuideManager : IGuideManager
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var innerProgress = new ActionableProgress<double>();
|
var innerProgress = new Progress<double>(p => progress.Report(p * progressPerService));
|
||||||
innerProgress.RegisterAction(p => progress.Report(p * progressPerService));
|
|
||||||
|
|
||||||
var idList = await RefreshChannelsInternal(service, innerProgress, cancellationToken).ConfigureAwait(false);
|
var idList = await RefreshChannelsInternal(service, innerProgress, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -158,7 +156,7 @@ public class GuideManager : IGuideManager
|
|||||||
: 7;
|
: 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Tuple<List<Guid>, List<Guid>>> RefreshChannelsInternal(ILiveTvService service, ActionableProgress<double> progress, CancellationToken cancellationToken)
|
private async Task<Tuple<List<Guid>, List<Guid>>> RefreshChannelsInternal(ILiveTvService service, IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
progress.Report(10);
|
progress.Report(10);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user