This commit is contained in:
Eric Reed 2014-01-30 00:08:56 -05:00
commit 0110f22b78
13 changed files with 81 additions and 16 deletions

View File

@ -171,6 +171,12 @@ namespace MediaBrowser.Common.Implementations
/// <value>The name.</value>
public abstract string Name { get; }
/// <summary>
/// Gets a value indicating whether this instance is running as service.
/// </summary>
/// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value>
public abstract bool IsRunningAsService { get; }
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class.
/// </summary>

View File

@ -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<string, string> { { "feature", ApplicationHost.Name }, { "mac", mac }, { "ver", ApplicationHost.ApplicationVersion.ToString() }, { "platform", Environment.OSVersion.VersionString } };
var data = new Dictionary<string, string>
{
{ "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
/// <value>The name.</value>
public string Name
{
get { return "Collect stats"; }
get { return "Collect anonymous usage stats"; }
}
/// <summary>

View File

@ -24,6 +24,12 @@ namespace MediaBrowser.Common
/// </summary>
event EventHandler<GenericEventArgs<Version>> ApplicationUpdated;
/// <summary>
/// Gets a value indicating whether this instance is running as service.
/// </summary>
/// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value>
bool IsRunningAsService { get; }
/// <summary>
/// Gets or sets a value indicating whether this instance has pending kernel reload.
/// </summary>

View File

@ -159,7 +159,8 @@ namespace MediaBrowser.Controller.Entities.Movies
try
{
folder = ResolveArgs.GetFileSystemEntryByName("specials");
folder = ResolveArgs.GetFileSystemEntryByName("extras") ??
ResolveArgs.GetFileSystemEntryByName("specials");
}
catch (IOException ex)
{

View File

@ -227,6 +227,8 @@ namespace MediaBrowser.Model.Configuration
public TvFileOrganizationOptions TvFileOrganizationOptions { get; set; }
public LiveTvOptions LiveTvOptions { get; set; }
public bool EnableRealtimeMonitor { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@ -294,6 +296,8 @@ namespace MediaBrowser.Model.Configuration
LiveTvOptions = new LiveTvOptions();
TvFileOrganizationOptions = new TvFileOrganizationOptions();
EnableRealtimeMonitor = true;
}
}

View File

@ -19,7 +19,13 @@ namespace MediaBrowser.Model.System
/// </summary>
/// <value>The operating sytem.</value>
public string OperatingSystem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is running as service.
/// </summary>
/// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value>
public bool IsRunningAsService { get; set; }
/// <summary>
/// Gets or sets the mac address.
/// </summary>

View File

@ -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)

View File

@ -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;

View File

@ -129,15 +129,28 @@ namespace MediaBrowser.Server.Implementations.IO
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="PowerModeChangedEventArgs"/> instance containing the event data.</param>
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
Restart();
}
private void Restart()
{
Stop();
Start();
}
public void Start()
{
if (ConfigurationManager.Configuration.EnableRealtimeMonitor)
{
StartInternal();
}
}
/// <summary>
/// Starts this instance.
/// </summary>
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

View File

@ -179,10 +179,16 @@ namespace MediaBrowser.ServerApplication
/// </summary>
/// <param name="applicationPaths">The application paths.</param>
/// <param name="logManager">The log manager.</param>
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; }
}
/// <summary>
@ -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
};
}

View File

@ -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);

View File

@ -495,6 +495,7 @@ namespace MediaBrowser.WebDashboard.Api
"itemdetailpage.js",
"itemgallery.js",
"itemlistpage.js",
"librarypathmapping.js",
"librarysettings.js",
"livetvchannel.js",
"livetvchannels.js",

View File

@ -175,6 +175,9 @@
<Content Include="dashboard-ui\autoorganizelog.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\librarypathmapping.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\livetvchannel.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -436,6 +439,9 @@
<Content Include="dashboard-ui\scripts\librarymenu.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\librarypathmapping.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\livetvchannel.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>