mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 00:55:13 +01:00
add more methods to IFileSystem
This commit is contained in:
@@ -448,7 +448,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
item.Name = channelInfo.Name;
|
||||
}
|
||||
|
||||
await item.RefreshMetadata(new MetadataRefreshOptions
|
||||
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
ForceSave = isNew
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
|
||||
await parentFolder.AddChild(collection, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await collection.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService()), CancellationToken.None)
|
||||
await collection.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_fileSystem)), CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (options.ItemIdList.Count > 0)
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Collections
|
||||
{
|
||||
public class CollectionsDynamicFolder : IVirtualFolderCreator
|
||||
{
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private IFileSystem _fileSystem;
|
||||
|
||||
public CollectionsDynamicFolder(IApplicationPaths appPaths)
|
||||
public CollectionsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
|
||||
{
|
||||
_appPaths = appPaths;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public BasePluginFolder GetFolder()
|
||||
|
||||
@@ -15,6 +15,7 @@ using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Configuration
|
||||
{
|
||||
@@ -23,15 +24,18 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
||||
/// </summary>
|
||||
public class ServerConfigurationManager : BaseConfigurationManager, IServerConfigurationManager
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ServerConfigurationManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="applicationPaths">The application paths.</param>
|
||||
/// <param name="logManager">The log manager.</param>
|
||||
/// <param name="xmlSerializer">The XML serializer.</param>
|
||||
public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer)
|
||||
public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
|
||||
: base(applicationPaths, logManager, xmlSerializer)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
UpdateItemsByNamePath();
|
||||
UpdateMetadataPath();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Connect
|
||||
{
|
||||
@@ -23,8 +24,9 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
|
||||
private readonly INetworkManager _networkManager;
|
||||
private readonly IApplicationHost _appHost;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public ConnectEntryPoint(IHttpClient httpClient, IApplicationPaths appPaths, ILogger logger, INetworkManager networkManager, IConnectManager connectManager, IApplicationHost appHost)
|
||||
public ConnectEntryPoint(IHttpClient httpClient, IApplicationPaths appPaths, ILogger logger, INetworkManager networkManager, IConnectManager connectManager, IApplicationHost appHost, IFileSystem fileSystem)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_appPaths = appPaths;
|
||||
@@ -32,6 +34,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
_networkManager = networkManager;
|
||||
_connectManager = connectManager;
|
||||
_appHost = appHost;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
|
||||
@@ -23,6 +23,7 @@ using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Connect
|
||||
{
|
||||
@@ -40,6 +41,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IProviderManager _providerManager;
|
||||
private readonly ISecurityManager _securityManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
private ConnectData _data = new ConnectData();
|
||||
|
||||
@@ -104,7 +106,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
IEncryptionManager encryption,
|
||||
IHttpClient httpClient,
|
||||
IServerApplicationHost appHost,
|
||||
IServerConfigurationManager config, IUserManager userManager, IProviderManager providerManager, ISecurityManager securityManager)
|
||||
IServerConfigurationManager config, IUserManager userManager, IProviderManager providerManager, ISecurityManager securityManager, IFileSystem fileSystem)
|
||||
{
|
||||
_logger = logger;
|
||||
_appPaths = appPaths;
|
||||
@@ -116,6 +118,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
_userManager = userManager;
|
||||
_providerManager = providerManager;
|
||||
_securityManager = securityManager;
|
||||
_fileSystem = fileSystem;
|
||||
|
||||
_userManager.UserConfigurationUpdated += _userManager_UserConfigurationUpdated;
|
||||
_config.ConfigurationUpdated += _config_ConfigurationUpdated;
|
||||
@@ -943,7 +946,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
{
|
||||
await _providerManager.SaveImage(user, imageUrl, _connectImageSemaphore, ImageType.Primary, null, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await user.RefreshMetadata(new MetadataRefreshOptions
|
||||
await user.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
ForceSave = true,
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Devices
|
||||
{
|
||||
@@ -51,10 +52,12 @@ namespace MediaBrowser.Server.Implementations.Devices
|
||||
public class CameraUploadsDynamicFolder : IVirtualFolderCreator
|
||||
{
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public CameraUploadsDynamicFolder(IApplicationPaths appPaths)
|
||||
public CameraUploadsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
|
||||
{
|
||||
_appPaths = appPaths;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public BasePluginFolder GetFolder()
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
try
|
||||
{
|
||||
_logger.Debug("Deleting empty directory {0}", path);
|
||||
_fileSystem.DeleteDirectory(path);
|
||||
_fileSystem.DeleteDirectory(path, false);
|
||||
}
|
||||
catch (UnauthorizedAccessException) { }
|
||||
catch (DirectoryNotFoundException) { }
|
||||
|
||||
@@ -79,6 +79,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
_containerAdapter = new ContainerAdapter(applicationHost);
|
||||
}
|
||||
|
||||
public string GlobalResponse { get; set; }
|
||||
|
||||
public override void Configure(Container container)
|
||||
{
|
||||
HostConfig.Instance.DefaultRedirectPath = DefaultRedirectPath;
|
||||
@@ -336,6 +338,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(GlobalResponse))
|
||||
{
|
||||
httpRes.Write(GlobalResponse);
|
||||
httpRes.ContentType = "text/plain";
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
var handler = HttpHandlerFactory.GetHandler(httpReq);
|
||||
|
||||
var remoteIp = httpReq.RemoteIp;
|
||||
|
||||
@@ -548,7 +548,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
public BaseItem ResolvePath(FileSystemInfo fileInfo,
|
||||
Folder parent = null)
|
||||
{
|
||||
return ResolvePath(fileInfo, new DirectoryService(_logger), parent);
|
||||
return ResolvePath(fileInfo, new DirectoryService(_logger, _fileSystem), parent);
|
||||
}
|
||||
|
||||
private BaseItem ResolvePath(FileSystemInfo fileInfo, IDirectoryService directoryService, Folder parent = null, string collectionType = null)
|
||||
@@ -1009,7 +1009,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
// Ensure the location is available.
|
||||
_fileSystem.CreateDirectory(ConfigurationManager.ApplicationPaths.PeoplePath);
|
||||
|
||||
return new PeopleValidator(this, _logger, ConfigurationManager).ValidatePeople(cancellationToken, progress);
|
||||
return new PeopleValidator(this, _logger, ConfigurationManager, _fileSystem).ValidatePeople(cancellationToken, progress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1064,7 +1064,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
progress.Report(.5);
|
||||
|
||||
// Start by just validating the children of the root, but go no further
|
||||
await RootFolder.ValidateChildren(new Progress<double>(), cancellationToken, new MetadataRefreshOptions(), recursive: false);
|
||||
await RootFolder.ValidateChildren(new Progress<double>(), cancellationToken, new MetadataRefreshOptions(_fileSystem), recursive: false);
|
||||
|
||||
progress.Report(1);
|
||||
|
||||
@@ -1072,7 +1072,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
await userRoot.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await userRoot.ValidateChildren(new Progress<double>(), cancellationToken, new MetadataRefreshOptions(), recursive: false).ConfigureAwait(false);
|
||||
await userRoot.ValidateChildren(new Progress<double>(), cancellationToken, new MetadataRefreshOptions(_fileSystem), recursive: false).ConfigureAwait(false);
|
||||
progress.Report(2);
|
||||
|
||||
var innerProgress = new ActionableProgress<double>();
|
||||
@@ -1080,7 +1080,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
innerProgress.RegisterAction(pct => progress.Report(2 + pct * .73));
|
||||
|
||||
// Now validate the entire media library
|
||||
await RootFolder.ValidateChildren(innerProgress, cancellationToken, new MetadataRefreshOptions(), recursive: true).ConfigureAwait(false);
|
||||
await RootFolder.ValidateChildren(innerProgress, cancellationToken, new MetadataRefreshOptions(_fileSystem), recursive: true).ConfigureAwait(false);
|
||||
|
||||
progress.Report(75);
|
||||
|
||||
@@ -1702,7 +1702,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
if (refresh)
|
||||
{
|
||||
await item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None).ConfigureAwait(false);
|
||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions
|
||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
// Not sure why this is necessary but need to figure it out
|
||||
// View images are not getting utilized without this
|
||||
@@ -1790,7 +1790,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (refresh)
|
||||
{
|
||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions
|
||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
// Need to force save to increment DateLastSaved
|
||||
ForceSave = true
|
||||
@@ -1860,7 +1860,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (refresh)
|
||||
{
|
||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions
|
||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
// Need to force save to increment DateLastSaved
|
||||
ForceSave = true
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
{
|
||||
@@ -24,17 +25,19 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
private IMediaSourceProvider[] _providers;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public MediaSourceManager(IItemRepository itemRepo, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer)
|
||||
public MediaSourceManager(IItemRepository itemRepo, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem)
|
||||
{
|
||||
_itemRepo = itemRepo;
|
||||
_userManager = userManager;
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public void AddParts(IEnumerable<IMediaSourceProvider> providers)
|
||||
|
||||
@@ -454,7 +454,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
/// <returns>Task.</returns>
|
||||
public Task RefreshUsersMetadata(CancellationToken cancellationToken)
|
||||
{
|
||||
var tasks = Users.Select(user => user.RefreshMetadata(new MetadataRefreshOptions(), cancellationToken)).ToList();
|
||||
var tasks = Users.Select(user => user.RefreshMetadata(new MetadataRefreshOptions(_fileSystem), cancellationToken)).ToList();
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
{
|
||||
@@ -29,17 +30,19 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PeopleValidator" /> class.
|
||||
/// </summary>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public PeopleValidator(ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config)
|
||||
public PeopleValidator(ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
_config = config;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
private bool DownloadMetadata(PersonInfo i, PeopleMetadataOptions options)
|
||||
@@ -121,7 +124,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
|
||||
validIds.Add(item.Id);
|
||||
|
||||
var options = new MetadataRefreshOptions
|
||||
var options = new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
MetadataRefreshMode = person.Value ? MetadataRefreshMode.Default : MetadataRefreshMode.ValidationOnly,
|
||||
ImageRefreshMode = person.Value ? ImageRefreshMode.Default : ImageRefreshMode.ValidationOnly
|
||||
|
||||
@@ -71,9 +71,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
_liveTvManager = (LiveTvManager)liveTvManager;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
|
||||
_recordingProvider = new ItemDataProvider<RecordingInfo>(jsonSerializer, _logger, Path.Combine(DataPath, "recordings"), (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase));
|
||||
_seriesTimerProvider = new SeriesTimerManager(jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers"));
|
||||
_timerProvider = new TimerManager(jsonSerializer, _logger, Path.Combine(DataPath, "timers"));
|
||||
_recordingProvider = new ItemDataProvider<RecordingInfo>(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "recordings"), (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase));
|
||||
_seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers"));
|
||||
_timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"));
|
||||
_timerProvider.TimerFired += _timerProvider_TimerFired;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
try
|
||||
{
|
||||
_filesystem.DeleteFile(remove.Path);
|
||||
_fileSystem.DeleteFile(remove.Path);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
@@ -16,13 +17,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
protected readonly ILogger Logger;
|
||||
private readonly string _dataPath;
|
||||
protected readonly Func<T, T, bool> EqualityComparer;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public ItemDataProvider(IJsonSerializer jsonSerializer, ILogger logger, string dataPath, Func<T, T, bool> equalityComparer)
|
||||
public ItemDataProvider(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, Func<T, T, bool> equalityComparer)
|
||||
{
|
||||
Logger = logger;
|
||||
_dataPath = dataPath;
|
||||
EqualityComparer = equalityComparer;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public IReadOnlyList<T> GetAll()
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
public class SeriesTimerManager : ItemDataProvider<SeriesTimerInfo>
|
||||
{
|
||||
public SeriesTimerManager(IJsonSerializer jsonSerializer, ILogger logger, string dataPath)
|
||||
: base(jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
|
||||
public SeriesTimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath)
|
||||
: base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
@@ -16,8 +17,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
public event EventHandler<GenericEventArgs<TimerInfo>> TimerFired;
|
||||
|
||||
public TimerManager(IJsonSerializer jsonSerializer, ILogger logger, string dataPath)
|
||||
: base(jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
|
||||
public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath)
|
||||
: base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -580,7 +580,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
item.Name = channelInfo.Name;
|
||||
}
|
||||
|
||||
await item.RefreshMetadata(new MetadataRefreshOptions
|
||||
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
ForceSave = isNew,
|
||||
ReplaceImages = replaceImages.Distinct().ToList()
|
||||
@@ -659,7 +659,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
}
|
||||
}
|
||||
|
||||
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions());
|
||||
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem));
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -759,7 +759,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions());
|
||||
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem));
|
||||
|
||||
return item.Id;
|
||||
}
|
||||
|
||||
@@ -12,14 +12,18 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
public class M3UTunerHost : BaseTunerHost, ITunerHost
|
||||
{
|
||||
public M3UTunerHost(IConfigurationManager config, ILogger logger)
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public M3UTunerHost(IConfigurationManager config, ILogger logger, IFileSystem fileSystem)
|
||||
: base(config, logger)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public override string Type
|
||||
|
||||
@@ -173,5 +173,6 @@
|
||||
"HeaderProducer": "Producers",
|
||||
"HeaderWriter": "Writers",
|
||||
"HeaderParentalRatings": "Parental Ratings",
|
||||
"HeaderCommunityRatings": "Community ratings"
|
||||
"HeaderCommunityRatings": "Community ratings",
|
||||
"StartupEmbyServerIsLoading": "Emby Server is loading. Please try again shortly."
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace MediaBrowser.Server.Implementations.Localization
|
||||
/// <returns>Dictionary{System.StringParentalRating}.</returns>
|
||||
private void LoadRatings(string file)
|
||||
{
|
||||
var dict = _fileSystem.ReadAllLines(file).Select(i =>
|
||||
var dict = File.ReadAllLines(file).Select(i =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(i))
|
||||
{
|
||||
|
||||
@@ -617,7 +617,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
/// <returns>Task.</returns>
|
||||
public Task SaveCriticReviews(Guid itemId, IEnumerable<ItemReview> criticReviews)
|
||||
{
|
||||
_fileSystem.CreateDirectory(_criticReviewsPath);
|
||||
Directory.CreateDirectory(_criticReviewsPath);
|
||||
|
||||
var path = Path.Combine(_criticReviewsPath, itemId + ".json");
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using MediaBrowser.Controller.Playlists;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Playlists
|
||||
{
|
||||
@@ -46,10 +47,12 @@ namespace MediaBrowser.Server.Implementations.Playlists
|
||||
public class PlaylistsDynamicFolder : IVirtualFolderCreator
|
||||
{
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public PlaylistsDynamicFolder(IApplicationPaths appPaths)
|
||||
public PlaylistsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
|
||||
{
|
||||
_appPaths = appPaths;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public BasePluginFolder GetFolder()
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace MediaBrowser.Server.Implementations.Playlists
|
||||
|
||||
await parentFolder.AddChild(playlist, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await playlist.RefreshMetadata(new MetadataRefreshOptions { ForceSave = true }, CancellationToken.None)
|
||||
await playlist.RefreshMetadata(new MetadataRefreshOptions(_fileSystem) { ForceSave = true }, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (options.ItemIdList.Count > 0)
|
||||
@@ -196,7 +196,7 @@ namespace MediaBrowser.Server.Implementations.Playlists
|
||||
|
||||
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
_providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions
|
||||
_providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
ForceSave = true
|
||||
});
|
||||
@@ -223,7 +223,7 @@ namespace MediaBrowser.Server.Implementations.Playlists
|
||||
|
||||
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
_providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions
|
||||
_providerManager.QueueRefresh(playlist.Id, new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
ForceSave = true
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
||||
{
|
||||
@@ -39,6 +40,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
|
||||
private readonly IEncodingManager _encodingManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChapterImagesTask" /> class.
|
||||
@@ -46,13 +48,14 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
||||
/// <param name="logManager">The log manager.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="itemRepo">The item repo.</param>
|
||||
public ChapterImagesTask(ILogManager logManager, ILibraryManager libraryManager, IItemRepository itemRepo, IApplicationPaths appPaths, IEncodingManager encodingManager)
|
||||
public ChapterImagesTask(ILogManager logManager, ILibraryManager libraryManager, IItemRepository itemRepo, IApplicationPaths appPaths, IEncodingManager encodingManager, IFileSystem fileSystem)
|
||||
{
|
||||
_logger = logManager.GetLogger(GetType().Name);
|
||||
_libraryManager = libraryManager;
|
||||
_itemRepo = itemRepo;
|
||||
_appPaths = appPaths;
|
||||
_encodingManager = encodingManager;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user