summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs14
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs10
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs11
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs9
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs26
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs17
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs13
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs14
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs16
9 files changed, 91 insertions, 39 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index 36b9002bc..ced71d4eb 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -44,7 +44,7 @@ namespace HandBrake.ApplicationServices.Services.Base
/// <summary>
/// The Log File Header
/// </summary>
- private readonly StringBuilder header = GeneralUtilities.CreateCliLogHeader();
+ private readonly StringBuilder header;
/// <summary>
/// The Log Buffer
@@ -68,6 +68,11 @@ namespace HandBrake.ApplicationServices.Services.Base
{
this.userSettingService = userSettingService;
this.logBuffer = new StringBuilder();
+ header =
+ GeneralUtilities.CreateCliLogHeader(
+ userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+
}
#region Events
@@ -260,7 +265,10 @@ namespace HandBrake.ApplicationServices.Services.Base
try
{
- string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task));
+ string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
+ userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));
this.logBuffer = new StringBuilder();
this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));
this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
@@ -278,7 +286,7 @@ namespace HandBrake.ApplicationServices.Services.Base
}
this.fileWriter = new StreamWriter(logFile) { AutoFlush = true };
- this.fileWriter.WriteLine(GeneralUtilities.CreateCliLogHeader());
+ this.fileWriter.WriteLine(header);
this.fileWriter.WriteLine(String.Format("CLI Query: {0}", query));
this.fileWriter.WriteLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
this.fileWriter.WriteLine();
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 98827a6e3..dbf598796 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -132,8 +132,14 @@ namespace HandBrake.ApplicationServices.Services
? QueryGeneratorUtility.GeneratePreviewQuery(
new EncodeTask(this.currentTask.Task),
this.currentTask.Task.PreviewEncodeDuration,
- this.currentTask.Task.PreviewEncodeStartAt)
- : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task));
+ this.currentTask.Task.PreviewEncodeStartAt,
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
+ userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
+ : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
+ userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));
ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs
index 0ae6bf518..b52be1aef 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs
@@ -127,10 +127,19 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="path">
/// The path to the location for the script to be saved.
/// </param>
+ /// <param name="previewScanCount">
+ /// The preview Scan Count.
+ /// </param>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <param name="disableLibdvdnav">
+ /// The disable Libdvdnav.
+ /// </param>
/// <returns>
/// True if sucessful
/// </returns>
- bool WriteBatchScriptToFile(string path);
+ bool WriteBatchScriptToFile(string path, int previewScanCount, int verbosity, bool disableLibdvdnav);
/// <summary>
/// Temp workaround until this can be fixed properly.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index 3ae06bbfd..404a47fac 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -12,8 +12,6 @@ namespace HandBrake.ApplicationServices.Services
using System;
using System.Diagnostics;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Base;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -65,13 +63,16 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public LibEncode(IUserSettingService userSettingService)
+ /// <param name="handBrakeInstance">
+ /// The hand Brake Instance.
+ /// </param>
+ public LibEncode(IUserSettingService userSettingService, IHandBrakeInstance handBrakeInstance)
: base(userSettingService)
{
this.userSettingService = userSettingService;
// Setup the HandBrake Instance
- this.instance = IoC.Get<IHandBrakeInstance>();
+ this.instance = handBrakeInstance;
this.instance.EncodeCompleted += this.InstanceEncodeCompleted;
this.instance.EncodeProgress += this.InstanceEncodeProgress;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index a25f3a2a6..73f5fca57 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -14,8 +14,6 @@ namespace HandBrake.ApplicationServices.Services
using System.Text;
using System.Threading;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
@@ -58,6 +56,11 @@ namespace HandBrake.ApplicationServices.Services
private readonly StringBuilder logging;
/// <summary>
+ /// The Log File Header
+ /// </summary>
+ private readonly StringBuilder header;
+
+ /// <summary>
/// The Current source scan path.
/// </summary>
private string currentSourceScanPath;
@@ -67,11 +70,21 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Initializes a new instance of the <see cref="LibScan"/> class.
/// </summary>
- public LibScan()
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ /// <param name="handBrakeInstance">
+ /// The hand Brake Instance.
+ /// </param>
+ public LibScan(IUserSettingService userSettingService, IHandBrakeInstance handBrakeInstance)
{
logging = new StringBuilder();
- instance = IoC.Get<IHandBrakeInstance>();
+ header = GeneralUtilities.CreateCliLogHeader(
+ userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+
+ instance = handBrakeInstance;
instance.Initialize(1);
instance.ScanProgress += this.InstanceScanProgress;
instance.ScanCompleted += this.InstanceScanCompleted;
@@ -97,11 +110,6 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
public event ScanProgessStatus ScanStatusChanged;
- /// <summary>
- /// The Log File Header
- /// </summary>
- StringBuilder header = GeneralUtilities.CreateCliLogHeader();
-
#endregion
#region Properties
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index 0b86be749..9e31173ae 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -47,6 +47,11 @@ namespace HandBrake.ApplicationServices.Services
private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Preset>));
/// <summary>
+ /// The User Setting Service
+ /// </summary>
+ private readonly IUserSettingService userSettingService;
+
+ /// <summary>
/// User Preset Default Catgory Name
/// </summary>
public static string UserPresetCatgoryName = "User Presets";
@@ -66,19 +71,19 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private ObservableCollection<Preset> presets = new ObservableCollection<Preset>();
- /// <summary>
- /// The User Setting Service
- /// </summary>
- private IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
-
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="PresetService"/> class.
/// </summary>
- public PresetService()
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public PresetService(IUserSettingService userSettingService)
{
+ this.userSettingService = userSettingService;
+
// If the preset file doesn't exist. Create it.
if (!File.Exists(this.builtInPresetFile))
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
index abe684a17..161653da0 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
@@ -369,15 +369,24 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="file">
/// The location of the file to write the batch file to.
/// </param>
+ /// <param name="previewScanCount">
+ /// The preview Scan Count.
+ /// </param>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <param name="disableLibdvdnav">
+ /// The disable Libdvdnav.
+ /// </param>
/// <returns>
/// The write batch script to file.
/// </returns>
- public bool WriteBatchScriptToFile(string file)
+ public bool WriteBatchScriptToFile(string file, int previewScanCount, int verbosity, bool disableLibdvdnav)
{
string queries = string.Empty;
foreach (QueueTask queueItem in this.queue)
{
- string qItem = QueryGeneratorUtility.GenerateQuery(new EncodeTask(queueItem.Task));
+ string qItem = QueryGeneratorUtility.GenerateQuery(new EncodeTask(queueItem.Task), previewScanCount, verbosity, disableLibdvdnav);
string fullQuery = '"' + Application.StartupPath + "\\HandBrakeCLI.exe" + '"' + qItem;
if (queries == string.Empty)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index f90aa0ef4..bbb085916 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -13,8 +13,6 @@ namespace HandBrake.ApplicationServices.Services
using System.Diagnostics;
using System.Windows.Forms;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -28,7 +26,7 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// The User Setting Service
/// </summary>
- private static IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
+ private readonly IUserSettingService userSettingService;
/// <summary>
/// Initializes a new instance of the <see cref="QueueProcessor"/> class.
@@ -39,11 +37,15 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="encodeService">
/// The encode Service.
/// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
/// <exception cref="ArgumentNullException">
/// Services are not setup
/// </exception>
- public QueueProcessor(IQueueManager queueManager, IEncode encodeService)
+ public QueueProcessor(IQueueManager queueManager, IEncode encodeService, IUserSettingService userSettingService)
{
+ this.userSettingService = userSettingService;
this.QueueManager = queueManager;
this.EncodeService = encodeService;
@@ -278,7 +280,7 @@ namespace HandBrake.ApplicationServices.Services
/// Send a file to a 3rd party application after encoding has completed.
/// </summary>
/// <param name="file"> The file path</param>
- private static void SendToApplication(string file)
+ private void SendToApplication(string file)
{
if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SendFile) && !string.IsNullOrEmpty(userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileTo)))
{
@@ -291,7 +293,7 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Perform an action after an encode. e.g a shutdown, standby, restart etc.
/// </summary>
- private static void Finish()
+ private void Finish()
{
// Growl
if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.GrowlQueue))
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index 3e0c36d20..9eb05eb39 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -39,6 +39,11 @@ namespace HandBrake.ApplicationServices.Services
private readonly IUserSettingService userSettingService;
/// <summary>
+ /// The Log File Header
+ /// </summary>
+ private readonly StringBuilder header;
+
+ /// <summary>
/// The CLI data parser
/// </summary>
private Parser readData;
@@ -53,11 +58,6 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private Process hbProc;
- /// <summary>
- /// The Log File Header
- /// </summary>
- StringBuilder header = GeneralUtilities.CreateCliLogHeader();
-
#endregion
/// <summary>
@@ -70,6 +70,10 @@ namespace HandBrake.ApplicationServices.Services
{
this.userSettingService = userSettingService;
this.logBuffer = new StringBuilder();
+
+ header = GeneralUtilities.CreateCliLogHeader(
+ userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
}
#region Events
@@ -290,7 +294,7 @@ namespace HandBrake.ApplicationServices.Services
// Only write the log file to disk if it's less than 50MB.
if (this.readData.Buffer.Length < 50000000)
{
- scanLog.WriteLine(GeneralUtilities.CreateCliLogHeader());
+ scanLog.WriteLine(header);
scanLog.WriteLine(query);
scanLog.Write(this.readData.Buffer);