public static string ToTitleCase(this string input)\r
{\r
TextInfo textInfo = new CultureInfo(CultureInfo.CurrentCulture.Name, false).TextInfo;\r
- return textInfo.ToTitleCase(input.ToLower());\r
- \r
+ return textInfo.ToTitleCase(input.ToLower()); \r
+ }\r
+\r
+ public static int ToInt(this string input)\r
+ {\r
+ if (int.TryParse(input, out int value))\r
+ {\r
+ return value;\r
+ }\r
+\r
+ return 0;\r
}\r
}\r
}\r
namespace HandBrakeWPF.Services.Encode.Factories
{
using System;
- using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
- using System.Windows.Forms.VisualStyles;
using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.HbLib;
using HandBrake.Interop.Interop.Json.Encode;
using HandBrake.Interop.Interop.Model.Encoding;
using HandBrake.Interop.Model;
-
+ using HandBrakeWPF.Extensions;
using HandBrakeWPF.Services.Encode.Model.Models;
using HandBrakeWPF.Services.Encode.Model.Models.Video;
using HandBrakeWPF.Utilities;
- using HandBrakeWPF.ViewModels.Interfaces;
-
- using Newtonsoft.Json.Linq;
using AudioEncoder = Model.Models.AudioEncoder;
using AudioEncoderRateType = Model.Models.AudioEncoderRateType;
* TODO
* 1. Reconstruct the Config
* 2. Reconstruct Queue State
- * 3. Filters
+ * 3. Update JSON API. See #1481
*/
internal static EncodeTask Create(JsonEncodeObject job)
if (rotationFilter != null)
{
var filterSettings = rotationFilter.Settings;
- task.Rotation = filterSettings.Value<int>("angle"); // TODO split the string.
- task.FlipVideo = filterSettings.Value<bool>("hflip");
+ task.Rotation = filterSettings.Value<int>("angle");
+ task.FlipVideo = filterSettings.Value<string>("hflip") == "1";
}
// Deblock
if (deblockFilter != null)
{
var filterSettings = deblockFilter.Settings;
- task.Deblock = filterSettings.Value<int>("qp"); // TODO Split the string
+ task.Deblock = filterSettings.Value<string>("qp").ToInt();
}
// Sharpen