mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 05:53:03 +03:00
Merge branch 'master' into locale
This commit is contained in:
@@ -879,7 +879,7 @@ namespace Emby.Server.Implementations
|
||||
MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder);
|
||||
RegisterSingleInstance(MediaSourceManager);
|
||||
|
||||
SubtitleManager = new SubtitleManager(LoggerFactory, FileSystemManager, LibraryMonitor, MediaSourceManager, ServerConfigurationManager, LocalizationManager);
|
||||
SubtitleManager = new SubtitleManager(LoggerFactory, FileSystemManager, LibraryMonitor, MediaSourceManager, LocalizationManager);
|
||||
RegisterSingleInstance(SubtitleManager);
|
||||
|
||||
ProviderManager = new ProviderManager(HttpClient, SubtitleManager, ServerConfigurationManager, LibraryMonitor, LoggerFactory, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer);
|
||||
@@ -1006,7 +1006,7 @@ namespace Emby.Server.Implementations
|
||||
|
||||
try
|
||||
{
|
||||
if (!FileSystemManager.FileExists(certificateLocation))
|
||||
if (!File.Exists(certificateLocation))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -1432,7 +1432,7 @@ namespace Emby.Server.Implementations
|
||||
|
||||
//if (generateCertificate)
|
||||
//{
|
||||
// if (!FileSystemManager.FileExists(certPath))
|
||||
// if (!File.Exists(certPath))
|
||||
// {
|
||||
// FileSystemManager.CreateDirectory(FileSystemManager.GetDirectoryName(certPath));
|
||||
|
||||
@@ -1562,7 +1562,7 @@ namespace Emby.Server.Implementations
|
||||
/// <returns>IEnumerable{Assembly}.</returns>
|
||||
protected List<Tuple<Assembly, string>> GetComposablePartAssemblies()
|
||||
{
|
||||
var list = GetPluginAssemblies();
|
||||
var list = GetPluginAssemblies(ApplicationPaths.PluginsPath);
|
||||
|
||||
// Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that
|
||||
// This will prevent the .dll file from getting locked, and allow us to replace it when needed
|
||||
@@ -1613,79 +1613,6 @@ namespace Emby.Server.Implementations
|
||||
|
||||
protected abstract IEnumerable<Assembly> GetAssembliesWithPartsInternal();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin assemblies.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{Assembly}.</returns>
|
||||
private List<Tuple<Assembly, string>> GetPluginAssemblies()
|
||||
{
|
||||
// Copy pre-installed plugins
|
||||
var sourcePath = Path.Combine(ApplicationPaths.ApplicationResourcesPath, "plugins");
|
||||
CopyPlugins(sourcePath, ApplicationPaths.PluginsPath);
|
||||
|
||||
return GetPluginAssemblies(ApplicationPaths.PluginsPath);
|
||||
}
|
||||
|
||||
private void CopyPlugins(string source, string target)
|
||||
{
|
||||
List<string> files;
|
||||
|
||||
try
|
||||
{
|
||||
files = Directory.EnumerateFiles(source, "*.dll", SearchOption.TopDirectoryOnly)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (files.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var sourceFile in files)
|
||||
{
|
||||
var filename = Path.GetFileName(sourceFile);
|
||||
var targetFile = Path.Combine(target, filename);
|
||||
|
||||
var targetFileExists = File.Exists(targetFile);
|
||||
|
||||
if (!targetFileExists && ServerConfigurationManager.Configuration.UninstalledPlugins.Contains(filename, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (targetFileExists && GetDllVersion(targetFile) >= GetDllVersion(sourceFile))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(target);
|
||||
File.Copy(sourceFile, targetFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
private Version GetDllVersion(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = Version.Parse(FileVersionInfo.GetVersionInfo(path).FileVersion);
|
||||
|
||||
Logger.LogInformation("File {Path} has version {Version}", path, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error getting version number from {Path}", path);
|
||||
|
||||
return new Version(1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Tuple<Assembly, string>> GetPluginAssemblies(string path)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user