aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs6
-rw-r--r--Emby.Server.Implementations/Updates/InstallationManager.cs38
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs5
-rw-r--r--deployment/windows/install-jellyfin.ps110
4 files changed, 45 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 41ca2a102..05f8a8a5e 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1046,8 +1046,8 @@ namespace Emby.Server.Implementations
private async void PluginInstalled(object sender, GenericEventArgs<PackageVersionInfo> args)
{
- string dir = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(args.Argument.targetFilename));
- var types = Directory.EnumerateFiles(dir, "*.dll", SearchOption.TopDirectoryOnly)
+ string dir = Path.Combine(ApplicationPaths.PluginsPath, args.Argument.name);
+ var types = Directory.EnumerateFiles(dir, "*.dll", SearchOption.AllDirectories)
.Select(x => Assembly.LoadFrom(x))
.SelectMany(x => x.ExportedTypes)
.Where(x => x.IsClass && !x.IsAbstract && !x.IsInterface && !x.IsGenericType)
@@ -1346,7 +1346,7 @@ namespace Emby.Server.Implementations
{
if (Directory.Exists(ApplicationPaths.PluginsPath))
{
- foreach (var file in Directory.EnumerateFiles(ApplicationPaths.PluginsPath, "*.dll", SearchOption.TopDirectoryOnly))
+ foreach (var file in Directory.EnumerateFiles(ApplicationPaths.PluginsPath, "*.dll", SearchOption.AllDirectories))
{
Logger.LogInformation("Loading assembly {Path}", file);
yield return Assembly.LoadFrom(file);
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 7310de55d..6833c20c3 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -509,6 +509,8 @@ namespace Emby.Server.Implementations.Updates
private async Task PerformPackageInstallation(IProgress<double> progress, string target, PackageVersionInfo package, CancellationToken cancellationToken)
{
+ // TODO: Remove the `string target` argument as it is not used any longer
+
var extension = Path.GetExtension(package.targetFilename);
var isArchive = string.Equals(extension, ".zip", StringComparison.OrdinalIgnoreCase);
@@ -518,12 +520,12 @@ namespace Emby.Server.Implementations.Updates
return;
}
- if (target == null)
- {
- target = Path.Combine(_appPaths.PluginsPath, Path.GetFileNameWithoutExtension(package.targetFilename));
- }
+ // Always override the passed-in target (which is a file) and figure it out again
+ target = Path.Combine(_appPaths.PluginsPath, package.name);
+ _logger.LogDebug("Installing plugin to {Filename}.", target);
// Download to temporary file so that, if interrupted, it won't destroy the existing installation
+ _logger.LogDebug("Downloading ZIP.");
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
{
Url = package.sourceUrl,
@@ -536,9 +538,17 @@ namespace Emby.Server.Implementations.Updates
// TODO: Validate with a checksum, *properly*
+ // Check if the target directory already exists, and remove it if so
+ if (Directory.Exists(target))
+ {
+ _logger.LogDebug("Deleting existing plugin at {Filename}.", target);
+ Directory.Delete(target, true);
+ }
+
// Success - move it to the real target
try
{
+ _logger.LogDebug("Extracting ZIP {TempFile} to {Filename}.", tempFile, target);
using (var stream = File.OpenRead(tempFile))
{
_zipClient.ExtractAllFromZip(stream, target, true);
@@ -552,6 +562,7 @@ namespace Emby.Server.Implementations.Updates
try
{
+ _logger.LogDebug("Deleting temporary file {Filename}.", tempFile);
_fileSystem.DeleteFile(tempFile);
}
catch (IOException ex)
@@ -574,7 +585,13 @@ namespace Emby.Server.Implementations.Updates
_applicationHost.RemovePlugin(plugin);
var path = plugin.AssemblyFilePath;
- _logger.LogInformation("Deleting plugin file {0}", path);
+ bool isDirectory = false;
+ // Check if we have a plugin directory we should remove too
+ if (Path.GetDirectoryName(plugin.AssemblyFilePath) != _appPaths.PluginsPath)
+ {
+ path = Path.GetDirectoryName(plugin.AssemblyFilePath);
+ isDirectory = true;
+ }
// Make this case-insensitive to account for possible incorrect assembly naming
var file = _fileSystem.GetFilePaths(Path.GetDirectoryName(path))
@@ -585,7 +602,16 @@ namespace Emby.Server.Implementations.Updates
path = file;
}
- _fileSystem.DeleteFile(path);
+ if (isDirectory)
+ {
+ _logger.LogInformation("Deleting plugin directory {0}", path);
+ Directory.Delete(path, true);
+ }
+ else
+ {
+ _logger.LogInformation("Deleting plugin file {0}", path);
+ _fileSystem.DeleteFile(path);
+ }
var list = _config.Configuration.UninstalledPlugins.ToList();
var filename = Path.GetFileName(path);
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index 4867c0f85..b626600fa 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -230,6 +230,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// <returns></returns>
private string ExistsOnSystemPath(string filename)
{
+ string inJellyfinPath = GetEncoderPathFromDirectory(System.AppContext.BaseDirectory, filename);
+ if (!string.IsNullOrEmpty(inJellyfinPath))
+ {
+ return inJellyfinPath;
+ }
var values = Environment.GetEnvironmentVariable("PATH");
foreach (var path in values.Split(Path.PathSeparator))
diff --git a/deployment/windows/install-jellyfin.ps1 b/deployment/windows/install-jellyfin.ps1
index b6e00e056..0cd7f5236 100644
--- a/deployment/windows/install-jellyfin.ps1
+++ b/deployment/windows/install-jellyfin.ps1
@@ -58,7 +58,7 @@ function Elevate-Window {
if($Quiet.IsPresent -or $Quiet -eq $true){
if([string]::IsNullOrEmpty($JellyfinLibraryLocation)){
- $Script:JellyfinDataDir = "$env:AppData\jellyfin\"
+ $Script:JellyfinDataDir = "$env:LOCALAPPDATA\jellyfin\"
}else{
$Script:JellyfinDataDir = $JellyfinLibraryLocation
}
@@ -82,7 +82,7 @@ if($Quiet.IsPresent -or $Quiet -eq $true){
}else{
$Script:InstallServiceAsUser = $true
$Script:UserCredentials = $ServiceUser
- $Script:JellyfinDataDir = "C:\Users\$($Script:UserCredentials.UserName)\Appdata\Roaming\jellyfin\"}
+ $Script:JellyfinDataDir = "$env:HOMEDRIVE\Users\$($Script:UserCredentials.UserName)\Appdata\Local\jellyfin\"}
if($CreateDesktopShorcut.IsPresent -or $CreateDesktopShorcut -eq $true) {$Script:CreateShortcut = $true}else{$Script:CreateShortcut = $false}
if($MigrateEmbyLibrary.IsPresent -or $MigrateEmbyLibrary -eq $true){$Script:MigrateLibrary = $true}else{$Script:MigrateLibrary = $false}
if($LaunchJellyfin.IsPresent -or $LaunchJellyfin -eq $true){$Script:StartJellyfin = $true}else{$Script:StartJellyfin = $false}
@@ -131,7 +131,7 @@ if($Quiet.IsPresent -or $Quiet -eq $true){
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
-$Script:JellyFinDataDir = "$env:AppData\jellyfin\"
+$Script:JellyFinDataDir = "$env:LOCALAPPDATA\jellyfin\"
$Script:DefaultJellyfinInstallDirectory = "$env:Appdata\jellyfin\"
$Script:defaultEmbyDataDir = "$env:Appdata\Emby-Server\"
$Script:InstallAsService = $False
@@ -392,7 +392,7 @@ $ServiceUserBox.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDow
$GUIElementsCollection += $ServiceUserBox
$MigrateLibraryCheck = New-Object system.Windows.Forms.CheckBox
-$MigrateLibraryCheck.text = "Import Emby Library"
+$MigrateLibraryCheck.text = "Import Emby/Old JF Library"
$MigrateLibraryCheck.AutoSize = $false
$MigrateLibraryCheck.width = 160
$MigrateLibraryCheck.height = 20
@@ -401,7 +401,7 @@ $MigrateLibraryCheck.Font = 'Microsoft Sans Serif,10'
$GUIElementsCollection += $MigrateLibraryCheck
$LibraryMigrationLabel = New-Object system.Windows.Forms.Label
-$LibraryMigrationLabel.text = "Emby Library Path"
+$LibraryMigrationLabel.text = "Emby/Old JF Library Path"
$LibraryMigrationLabel.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
$LibraryMigrationLabel.AutoSize = $false
$LibraryMigrationLabel.width = 120