mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
e5a78ba5bf
12 changed files with 80 additions and 119 deletions
|
@ -98,17 +98,16 @@ namespace MediaBrowser.Api.Library
|
||||||
|
|
||||||
if (!Directory.Exists(path))
|
if (!Directory.Exists(path))
|
||||||
{
|
{
|
||||||
throw new DirectoryNotFoundException("The media folder does not exist");
|
throw new DirectoryNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName));
|
||||||
}
|
}
|
||||||
|
|
||||||
var shortcut = Directory.EnumerateFiles(path, "*.lnk", SearchOption.AllDirectories).FirstOrDefault(f => FileSystem.ResolveShortcut(f).Equals(mediaPath, StringComparison.OrdinalIgnoreCase));
|
var shortcut = Directory.EnumerateFiles(path, "*.lnk", SearchOption.AllDirectories).FirstOrDefault(f => FileSystem.ResolveShortcut(f).Equals(mediaPath, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(shortcut))
|
if (!string.IsNullOrEmpty(shortcut))
|
||||||
{
|
{
|
||||||
throw new DirectoryNotFoundException("The media folder does not exist");
|
|
||||||
}
|
|
||||||
File.Delete(shortcut);
|
File.Delete(shortcut);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds an additional mediaPath to an existing virtual folder, within either the default view or a user view
|
/// Adds an additional mediaPath to an existing virtual folder, within either the default view or a user view
|
||||||
|
|
|
@ -314,6 +314,8 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
var newUser = _userManager.CreateUser(dtoUser.Name).Result;
|
var newUser = _userManager.CreateUser(dtoUser.Name).Result;
|
||||||
|
|
||||||
|
newUser.UpdateConfiguration(dtoUser.Configuration, _xmlSerializer);
|
||||||
|
|
||||||
var result = new DtoBuilder(Logger).GetDtoUser(newUser);
|
var result = new DtoBuilder(Logger).GetDtoUser(newUser);
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
|
|
|
@ -158,9 +158,9 @@ namespace MediaBrowser.Common.Implementations
|
||||||
{
|
{
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
Logger = LogManager.GetLogger("App");
|
IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
|
||||||
|
|
||||||
IsFirstRun = !File.Exists(ApplicationPaths.SystemConfigurationFilePath);
|
Logger = LogManager.GetLogger("App");
|
||||||
|
|
||||||
DiscoverTypes();
|
DiscoverTypes();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Model.Logging;
|
using System.Linq;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
|
@ -56,23 +57,21 @@ namespace MediaBrowser.Common.Implementations.Logging
|
||||||
logFile.FileName = path;
|
logFile.FileName = path;
|
||||||
logFile.Layout = "${longdate}, ${level}, ${logger}, ${message}";
|
logFile.Layout = "${longdate}, ${level}, ${logger}, ${message}";
|
||||||
|
|
||||||
AddLogTarget(logFile, "ApplicationLogFile", level);
|
RemoveTarget("ApplicationLogFile");
|
||||||
|
logFile.Name = "ApplicationLogFile";
|
||||||
|
|
||||||
|
AddLogTarget(logFile, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the log target.
|
/// Adds the log target.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">The target.</param>
|
/// <param name="target">The target.</param>
|
||||||
/// <param name="name">The name.</param>
|
|
||||||
/// <param name="level">The level.</param>
|
/// <param name="level">The level.</param>
|
||||||
private void AddLogTarget(Target target, string name, LogSeverity level)
|
private void AddLogTarget(Target target, LogSeverity level)
|
||||||
{
|
{
|
||||||
var config = LogManager.Configuration;
|
var config = LogManager.Configuration;
|
||||||
|
config.AddTarget(target.Name, target);
|
||||||
config.RemoveTarget(name);
|
|
||||||
|
|
||||||
target.Name = name;
|
|
||||||
config.AddTarget(name, target);
|
|
||||||
|
|
||||||
var rule = new LoggingRule("*", GetLogLevel(level), target);
|
var rule = new LoggingRule("*", GetLogLevel(level), target);
|
||||||
config.LoggingRules.Add(rule);
|
config.LoggingRules.Add(rule);
|
||||||
|
@ -80,6 +79,35 @@ namespace MediaBrowser.Common.Implementations.Logging
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the target.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name.</param>
|
||||||
|
public void RemoveTarget(string name)
|
||||||
|
{
|
||||||
|
var config = LogManager.Configuration;
|
||||||
|
|
||||||
|
var target = config.FindTargetByName(name);
|
||||||
|
|
||||||
|
if (target != null)
|
||||||
|
{
|
||||||
|
foreach (var rule in config.LoggingRules.ToList())
|
||||||
|
{
|
||||||
|
var contains = rule.Targets.Contains(target);
|
||||||
|
|
||||||
|
rule.Targets.Remove(target);
|
||||||
|
|
||||||
|
if (contains)
|
||||||
|
{
|
||||||
|
config.LoggingRules.Remove(rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.RemoveTarget(name);
|
||||||
|
LogManager.Configuration = config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the logger.
|
/// Gets the logger.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Kernel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This is just a collection of semaphores to control the number of concurrent executions of various resources
|
|
||||||
/// </summary>
|
|
||||||
public class ResourcePool : IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// You tube
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim YouTube = new SemaphoreSlim(5, 5);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The trakt
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim Trakt = new SemaphoreSlim(5, 5);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The tv db
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim TvDb = new SemaphoreSlim(5, 5);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The movie db
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim MovieDb = new SemaphoreSlim(5, 5);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The fan art
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim FanArt = new SemaphoreSlim(5, 5);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The mb
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim Mb = new SemaphoreSlim(5, 5);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The mb
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim Lastfm = new SemaphoreSlim(5, 5);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Apple doesn't seem to like too many simulataneous requests.
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim AppleTrailerVideos = new SemaphoreSlim(1, 1);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The apple trailer images
|
|
||||||
/// </summary>
|
|
||||||
public readonly SemaphoreSlim AppleTrailerImages = new SemaphoreSlim(1, 1);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases unmanaged and - optionally - managed resources.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
|
||||||
protected virtual void Dispose(bool dispose)
|
|
||||||
{
|
|
||||||
if (dispose)
|
|
||||||
{
|
|
||||||
YouTube.Dispose();
|
|
||||||
Trakt.Dispose();
|
|
||||||
TvDb.Dispose();
|
|
||||||
MovieDb.Dispose();
|
|
||||||
FanArt.Dispose();
|
|
||||||
Mb.Dispose();
|
|
||||||
AppleTrailerVideos.Dispose();
|
|
||||||
AppleTrailerImages.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -66,6 +66,13 @@ namespace MediaBrowser.Model.Configuration
|
||||||
[ProtoMember(59)]
|
[ProtoMember(59)]
|
||||||
public int LegacyWebSocketPortNumber { get; set; }
|
public int LegacyWebSocketPortNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this instance is first run.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
|
||||||
|
[ProtoMember(4)]
|
||||||
|
public bool IsStartupWizardCompleted { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using NLog;
|
using MediaBrowser.Common.Implementations.Logging;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -18,14 +20,17 @@ namespace MediaBrowser.ServerApplication.Logging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly TaskScheduler _uiThread;
|
private readonly TaskScheduler _uiThread;
|
||||||
|
|
||||||
|
private readonly ILogManager _logManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LogWindow" /> class.
|
/// Initializes a new instance of the <see cref="LogWindow" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public LogWindow()
|
public LogWindow(ILogManager logManager)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_uiThread = TaskScheduler.FromCurrentSynchronizationContext();
|
_uiThread = TaskScheduler.FromCurrentSynchronizationContext();
|
||||||
|
_logManager = logManager;
|
||||||
|
|
||||||
Loaded += LogWindow_Loaded;
|
Loaded += LogWindow_Loaded;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +47,7 @@ namespace MediaBrowser.ServerApplication.Logging
|
||||||
Layout = "${longdate}, ${level}, ${logger}, ${message}"
|
Layout = "${longdate}, ${level}, ${logger}, ${message}"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
((NlogManager)_logManager).RemoveTarget("LogWindowTraceTarget");
|
||||||
AddLogTarget(target, "LogWindowTraceTarget");
|
AddLogTarget(target, "LogWindowTraceTarget");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +59,7 @@ namespace MediaBrowser.ServerApplication.Logging
|
||||||
{
|
{
|
||||||
base.OnClosing(e);
|
base.OnClosing(e);
|
||||||
|
|
||||||
RemoveLogTarget("LogWindowTraceTarget");
|
((NlogManager) _logManager).RemoveTarget("LogWindowTraceTarget");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -83,8 +89,6 @@ namespace MediaBrowser.ServerApplication.Logging
|
||||||
{
|
{
|
||||||
var config = NLog.LogManager.Configuration;
|
var config = NLog.LogManager.Configuration;
|
||||||
|
|
||||||
config.RemoveTarget(name);
|
|
||||||
|
|
||||||
target.Name = name;
|
target.Name = name;
|
||||||
config.AddTarget(name, target);
|
config.AddTarget(name, target);
|
||||||
|
|
||||||
|
@ -96,19 +100,6 @@ namespace MediaBrowser.ServerApplication.Logging
|
||||||
NLog.LogManager.Configuration = config;
|
NLog.LogManager.Configuration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes the log target.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">The name.</param>
|
|
||||||
private void RemoveLogTarget(string name)
|
|
||||||
{
|
|
||||||
var config = NLog.LogManager.Configuration;
|
|
||||||
|
|
||||||
config.RemoveTarget(name);
|
|
||||||
|
|
||||||
NLog.LogManager.Configuration = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shuts down.
|
/// Shuts down.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace MediaBrowser.ServerApplication
|
||||||
// Add our log window if specified
|
// Add our log window if specified
|
||||||
if (_configurationManager.Configuration.ShowLogWindow)
|
if (_configurationManager.Configuration.ShowLogWindow)
|
||||||
{
|
{
|
||||||
Trace.Listeners.Add(new WindowTraceListener(new LogWindow()));
|
Trace.Listeners.Add(new WindowTraceListener(new LogWindow(_logManager)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -430,6 +430,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
"UpdatePasswordPage.js",
|
"UpdatePasswordPage.js",
|
||||||
"UserImagePage.js",
|
"UserImagePage.js",
|
||||||
"UserProfilesPage.js",
|
"UserProfilesPage.js",
|
||||||
|
"WizardFinishPage.js",
|
||||||
"WizardStartPage.js",
|
"WizardStartPage.js",
|
||||||
"WizardUserPage.js",
|
"WizardUserPage.js",
|
||||||
"SupporterKeyPage.js",
|
"SupporterKeyPage.js",
|
||||||
|
|
16
MediaBrowser.WebDashboard/Html/scripts/WizardFinishPage.js
Normal file
16
MediaBrowser.WebDashboard/Html/scripts/WizardFinishPage.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
var WizardFinishPage = {
|
||||||
|
|
||||||
|
onFinish: function() {
|
||||||
|
|
||||||
|
ApiClient.getServerConfiguration().done(function (config) {
|
||||||
|
|
||||||
|
config.IsStartupWizardCompleted = true;
|
||||||
|
|
||||||
|
ApiClient.updateServerConfiguration(config).done(function() {
|
||||||
|
Dashboard.navigate('dashboard.html');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<div class="wizardNavigation">
|
<div class="wizardNavigation">
|
||||||
<button type="button" data-iconpos="left" data-icon="arrow-left" data-inline="true" onclick="history.back();">Previous</button>
|
<button type="button" data-iconpos="left" data-icon="arrow-left" data-inline="true" onclick="history.back();">Previous</button>
|
||||||
<button type="button" data-iconpos="right" data-icon="wrench" data-inline="true" onclick="Dashboard.navigate('dashboard.html');" data-theme="b">Go to the Dashboard</button>
|
<button type="button" data-iconpos="right" data-icon="wrench" data-inline="true" onclick="WizardFinishPage.onFinish();" data-theme="b">Go to the Dashboard</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -384,6 +384,7 @@
|
||||||
<EmbeddedResource Include="Html\scripts\ItemDetailPage.js" />
|
<EmbeddedResource Include="Html\scripts\ItemDetailPage.js" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Html\scripts\WizardFinishPage.js" />
|
||||||
<EmbeddedResource Include="Html\Readme.txt" />
|
<EmbeddedResource Include="Html\Readme.txt" />
|
||||||
<EmbeddedResource Include="Html\css\images\media\playCircle.png" />
|
<EmbeddedResource Include="Html\css\images\media\playCircle.png" />
|
||||||
<EmbeddedResource Include="Html\css\images\media\nextTrack.png" />
|
<EmbeddedResource Include="Html\css\images\media\nextTrack.png" />
|
||||||
|
|
Loading…
Reference in a new issue