mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
auto-organize fixes
This commit is contained in:
parent
7d716dd94b
commit
4d66f6dc6c
@ -119,8 +119,6 @@ namespace MediaBrowser.Api.Library
|
||||
{
|
||||
private readonly IFileOrganizationService _iFileOrganizationService;
|
||||
|
||||
/// The _json serializer
|
||||
/// </summary>
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
public FileOrganizationService(IFileOrganizationService iFileOrganizationService, IJsonSerializer jsonSerializer)
|
||||
|
@ -85,14 +85,14 @@ namespace MediaBrowser.Dlna.Main
|
||||
_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
|
||||
}
|
||||
|
||||
private bool _lastEnableUPnP;
|
||||
private bool _lastEnableUpnP;
|
||||
void _config_ConfigurationUpdated(object sender, EventArgs e)
|
||||
{
|
||||
if (_lastEnableUPnP != _config.Configuration.EnableUPnP)
|
||||
if (_lastEnableUpnP != _config.Configuration.EnableUPnP)
|
||||
{
|
||||
ReloadComponents();
|
||||
}
|
||||
_lastEnableUPnP = _config.Configuration.EnableUPnP;
|
||||
_lastEnableUpnP = _config.Configuration.EnableUPnP;
|
||||
}
|
||||
|
||||
void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
|
||||
@ -111,7 +111,10 @@ namespace MediaBrowser.Dlna.Main
|
||||
{
|
||||
if (_ssdpHandlerStarted)
|
||||
{
|
||||
StopSsdpHandler();
|
||||
// Sat/ip live tv depends on device discovery, as well as hd homerun detection
|
||||
// In order to allow this to be disabled, we need a modular way of knowing if there are
|
||||
// any parts of the system that are dependant on it
|
||||
// DisposeSsdpHandler();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -149,10 +152,9 @@ namespace MediaBrowser.Dlna.Main
|
||||
try
|
||||
{
|
||||
_ssdpHandler.Start();
|
||||
|
||||
((DeviceDiscovery)_deviceDiscovery).Start(_ssdpHandler);
|
||||
|
||||
_ssdpHandlerStarted = true;
|
||||
|
||||
StartDeviceDiscovery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -160,8 +162,34 @@ namespace MediaBrowser.Dlna.Main
|
||||
}
|
||||
}
|
||||
|
||||
private void StopSsdpHandler()
|
||||
private void StartDeviceDiscovery()
|
||||
{
|
||||
try
|
||||
{
|
||||
((DeviceDiscovery)_deviceDiscovery).Start(_ssdpHandler);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error starting device discovery", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisposeDeviceDiscovery()
|
||||
{
|
||||
try
|
||||
{
|
||||
((DeviceDiscovery)_deviceDiscovery).Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error stopping device discovery", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisposeSsdpHandler()
|
||||
{
|
||||
DisposeDeviceDiscovery();
|
||||
|
||||
try
|
||||
{
|
||||
((DeviceDiscovery)_deviceDiscovery).Dispose();
|
||||
@ -277,6 +305,7 @@ namespace MediaBrowser.Dlna.Main
|
||||
{
|
||||
DisposeDlnaServer();
|
||||
DisposePlayToManager();
|
||||
DisposeSsdpHandler();
|
||||
}
|
||||
|
||||
public void DisposeDlnaServer()
|
||||
|
@ -356,6 +356,11 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
|
||||
private void SaveSmartMatchString(string matchString, Series series, AutoOrganizeOptions options)
|
||||
{
|
||||
if (string.IsNullOrEmpty(matchString) || matchString.Length < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(i => string.Equals(i.ItemName, series.Name, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (info == null)
|
||||
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
return _repo.Delete(resultId);
|
||||
}
|
||||
|
||||
private AutoOrganizeOptions GetAutoOrganizeptions()
|
||||
private AutoOrganizeOptions GetAutoOrganizeOptions()
|
||||
{
|
||||
return _config.GetAutoOrganizeOptions();
|
||||
}
|
||||
@ -112,7 +112,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
var organizer = new EpisodeFileOrganizer(this, _config, _fileSystem, _logger, _libraryManager,
|
||||
_libraryMonitor, _providerManager);
|
||||
|
||||
await organizer.OrganizeEpisodeFile(result.OriginalPath, GetAutoOrganizeptions(), true, CancellationToken.None)
|
||||
await organizer.OrganizeEpisodeFile(result.OriginalPath, GetAutoOrganizeOptions(), true, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
var organizer = new EpisodeFileOrganizer(this, _config, _fileSystem, _logger, _libraryManager,
|
||||
_libraryMonitor, _providerManager);
|
||||
|
||||
await organizer.OrganizeWithCorrection(request, GetAutoOrganizeptions(), CancellationToken.None).ConfigureAwait(false);
|
||||
await organizer.OrganizeWithCorrection(request, GetAutoOrganizeOptions(), CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public QueryResult<SmartMatchInfo> GetSmartMatchInfos(FileOrganizationResultQuery query)
|
||||
@ -136,7 +136,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
throw new ArgumentNullException("query");
|
||||
}
|
||||
|
||||
var options = GetAutoOrganizeptions();
|
||||
var options = GetAutoOrganizeOptions();
|
||||
|
||||
var items = options.SmartMatchInfos.Skip(query.StartIndex ?? 0).Take(query.Limit ?? Int32.MaxValue).ToArray();
|
||||
|
||||
@ -159,7 +159,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||
throw new ArgumentNullException("matchString");
|
||||
}
|
||||
|
||||
var options = GetAutoOrganizeptions();
|
||||
var options = GetAutoOrganizeOptions();
|
||||
|
||||
SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(i => string.Equals(i.ItemName, itemName));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user