update tv recording page

This commit is contained in:
Luke Pulverenti 2013-12-12 23:06:38 -05:00
parent c38efd088c
commit 2c22de3773
6 changed files with 39 additions and 48 deletions

View File

@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <summary> /// <summary>
/// Description of the recording. /// Description of the recording.
/// </summary> /// </summary>
public string Description { get; set; } public string Overview { get; set; }
/// <summary> /// <summary>
/// The start date of the recording, in UTC. /// The start date of the recording, in UTC.

View File

@ -39,7 +39,7 @@ namespace MediaBrowser.Model.LiveTv
/// <summary> /// <summary>
/// Description of the recording. /// Description of the recording.
/// </summary> /// </summary>
public string Description { get; set; } public string Overview { get; set; }
/// <summary> /// <summary>
/// The start date of the recording, in UTC. /// The start date of the recording, in UTC.

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -69,6 +68,8 @@ namespace MediaBrowser.Server.Implementations.Drawing
{ {
fs.CopyTo(memoryStream); fs.CopyTo(memoryStream);
memoryStream.Position = 0;
// Co it the old fashioned way // Co it the old fashioned way
using (var b = Image.FromStream(memoryStream, true, false)) using (var b = Image.FromStream(memoryStream, true, false))
{ {

View File

@ -506,7 +506,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var dto = new TimerInfoDto var dto = new TimerInfoDto
{ {
ChannelName = info.ChannelName, ChannelName = info.ChannelName,
Description = info.Description, Overview = info.Overview,
EndDate = info.EndDate, EndDate = info.EndDate,
Name = info.Name, Name = info.Name,
StartDate = info.StartDate, StartDate = info.StartDate,

View File

@ -338,6 +338,7 @@
<Link>swagger-ui\swagger-ui.min.js</Link> <Link>swagger-ui\swagger-ui.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Localization\Ratings\be.txt" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " /> <Import Project="$(SolutionDir)\.nuget\nuget.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " />

View File

@ -36,7 +36,9 @@ namespace MediaBrowser.ServerApplication
var startFlag = Environment.GetCommandLineArgs().ElementAtOrDefault(1); var startFlag = Environment.GetCommandLineArgs().ElementAtOrDefault(1);
_isRunningAsService = string.Equals(startFlag, "-service", StringComparison.OrdinalIgnoreCase); _isRunningAsService = string.Equals(startFlag, "-service", StringComparison.OrdinalIgnoreCase);
var appPaths = CreateApplicationPaths(_isRunningAsService); var applicationPath = Process.GetCurrentProcess().MainModule.FileName;
var appPaths = CreateApplicationPaths(applicationPath, _isRunningAsService);
var logManager = new NlogManager(appPaths.LogDirectoryPath, "server"); var logManager = new NlogManager(appPaths.LogDirectoryPath, "server");
logManager.ReloadLogger(LogSeverity.Debug); logManager.ReloadLogger(LogSeverity.Debug);
@ -49,7 +51,7 @@ namespace MediaBrowser.ServerApplication
if (string.Equals(startFlag, "-installservice", StringComparison.OrdinalIgnoreCase)) if (string.Equals(startFlag, "-installservice", StringComparison.OrdinalIgnoreCase))
{ {
logger.Info("Performing service installation"); logger.Info("Performing service installation");
InstallService(logger); InstallService(applicationPath, logger);
return; return;
} }
@ -57,7 +59,7 @@ namespace MediaBrowser.ServerApplication
if (string.Equals(startFlag, "-installserviceasadmin", StringComparison.OrdinalIgnoreCase)) if (string.Equals(startFlag, "-installserviceasadmin", StringComparison.OrdinalIgnoreCase))
{ {
logger.Info("Performing service installation"); logger.Info("Performing service installation");
RunServiceInstallation(); RunServiceInstallation(applicationPath);
return; return;
} }
@ -65,7 +67,7 @@ namespace MediaBrowser.ServerApplication
if (string.Equals(startFlag, "-uninstallservice", StringComparison.OrdinalIgnoreCase)) if (string.Equals(startFlag, "-uninstallservice", StringComparison.OrdinalIgnoreCase))
{ {
logger.Info("Performing service uninstallation"); logger.Info("Performing service uninstallation");
UninstallService(logger); UninstallService(applicationPath, logger);
return; return;
} }
@ -73,17 +75,17 @@ namespace MediaBrowser.ServerApplication
if (string.Equals(startFlag, "-uninstallserviceasadmin", StringComparison.OrdinalIgnoreCase)) if (string.Equals(startFlag, "-uninstallserviceasadmin", StringComparison.OrdinalIgnoreCase))
{ {
logger.Info("Performing service uninstallation"); logger.Info("Performing service uninstallation");
RunServiceUninstallation(); RunServiceUninstallation(applicationPath);
return; return;
} }
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
RunServiceInstallationIfNeeded(); RunServiceInstallationIfNeeded(applicationPath);
var currentProcess = Process.GetCurrentProcess(); var currentProcess = Process.GetCurrentProcess();
if (IsAlreadyRunning(currentProcess)) if (IsAlreadyRunning(applicationPath, currentProcess))
{ {
logger.Info("Shutting down because another instance of Media Browser Server is already running."); logger.Info("Shutting down because another instance of Media Browser Server is already running.");
return; return;
@ -110,21 +112,19 @@ namespace MediaBrowser.ServerApplication
/// </summary> /// </summary>
/// <param name="currentProcess">The current process.</param> /// <param name="currentProcess">The current process.</param>
/// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns>
private static bool IsAlreadyRunning(Process currentProcess) private static bool IsAlreadyRunning(string applicationPath, Process currentProcess)
{ {
var runningPath = currentProcess.MainModule.FileName;
var duplicate = Process.GetProcesses().FirstOrDefault(i => var duplicate = Process.GetProcesses().FirstOrDefault(i =>
{
try
{ {
try return string.Equals(applicationPath, i.MainModule.FileName) && currentProcess.Id != i.Id;
{ }
return string.Equals(runningPath, i.MainModule.FileName) && currentProcess.Id != i.Id; catch (Exception)
} {
catch (Exception) return false;
{ }
return false; });
}
});
if (duplicate != null) if (duplicate != null)
{ {
@ -145,19 +145,17 @@ namespace MediaBrowser.ServerApplication
/// </summary> /// </summary>
/// <param name="runAsService">if set to <c>true</c> [run as service].</param> /// <param name="runAsService">if set to <c>true</c> [run as service].</param>
/// <returns>ServerApplicationPaths.</returns> /// <returns>ServerApplicationPaths.</returns>
private static ServerApplicationPaths CreateApplicationPaths(bool runAsService) private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, bool runAsService)
{ {
if (runAsService) if (runAsService)
{ {
var systemPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); var systemPath = Path.GetDirectoryName(applicationPath);
var programDataPath = Path.GetDirectoryName(systemPath); var programDataPath = Path.GetDirectoryName(systemPath);
return new ServerApplicationPaths(programDataPath); return new ServerApplicationPaths(programDataPath, applicationPath);
} }
var applicationPath = Process.GetCurrentProcess().MainModule.FileName;
return new ServerApplicationPaths(applicationPath); return new ServerApplicationPaths(applicationPath);
} }
@ -199,8 +197,7 @@ namespace MediaBrowser.ServerApplication
logger.Info("Operating system: {0}", Environment.OSVersion.ToString()); logger.Info("Operating system: {0}", Environment.OSVersion.ToString());
logger.Info("Program data path: {0}", appPaths.ProgramDataPath); logger.Info("Program data path: {0}", appPaths.ProgramDataPath);
var runningPath = Process.GetCurrentProcess().MainModule.FileName; logger.Info("Application Path: {0}", appPaths.ApplicationPath);
logger.Info("Executable: {0}", runningPath);
} }
/// <summary> /// <summary>
@ -279,13 +276,11 @@ namespace MediaBrowser.ServerApplication
/// <summary> /// <summary>
/// Installs the service. /// Installs the service.
/// </summary> /// </summary>
private static void InstallService(ILogger logger) private static void InstallService(string applicationPath, ILogger logger)
{ {
var runningPath = Process.GetCurrentProcess().MainModule.FileName;
try try
{ {
ManagedInstallerClass.InstallHelper(new[] { runningPath }); ManagedInstallerClass.InstallHelper(new[] { applicationPath });
logger.Info("Service installation succeeded"); logger.Info("Service installation succeeded");
} }
@ -298,13 +293,11 @@ namespace MediaBrowser.ServerApplication
/// <summary> /// <summary>
/// Uninstalls the service. /// Uninstalls the service.
/// </summary> /// </summary>
private static void UninstallService(ILogger logger) private static void UninstallService(string applicationPath, ILogger logger)
{ {
var runningPath = Process.GetCurrentProcess().MainModule.FileName;
try try
{ {
ManagedInstallerClass.InstallHelper(new[] { "/u", runningPath }); ManagedInstallerClass.InstallHelper(new[] { "/u", applicationPath });
logger.Info("Service uninstallation succeeded"); logger.Info("Service uninstallation succeeded");
} }
@ -314,26 +307,24 @@ namespace MediaBrowser.ServerApplication
} }
} }
private static void RunServiceInstallationIfNeeded() private static void RunServiceInstallationIfNeeded(string applicationPath)
{ {
var ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == BackgroundService.Name); var ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == BackgroundService.Name);
if (ctl == null) if (ctl == null)
{ {
RunServiceInstallation(); RunServiceInstallation(applicationPath);
} }
} }
/// <summary> /// <summary>
/// Runs the service installation. /// Runs the service installation.
/// </summary> /// </summary>
private static void RunServiceInstallation() private static void RunServiceInstallation(string applicationPath)
{ {
var runningPath = Process.GetCurrentProcess().MainModule.FileName;
var startInfo = new ProcessStartInfo var startInfo = new ProcessStartInfo
{ {
FileName = runningPath, FileName = applicationPath,
Arguments = "-installservice", Arguments = "-installservice",
@ -352,13 +343,11 @@ namespace MediaBrowser.ServerApplication
/// <summary> /// <summary>
/// Runs the service uninstallation. /// Runs the service uninstallation.
/// </summary> /// </summary>
private static void RunServiceUninstallation() private static void RunServiceUninstallation(string applicationPath)
{ {
var runningPath = Process.GetCurrentProcess().MainModule.FileName;
var startInfo = new ProcessStartInfo var startInfo = new ProcessStartInfo
{ {
FileName = runningPath, FileName = applicationPath,
Arguments = "-uninstallservice", Arguments = "-uninstallservice",