mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-02-09 22:22:24 +00:00
update series resolver
This commit is contained in:
@@ -182,8 +182,6 @@
|
||||
<Compile Include="Logging\UnhandledExceptionWriter.cs" />
|
||||
<Compile Include="MediaEncoder\EncodingManager.cs" />
|
||||
<Compile Include="Migrations\IVersionMigration.cs" />
|
||||
<Compile Include="Migrations\LibraryScanMigration.cs" />
|
||||
<Compile Include="Migrations\GuideMigration.cs" />
|
||||
<Compile Include="News\NewsEntryPoint.cs" />
|
||||
<Compile Include="News\NewsService.cs" />
|
||||
<Compile Include="Notifications\CoreNotificationTypes.cs" />
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
{
|
||||
if (!hasHeaders.Headers.ContainsKey("Server"))
|
||||
{
|
||||
hasHeaders.Headers["Server"] = "Mono-HTTPAPI/1.1, UPnP/1.0 DLNADOC/1.50";
|
||||
hasHeaders.Headers["Server"] = "Microsoft-NetCore/2.0, UPnP/1.0 DLNADOC/1.50";
|
||||
//hasHeaders.Headers["Server"] = "Mono-HTTPAPI/1.1";
|
||||
}
|
||||
|
||||
|
||||
@@ -2505,9 +2505,32 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
public NamingOptions GetNamingOptions()
|
||||
{
|
||||
return GetNamingOptions(true);
|
||||
}
|
||||
|
||||
public NamingOptions GetNamingOptions(bool allowOptimisticEpisodeDetection)
|
||||
{
|
||||
if (!allowOptimisticEpisodeDetection)
|
||||
{
|
||||
if (_namingOptionsWithoutOptimisticEpisodeDetection == null)
|
||||
{
|
||||
var namingOptions = new ExtendedNamingOptions();
|
||||
|
||||
InitNamingOptions(namingOptions);
|
||||
namingOptions.EpisodeExpressions = namingOptions.EpisodeExpressions
|
||||
.Where(i => i.IsNamed && !i.IsOptimistic)
|
||||
.ToList();
|
||||
|
||||
_namingOptionsWithoutOptimisticEpisodeDetection = namingOptions;
|
||||
}
|
||||
|
||||
return _namingOptionsWithoutOptimisticEpisodeDetection;
|
||||
}
|
||||
|
||||
return GetNamingOptions(new LibraryOptions());
|
||||
}
|
||||
|
||||
private NamingOptions _namingOptionsWithoutOptimisticEpisodeDetection;
|
||||
private NamingOptions _namingOptions;
|
||||
private string[] _videoFileExtensions;
|
||||
public NamingOptions GetNamingOptions(LibraryOptions libraryOptions)
|
||||
@@ -2516,23 +2539,8 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var options = new ExtendedNamingOptions();
|
||||
|
||||
// These cause apps to have problems
|
||||
options.AudioFileExtensions.Remove(".m3u");
|
||||
options.AudioFileExtensions.Remove(".wpl");
|
||||
InitNamingOptions(options);
|
||||
|
||||
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
{
|
||||
options.AudioFileExtensions.Remove(".rar");
|
||||
options.AudioFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
{
|
||||
options.VideoFileExtensions.Remove(".rar");
|
||||
options.VideoFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
options.VideoFileExtensions.Add(".tp");
|
||||
_namingOptions = options;
|
||||
_videoFileExtensions = _namingOptions.VideoFileExtensions.ToArray();
|
||||
}
|
||||
@@ -2540,6 +2548,27 @@ namespace Emby.Server.Implementations.Library
|
||||
return _namingOptions;
|
||||
}
|
||||
|
||||
private void InitNamingOptions(NamingOptions options)
|
||||
{
|
||||
// These cause apps to have problems
|
||||
options.AudioFileExtensions.Remove(".m3u");
|
||||
options.AudioFileExtensions.Remove(".wpl");
|
||||
|
||||
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
{
|
||||
options.AudioFileExtensions.Remove(".rar");
|
||||
options.AudioFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
{
|
||||
options.VideoFileExtensions.Remove(".rar");
|
||||
options.VideoFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
options.VideoFileExtensions.Add(".tp");
|
||||
}
|
||||
|
||||
public ItemLookupInfo ParseName(string name)
|
||||
{
|
||||
var resolver = new VideoResolver(GetNamingOptions(), new NullLogger());
|
||||
|
||||
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System.IO;
|
||||
|
||||
namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
{
|
||||
@@ -42,6 +43,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
|
||||
if (_libraryManager.IsAudioFile(args.Path, libraryOptions))
|
||||
{
|
||||
if (string.Equals(Path.GetExtension(args.Path), ".cue", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// if audio file exists of same name, return null
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var collectionType = args.GetCollectionType();
|
||||
|
||||
var isMixed = string.IsNullOrWhiteSpace(collectionType);
|
||||
|
||||
@@ -160,15 +160,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
return true;
|
||||
}
|
||||
|
||||
var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions();
|
||||
|
||||
// In mixed folders we need to be conservative and avoid expressions that may result in false positives (e.g. movies with numbers in the title)
|
||||
if (!isTvContentType)
|
||||
{
|
||||
namingOptions.EpisodeExpressions = namingOptions.EpisodeExpressions
|
||||
.Where(i => i.IsNamed && !i.IsOptimistic)
|
||||
.ToList();
|
||||
}
|
||||
var allowOptimisticEpisodeDetection = isTvContentType;
|
||||
var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions(allowOptimisticEpisodeDetection);
|
||||
|
||||
var episodeResolver = new MediaBrowser.Naming.TV.EpisodeResolver(namingOptions, new NullLogger());
|
||||
var episodeInfo = episodeResolver.Resolve(fullName, false, false);
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using System.Linq;
|
||||
|
||||
namespace Emby.Server.Implementations.Migrations
|
||||
{
|
||||
public class GuideMigration : IVersionMigration
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
public GuideMigration(IServerConfigurationManager config, ITaskManager taskManager)
|
||||
{
|
||||
_config = config;
|
||||
_taskManager = taskManager;
|
||||
}
|
||||
|
||||
public Task Run()
|
||||
{
|
||||
var name = "GuideRefresh3";
|
||||
|
||||
if (!_config.Configuration.Migrations.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
_taskManager.QueueScheduledTask(_taskManager.ScheduledTasks.Select(i => i.ScheduledTask)
|
||||
.First(i => string.Equals(i.Key, "RefreshGuide", StringComparison.OrdinalIgnoreCase)));
|
||||
});
|
||||
|
||||
var list = _config.Configuration.Migrations.ToList();
|
||||
list.Add(name);
|
||||
_config.Configuration.Migrations = list.ToArray();
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using System.Linq;
|
||||
|
||||
namespace Emby.Server.Implementations.Migrations
|
||||
{
|
||||
public class LibraryScanMigration : IVersionMigration
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
public LibraryScanMigration(IServerConfigurationManager config, ITaskManager taskManager)
|
||||
{
|
||||
_config = config;
|
||||
_taskManager = taskManager;
|
||||
}
|
||||
|
||||
public Task Run()
|
||||
{
|
||||
var name = "LibraryScan6";
|
||||
|
||||
if (!_config.Configuration.Migrations.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
_taskManager.QueueScheduledTask(_taskManager.ScheduledTasks.Select(i => i.ScheduledTask)
|
||||
.First(i => string.Equals(i.Key, "RefreshLibrary", StringComparison.OrdinalIgnoreCase)));
|
||||
});
|
||||
|
||||
var list = _config.Configuration.Migrations.ToList();
|
||||
list.Add(name);
|
||||
_config.Configuration.Migrations = list.ToArray();
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user