<Compile Include="Services\Encode\Model\EncodeTask.cs" />\r
<Compile Include="Services\Encode\Model\Models\OutputFormat.cs" />\r
<Compile Include="Services\Encode\Model\Models\SubtitleTrack.cs" />\r
- <Compile Include="Model\QueueItemStatus.cs" />\r
- <Compile Include="Model\QueueTask.cs" />\r
<Compile Include="Services\Encode\Model\Models\SubtitleType.cs" />\r
<Compile Include="Services\Scan\Model\Audio.cs" />\r
<Compile Include="Services\Scan\Model\Chapter.cs" />\r
{\r
using System;\r
using System.Diagnostics;\r
- using System.Globalization;\r
using System.IO;\r
using System.Text;\r
- using System.Text.RegularExpressions;\r
\r
using HandBrake.ApplicationServices.Exceptions;\r
using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Services.Encode.EventArgs;\r
using HandBrake.ApplicationServices.Services.Encode.Interfaces;\r
+ using HandBrake.ApplicationServices.Services.Encode.Model;\r
using HandBrake.ApplicationServices.Utilities;\r
\r
/// <summary>\r
/// <summary>\r
/// Setup the logging.\r
/// </summary>\r
- /// <param name="encodeQueueTask">\r
- /// The encode QueueTask.\r
- /// </param>\r
- /// <param name="isLibhb">\r
- /// Indicates if this is libhb that is encoding or not.\r
- /// </param>\r
- protected void SetupLogging(QueueTask encodeQueueTask, bool isLibhb)\r
+ protected void SetupLogging()\r
{\r
this.ShutdownFileWriter();\r
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
/// <exception cref="Exception">\r
/// If the creation fails, an exception is thrown.\r
/// </exception>\r
- protected void VerifyEncodeDestinationPath(QueueTask task)\r
+ protected void VerifyEncodeDestinationPath(EncodeTask task)\r
{\r
// Make sure the path exists, attempt to create it if it doesn't\r
try\r
{\r
- string path = Directory.GetParent(task.Task.Destination).ToString();\r
+ string path = Directory.GetParent(task.Destination).ToString();\r
if (!Directory.Exists(path))\r
{\r
Directory.CreateDirectory(path);\r
\r
using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Services.Encode.EventArgs;\r
+ using HandBrake.ApplicationServices.Services.Encode.Model;\r
\r
/// <summary>\r
/// Encode Progess Status\r
/// <param name="job">\r
/// The job.\r
/// </param>\r
- void Start(QueueTask job);\r
+ /// <param name="configuration">\r
+ /// The configuration.\r
+ /// </param>\r
+ void Start(EncodeTask job, HBConfiguration configuration);\r
\r
/// <summary>\r
/// The pause.\r
using HandBrake.ApplicationServices.Interop;\r
using HandBrake.ApplicationServices.Interop.EventArgs;\r
using HandBrake.ApplicationServices.Interop.Interfaces;\r
- using HandBrake.ApplicationServices.Interop.Model;\r
using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Services.Encode.Factories;\r
using HandBrake.ApplicationServices.Services.Encode.Interfaces;\r
+ using HandBrake.ApplicationServices.Services.Encode.Model;\r
\r
/// <summary>\r
/// LibHB Implementation of IEncode\r
{\r
#region Private Variables\r
\r
- /// <summary>\r
- /// Lock for the log file\r
- /// </summary>\r
private static readonly object LogLock = new object();\r
-\r
- /// <summary>\r
- /// The instance.\r
- /// </summary>\r
private IHandBrakeInstance instance;\r
-\r
- /// <summary>\r
- /// The Start time of the current Encode;\r
- /// </summary>\r
private DateTime startTime;\r
-\r
- /// <summary>\r
- /// The Current Task\r
- /// </summary>\r
- private QueueTask currentTask;\r
+ private EncodeTask currentTask;\r
+ private HBConfiguration currentConfiguration;\r
\r
#endregion\r
\r
/// <summary>\r
/// Start with a LibHb EncodeJob Object\r
/// </summary>\r
- /// <param name="job">\r
- /// The job.\r
+ /// <param name="task">\r
+ /// The task.\r
+ /// </param>\r
+ /// <param name="configuration">\r
+ /// The configuration.\r
/// </param>\r
- public void Start(QueueTask job)\r
+ public void Start(EncodeTask task, HBConfiguration configuration)\r
{\r
try\r
{\r
// Setup\r
this.startTime = DateTime.Now;\r
- this.currentTask = job;\r
+ this.currentTask = task;\r
+ this.currentConfiguration = configuration;\r
\r
// Create a new HandBrake instance\r
// Setup the HandBrake Instance\r
HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;\r
HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged;\r
- this.instance = HandBrakeInstanceManager.GetEncodeInstance(job.Configuration.Verbosity);\r
+ this.instance = HandBrakeInstanceManager.GetEncodeInstance(configuration.Verbosity);\r
this.instance.EncodeCompleted += this.InstanceEncodeCompleted;\r
this.instance.EncodeProgress += this.InstanceEncodeProgress;\r
\r
}\r
\r
this.IsEncoding = true;\r
- this.SetupLogging(job, true);\r
+ this.SetupLogging();\r
\r
// Verify the Destination Path Exists, and if not, create it.\r
- this.VerifyEncodeDestinationPath(job);\r
+ this.VerifyEncodeDestinationPath(task);\r
\r
ServiceLogMessage("Starting Encode ...");\r
\r
// Get an EncodeJob object for the Interop Library\r
- instance.StartEncode(EncodeFactory.Create(job.Task, job.Configuration));\r
+ instance.StartEncode(EncodeFactory.Create(task, configuration));\r
\r
// Fire the Encode Started Event\r
this.InvokeEncodeStarted(System.EventArgs.Empty);\r
\r
// Set the Process Priority\r
- switch (job.Configuration.ProcessPriority)\r
+ switch (configuration.ProcessPriority)\r
{\r
case "Realtime":\r
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;\r
this.IsEncoding = false;\r
\r
ServiceLogMessage("Failed to start encoding ..." + Environment.NewLine + exc);\r
- this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", job.Task.Source));\r
+ this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", task.Source));\r
}\r
}\r
\r
HandBrakeUtils.ErrorLogged -= this.HandBrakeInstanceErrorLogged;\r
\r
// Handling Log Data \r
- this.ProcessLogs(this.currentTask.Task.Destination, this.currentTask.Configuration);\r
+ this.ProcessLogs(this.currentTask.Destination, this.currentConfiguration);\r
\r
// Cleanup\r
this.ShutdownFileWriter();\r
// Raise the Encode Completed EVent.\r
this.InvokeEncodeCompleted(\r
e.Error\r
- ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Task.Destination)\r
- : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Task.Destination));\r
+ ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Destination)\r
+ : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Destination));\r
}\r
#endregion\r
}\r
\r
using HandBrake.ApplicationServices.Model;\r
\r
+ using HandBrakeWPF.Services.Queue.Model;\r
+\r
/// <summary>\r
/// Queue Progress Event Args\r
/// </summary>\r
<Compile Include="Model\Subtitles\SubtitleBurnInBehaviourModes.cs" />\r
<Compile Include="Model\Subtitles\SubtitleBehaviourModes.cs" />\r
<Compile Include="Model\Subtitles\SubtitleBehaviours.cs" />\r
- <Compile Include="Services\Interfaces\IQueueProcessor.cs" />\r
+ <Compile Include="Services\Queue\Interfaces\IQueueProcessor.cs" />\r
<Compile Include="Services\Presets\Factories\PlistPresetFactory.cs" />\r
<Compile Include="Helpers\FileHelper.cs" />\r
<Compile Include="Services\Presets\Model\Preset.cs" />\r
<Compile Include="Services\Interfaces\IUserSettingService.cs" />\r
<Compile Include="Services\Presets\Model\PresetContainer.cs" />\r
<Compile Include="Services\Presets\PresetService.cs" />\r
- <Compile Include="Services\QueueProcessor.cs" />\r
+ <Compile Include="Services\Queue\Model\QueueTaskContainer.cs" />\r
+ <Compile Include="Services\Queue\QueueProcessor.cs" />\r
+ <Compile Include="Services\Queue\Model\QueueItemStatus.cs" />\r
+ <Compile Include="Services\Queue\Model\QueueTask.cs" />\r
<Compile Include="Services\UserSettingService.cs" />\r
<Compile Include="Utilities\AppcastReader.cs" />\r
<Compile Include="Utilities\DelayedActionProcessor.cs" />\r
using HandBrake.ApplicationServices.Utilities;\r
\r
using HandBrakeWPF.Services.Interfaces;\r
+ using HandBrakeWPF.Services.Queue.Model;\r
\r
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;\r
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;\r
\r
/// <summary>\r
/// Queue Recovery Helper\r
\r
using HandBrakeWPF.Services.Interfaces;\r
\r
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;\r
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;\r
\r
/// <summary>\r
/// The Notification Service (Growl Connector)\r
\r
using HandBrakeWPF.EventArgs;\r
using HandBrakeWPF.Services.Interfaces;\r
+ using HandBrakeWPF.Services.Queue.Interfaces;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
using Execute = Caliburn.Micro.Execute;\r
// </summary>\r
// --------------------------------------------------------------------------------------------------------------------\r
\r
-namespace HandBrakeWPF.Services.Interfaces\r
+namespace HandBrakeWPF.Services.Queue.Interfaces\r
{\r
using System;\r
using System.ComponentModel;\r
\r
- using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Services.Encode.Interfaces;\r
\r
+ using HandBrakeWPF.Services.Queue.Model;\r
+\r
/// <summary>\r
/// The Queue Processor\r
/// </summary>\r
// </summary>\r
// --------------------------------------------------------------------------------------------------------------------\r
\r
-namespace HandBrake.ApplicationServices.Model\r
+namespace HandBrakeWPF.Services.Queue.Model\r
{\r
-\r
+ using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Services.Encode.Model;\r
using HandBrake.ApplicationServices.Utilities;\r
\r
return false;\r
}\r
\r
- return Equals((QueueTask)obj);\r
+ return this.Equals((QueueTask)obj);\r
}\r
\r
/// <summary>\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="QueueTaskContainer.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+// The queue task container.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Services.Queue.Model\r
+{\r
+ /// <summary>\r
+ /// The queue task container.\r
+ /// </summary>\r
+ public class QueueTaskContainer\r
+ {\r
+ /// <summary>\r
+ /// Initializes a new instance of the <see cref="QueueTaskContainer"/> class.\r
+ /// </summary>\r
+ /// <param name="version">\r
+ /// The version.\r
+ /// </param>\r
+ /// <param name="queuetask">\r
+ /// The queuetask.\r
+ /// </param>\r
+ public QueueTaskContainer(int version, string queuetask)\r
+ {\r
+ Version = version;\r
+ QueueTask = queuetask;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets or sets the version of the presets stored in this container.\r
+ /// </summary>\r
+ public int Version { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets the presets. This is a serialised string.\r
+ /// </summary>\r
+ public string QueueTask { get; set; }\r
+ }\r
+}\r
// </summary>\r
// --------------------------------------------------------------------------------------------------------------------\r
\r
-namespace HandBrakeWPF.Services\r
+namespace HandBrakeWPF.Services.Queue\r
{\r
using System;\r
using System.Collections.Generic;\r
using System.Linq;\r
using System.Xml.Serialization;\r
\r
- using Caliburn.Micro;\r
-\r
using HandBrake.ApplicationServices.Exceptions;\r
using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Services.Encode.EventArgs;\r
using HandBrake.ApplicationServices.Services.Encode.Interfaces;\r
using HandBrake.ApplicationServices.Utilities;\r
\r
+ using HandBrakeWPF.Services.Queue.Model;\r
+\r
using Execute = Caliburn.Micro.Execute;\r
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;\r
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;\r
using QueueCompletedEventArgs = HandBrakeWPF.EventArgs.QueueCompletedEventArgs;\r
using QueueProgressEventArgs = HandBrakeWPF.EventArgs.QueueProgressEventArgs;\r
\r
/// <summary>\r
/// The HandBrake Queue\r
/// </summary>\r
- public class QueueProcessor : IQueueProcessor\r
+ public class QueueProcessor : Interfaces.IQueueProcessor\r
{\r
#region Constants and Fields\r
\r
if (job != null)\r
{\r
this.InvokeJobProcessingStarted(new QueueProgressEventArgs(job));\r
- this.EncodeService.Start(job);\r
+ this.EncodeService.Start(job.Task, job.Configuration);\r
}\r
else\r
{\r
\r
using HandBrakeWPF.Services;\r
using HandBrakeWPF.Services.Interfaces;\r
+ using HandBrakeWPF.Services.Queue;\r
+ using HandBrakeWPF.Services.Queue.Interfaces;\r
\r
/// <summary>\r
/// The Castle Bootstrapper\r
using HandBrakeWPF.Services.Presets.Factories;\r
using HandBrakeWPF.Services.Presets.Interfaces;\r
using HandBrakeWPF.Services.Presets.Model;\r
+ using HandBrakeWPF.Services.Queue.Model;\r
using HandBrakeWPF.Utilities;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
using HandBrakeWPF.Views;\r
using Ookii.Dialogs.Wpf;\r
\r
using Execute = Caliburn.Micro.Execute;\r
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;\r
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;\r
\r
/// <summary>\r
/// HandBrakes Main Window\r
using HandBrakeWPF.EventArgs;\r
using HandBrakeWPF.Properties;\r
using HandBrakeWPF.Services.Interfaces;\r
+ using HandBrakeWPF.Services.Queue.Interfaces;\r
+ using HandBrakeWPF.Services.Queue.Model;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
using Microsoft.Win32;\r
using HandBrakeWPF.Services.Interfaces;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;\r
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;\r
\r
/// <summary>\r
/// The Shell View Model\r
using HandBrakeWPF.Properties;\r
using HandBrakeWPF.Services;\r
using HandBrakeWPF.Services.Interfaces;\r
+ using HandBrakeWPF.Services.Queue.Model;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
/// <summary>\r
this.encodeService.EncodeCompleted += this.encodeService_EncodeCompleted;\r
this.encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;\r
\r
- this.encodeService.Start((QueueTask)state);\r
+ this.encodeService.Start(((QueueTask)state).Task, ((QueueTask)state).Configuration);\r
this.userSettingService.SetUserSetting(UserSettingConstants.LastPreviewDuration, this.Duration);\r
}\r
#endregion\r