diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
index 506774b4a5..e2ef4864d0 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
@@ -171,6 +171,12 @@ namespace MediaBrowser.Common.Implementations
/// The name.
public abstract string Name { get; }
+ ///
+ /// Gets a value indicating whether this instance is running as service.
+ ///
+ /// true if this instance is running as service; otherwise, false.
+ public abstract bool IsRunningAsService { get; }
+
///
/// Initializes a new instance of the class.
///
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs
index 46f3fd4a9f..9c0fe165d4 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/StatisticsTask.cs
@@ -1,6 +1,4 @@
-using System.Reflection;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Common.Net;
+using MediaBrowser.Common.Net;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Model.Logging;
using System;
@@ -74,7 +72,16 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
progress.Report(0);
var mac = NetworkManager.GetMacAddress();
- var data = new Dictionary { { "feature", ApplicationHost.Name }, { "mac", mac }, { "ver", ApplicationHost.ApplicationVersion.ToString() }, { "platform", Environment.OSVersion.VersionString } };
+
+ var data = new Dictionary
+ {
+ { "feature", ApplicationHost.Name },
+ { "mac", mac },
+ { "ver", ApplicationHost.ApplicationVersion.ToString() },
+ { "platform", Environment.OSVersion.VersionString },
+ { "isservice", ApplicationHost.IsRunningAsService.ToString().ToLower()}
+ };
+
await HttpClient.Post(Constants.Constants.MbAdminUrl + "service/registration/ping", data, CancellationToken.None).ConfigureAwait(false);
progress.Report(100);
@@ -86,7 +93,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
/// The name.
public string Name
{
- get { return "Collect stats"; }
+ get { return "Collect anonymous usage stats"; }
}
///
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs
index 8cd1252c74..3d5f3c96f9 100644
--- a/MediaBrowser.Common/IApplicationHost.cs
+++ b/MediaBrowser.Common/IApplicationHost.cs
@@ -24,6 +24,12 @@ namespace MediaBrowser.Common
///
event EventHandler> ApplicationUpdated;
+ ///
+ /// Gets a value indicating whether this instance is running as service.
+ ///
+ /// true if this instance is running as service; otherwise, false.
+ bool IsRunningAsService { get; }
+
///
/// Gets or sets a value indicating whether this instance has pending kernel reload.
///
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index dbbe5ce018..a4e8853376 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -159,7 +159,8 @@ namespace MediaBrowser.Controller.Entities.Movies
try
{
- folder = ResolveArgs.GetFileSystemEntryByName("specials");
+ folder = ResolveArgs.GetFileSystemEntryByName("extras") ??
+ ResolveArgs.GetFileSystemEntryByName("specials");
}
catch (IOException ex)
{
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 923c5ab748..4e981fa3e5 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -227,6 +227,8 @@ namespace MediaBrowser.Model.Configuration
public TvFileOrganizationOptions TvFileOrganizationOptions { get; set; }
public LiveTvOptions LiveTvOptions { get; set; }
+ public bool EnableRealtimeMonitor { get; set; }
+
///
/// Initializes a new instance of the class.
///
@@ -294,6 +296,8 @@ namespace MediaBrowser.Model.Configuration
LiveTvOptions = new LiveTvOptions();
TvFileOrganizationOptions = new TvFileOrganizationOptions();
+
+ EnableRealtimeMonitor = true;
}
}
diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs
index 3082e80b63..24707b29b3 100644
--- a/MediaBrowser.Model/System/SystemInfo.cs
+++ b/MediaBrowser.Model/System/SystemInfo.cs
@@ -19,7 +19,13 @@ namespace MediaBrowser.Model.System
///
/// The operating sytem.
public string OperatingSystem { get; set; }
-
+
+ ///
+ /// Gets or sets a value indicating whether this instance is running as service.
+ ///
+ /// true if this instance is running as service; otherwise, false.
+ public bool IsRunningAsService { get; set; }
+
///
/// Gets or sets the mac address.
///
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
index 24f21e3398..85b45cf2c7 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
+++ b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
@@ -79,9 +79,15 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
foreach (var path in watchLocations)
{
- if (options.LeftOverFileExtensionsToDelete.Length > 0)
+ var deleteExtensions = options.LeftOverFileExtensionsToDelete
+ .Select(i => i.Trim().TrimStart('.'))
+ .Where(i => !string.IsNullOrEmpty(i))
+ .Select(i => "." + i)
+ .ToList();
+
+ if (deleteExtensions.Count > 0)
{
- DeleteLeftOverFiles(path, options.LeftOverFileExtensionsToDelete);
+ DeleteLeftOverFiles(path, deleteExtensions);
}
if (options.DeleteEmptyFolders)
diff --git a/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs b/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs
index cbb2c5642d..7ae740508b 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs
@@ -18,7 +18,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
var log = new StringBuilder();
- log.AppendLine("Ip: " + request.RemoteEndPoint + ". Headers: " + string.Join(",", request.Headers.AllKeys.Select(k => k + "=" + request.Headers[k])));
+ var headers = string.Join(",", request.Headers.AllKeys.Where(i => !string.Equals(i, "cookie", StringComparison.OrdinalIgnoreCase) && !string.Equals(i, "Referer", StringComparison.OrdinalIgnoreCase)).Select(k => k + "=" + request.Headers[k]));
+
+ log.AppendLine("Ip: " + request.RemoteEndPoint + ". Headers: " + headers);
var type = request.IsWebSocketRequest ? "Web Socket" : "HTTP " + request.HttpMethod;
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
index 0716a3d83f..58141902ed 100644
--- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
+++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
@@ -129,15 +129,28 @@ namespace MediaBrowser.Server.Implementations.IO
/// The source of the event.
/// The instance containing the event data.
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
+ {
+ Restart();
+ }
+
+ private void Restart()
{
Stop();
Start();
}
+ public void Start()
+ {
+ if (ConfigurationManager.Configuration.EnableRealtimeMonitor)
+ {
+ StartInternal();
+ }
+ }
+
///
/// Starts this instance.
///
- public void Start()
+ private void StartInternal()
{
LibraryManager.ItemAdded += LibraryManager_ItemAdded;
LibraryManager.ItemRemoved += LibraryManager_ItemRemoved;
@@ -359,7 +372,7 @@ namespace MediaBrowser.Server.Implementations.IO
{
throw new ArgumentNullException("path");
}
-
+
var filename = Path.GetFileName(path);
// Ignore certain files
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index 4b15ca8d03..0609e80ef9 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -179,10 +179,16 @@ namespace MediaBrowser.ServerApplication
///
/// The application paths.
/// The log manager.
- public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager)
+ public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager, bool isRunningAsService)
: base(applicationPaths, logManager)
{
+ _isRunningAsService = isRunningAsService;
+ }
+ private readonly bool _isRunningAsService;
+ public override bool IsRunningAsService
+ {
+ get { return _isRunningAsService; }
}
///
@@ -431,7 +437,7 @@ namespace MediaBrowser.ServerApplication
await ItemRepository.Initialize().ConfigureAwait(false);
await ProviderRepository.Initialize().ConfigureAwait(false);
-
+
((LibraryManager)LibraryManager).ItemRepository = ItemRepository;
}
@@ -687,7 +693,8 @@ namespace MediaBrowser.ServerApplication
WanAddress = GetWanAddress(),
HasUpdateAvailable = _hasUpdateAvailable,
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
- TranscodingTempPath = ApplicationPaths.TranscodingTempPath
+ TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
+ IsRunningAsService = IsRunningAsService
};
}
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 3021363213..f34c3921d9 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -212,7 +212,7 @@ namespace MediaBrowser.ServerApplication
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
- _appHost = new ApplicationHost(appPaths, logManager);
+ _appHost = new ApplicationHost(appPaths, logManager, runService);
_app = new App(_appHost, _appHost.LogManager.GetLogger("App"), runService);
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index ef1504ed5c..c308e76560 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -495,6 +495,7 @@ namespace MediaBrowser.WebDashboard.Api
"itemdetailpage.js",
"itemgallery.js",
"itemlistpage.js",
+ "librarypathmapping.js",
"librarysettings.js",
"livetvchannel.js",
"livetvchannels.js",
diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
index f1cc75864c..3a72d469a7 100644
--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
@@ -175,6 +175,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -436,6 +439,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest