Initial commit

This commit is contained in:
2026-02-08 21:30:32 +01:00
commit b2598bdd12
17 changed files with 18249 additions and 0 deletions

BIN
Shackle/8p5oo8p5oo8p5oo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 KiB

View File

@@ -0,0 +1,155 @@
using System.ComponentModel;
namespace UnshackleGUI
{
/// <summary>
/// This is the object assigned to PropertyGrid.SelectedObject
/// It correctly implements ICustomTypeDescriptor.
/// </summary>
public class DynamicObject : ICustomTypeDescriptor
{
private readonly Dictionary<string, object> _values;
private readonly List<UnshackleParameter> _defs;
public DynamicObject(Dictionary<string, object> values, List<UnshackleParameter> defs)
{
_values = values;
_defs = defs;
}
public PropertyDescriptorCollection GetProperties()
{
return new DynamicCustomTypeDescriptor(_values, _defs).GetProperties();
}
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
return GetProperties();
}
public object GetPropertyOwner(PropertyDescriptor pd) => this;
public AttributeCollection GetAttributes() => AttributeCollection.Empty;
public string GetClassName() => nameof(DynamicObject);
public string GetComponentName() => null;
public TypeConverter GetConverter() => null;
public EventDescriptor GetDefaultEvent() => null;
public PropertyDescriptor GetDefaultProperty() => null;
public object GetEditor(Type editorBaseType) => null;
public EventDescriptorCollection GetEvents() => EventDescriptorCollection.Empty;
public EventDescriptorCollection GetEvents(Attribute[] attributes) => EventDescriptorCollection.Empty;
}
internal class DynamicCustomTypeDescriptor : CustomTypeDescriptor
{
private readonly Dictionary<string, object> _values;
private readonly List<UnshackleParameter> _defs;
private PropertyDescriptorCollection _cache;
public DynamicCustomTypeDescriptor(Dictionary<string, object> values, List<UnshackleParameter> defs)
{
_values = values;
_defs = defs;
}
public override PropertyDescriptorCollection GetProperties()
{
return GetProperties(null);
}
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
if (_cache == null)
{
var props = new List<PropertyDescriptor>();
foreach (var def in _defs)
{
props.Add(new DynamicPropertyDescriptor(def, _values));
}
_cache = new PropertyDescriptorCollection(props.ToArray());
}
return _cache;
}
}
internal class DynamicPropertyDescriptor : PropertyDescriptor
{
private readonly UnshackleParameter _parameter;
private readonly Dictionary<string, object> _values;
public DynamicPropertyDescriptor(UnshackleParameter parameter, Dictionary<string, object> values)
: base(parameter.Name, null)
{
_parameter = parameter;
_values = values;
}
public override string Category => _parameter.Category;
// IMPORTANT FIX
public override Type ComponentType => typeof(object);
public override bool IsReadOnly => false;
public override Type PropertyType =>
_parameter.Type switch
{
"Bool" => typeof(bool),
"Number" => typeof(int),
_ => typeof(string)
};
public override TypeConverter Converter =>
(_parameter.Type == "Selection" && _parameter.Options != null)
? new StandardValuesConverter(_parameter.Options)
: base.Converter;
public override object GetValue(object component)
{
return _values.ContainsKey(_parameter.Name)
? _values[_parameter.Name]
: _parameter.Default;
}
public override void SetValue(object component, object value)
{
_values[_parameter.Name] = value;
OnValueChanged(component, EventArgs.Empty);
// Force grid refresh
TypeDescriptor.Refresh(component);
}
public override bool CanResetValue(object component) => true;
public override void ResetValue(object component)
{
_values[_parameter.Name] = _parameter.Default;
}
public override bool ShouldSerializeValue(object component) => true;
}
internal class StandardValuesConverter : TypeConverter
{
private readonly List<string> _values;
public StandardValuesConverter(List<string> values)
{
_values = values;
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => true;
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(_values);
}
}
}

240
Shackle/MainForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,240 @@
namespace UnshackleGUI
{
partial class MainForm
{
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.TextBox txtRootPath;
private System.Windows.Forms.TextBox txtBinName;
private System.Windows.Forms.ComboBox comboProfiles;
private System.Windows.Forms.Button btnAddProfile;
private System.Windows.Forms.Button btnRemoveProfile;
private System.Windows.Forms.ComboBox comboService;
private System.Windows.Forms.TextBox txtURL;
private System.Windows.Forms.TextBox txtCommandPreview;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnOpenCookies;
private System.Windows.Forms.Button btnEditServiceConfig; // New
private System.Windows.Forms.Button btnEditYaml;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.Button btnClearLog;
private System.Windows.Forms.TextBox txtLog;
private System.Windows.Forms.PropertyGrid pgProfile;
private System.Windows.Forms.Label lblPath;
protected override void Dispose(bool disposing) { if (disposing && (components != null)) components.Dispose(); base.Dispose(disposing); }
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
txtRootPath = new TextBox();
txtBinName = new TextBox();
comboProfiles = new ComboBox();
btnAddProfile = new Button();
btnRemoveProfile = new Button();
comboService = new ComboBox();
txtURL = new TextBox();
txtCommandPreview = new TextBox();
btnRun = new Button();
btnStop = new Button();
btnOpenCookies = new Button();
btnEditServiceConfig = new Button();
btnEditYaml = new Button();
btnBrowse = new Button();
btnClearLog = new Button();
txtLog = new TextBox();
pgProfile = new PropertyGrid();
lblPath = new Label();
SuspendLayout();
//
// txtRootPath
//
txtRootPath.Location = new Point(12, 35);
txtRootPath.Name = "txtRootPath";
txtRootPath.Size = new Size(280, 27);
txtRootPath.TabIndex = 0;
//
// txtBinName
//
txtBinName.Location = new Point(340, 35);
txtBinName.Name = "txtBinName";
txtBinName.Size = new Size(60, 27);
txtBinName.TabIndex = 2;
//
// comboProfiles
//
comboProfiles.Anchor = AnchorStyles.Top | AnchorStyles.Right;
comboProfiles.Location = new Point(1177, 35);
comboProfiles.Name = "comboProfiles";
comboProfiles.Size = new Size(240, 28);
comboProfiles.TabIndex = 4;
//
// btnAddProfile
//
btnAddProfile.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnAddProfile.Location = new Point(1422, 34);
btnAddProfile.Name = "btnAddProfile";
btnAddProfile.Size = new Size(35, 29);
btnAddProfile.TabIndex = 5;
btnAddProfile.Text = "+";
//
// btnRemoveProfile
//
btnRemoveProfile.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnRemoveProfile.Location = new Point(1462, 34);
btnRemoveProfile.Name = "btnRemoveProfile";
btnRemoveProfile.Size = new Size(35, 29);
btnRemoveProfile.TabIndex = 6;
btnRemoveProfile.Text = "-";
//
// comboService
//
comboService.Location = new Point(12, 80);
comboService.Name = "comboService";
comboService.Size = new Size(100, 28);
comboService.TabIndex = 7;
//
// txtURL
//
txtURL.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
txtURL.Location = new Point(115, 80);
txtURL.Name = "txtURL";
txtURL.PlaceholderText = "Paste ID / URL here...";
txtURL.Size = new Size(801, 27);
txtURL.TabIndex = 8;
//
// txtCommandPreview
//
txtCommandPreview.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
txtCommandPreview.BackColor = Color.FromArgb(20, 20, 20);
txtCommandPreview.Font = new Font("Consolas", 10F, FontStyle.Bold);
txtCommandPreview.ForeColor = Color.Cyan;
txtCommandPreview.Location = new Point(12, 115);
txtCommandPreview.Name = "txtCommandPreview";
txtCommandPreview.Size = new Size(1130, 27);
txtCommandPreview.TabIndex = 9;
//
// btnRun
//
btnRun.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
btnRun.Location = new Point(12, 150);
btnRun.Name = "btnRun";
btnRun.Size = new Size(1130, 45);
btnRun.TabIndex = 10;
btnRun.Text = "RUN";
//
// btnStop
//
btnStop.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
btnStop.BackColor = Color.Maroon;
btnStop.Location = new Point(12, 150);
btnStop.Name = "btnStop";
btnStop.Size = new Size(1130, 45);
btnStop.TabIndex = 11;
btnStop.Text = "STOP";
btnStop.UseVisualStyleBackColor = false;
btnStop.Visible = false;
//
// btnOpenCookies
//
btnOpenCookies.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnOpenCookies.Location = new Point(922, 79);
btnOpenCookies.Name = "btnOpenCookies";
btnOpenCookies.Size = new Size(115, 30);
btnOpenCookies.TabIndex = 12;
btnOpenCookies.Text = "🍪 Cookies";
//
// btnEditServiceConfig
//
btnEditServiceConfig.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnEditServiceConfig.Location = new Point(1043, 79);
btnEditServiceConfig.Name = "btnEditServiceConfig";
btnEditServiceConfig.Size = new Size(99, 30);
btnEditServiceConfig.TabIndex = 13;
btnEditServiceConfig.Text = "⚙️ Service";
//
// btnEditYaml
//
btnEditYaml.Location = new Point(410, 34);
btnEditYaml.Name = "btnEditYaml";
btnEditYaml.Size = new Size(144, 29);
btnEditYaml.TabIndex = 3;
btnEditYaml.Text = "📝 Main Config";
//
// btnBrowse
//
btnBrowse.Location = new Point(295, 34);
btnBrowse.Name = "btnBrowse";
btnBrowse.Size = new Size(35, 29);
btnBrowse.TabIndex = 1;
btnBrowse.Text = "📂";
//
// btnClearLog
//
btnClearLog.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnClearLog.Location = new Point(1022, 201);
btnClearLog.Name = "btnClearLog";
btnClearLog.Size = new Size(120, 36);
btnClearLog.TabIndex = 14;
btnClearLog.Text = "Clear Log";
//
// txtLog
//
txtLog.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
txtLog.BackColor = Color.Black;
txtLog.Font = new Font("Consolas", 9F);
txtLog.ForeColor = Color.Lime;
txtLog.Location = new Point(12, 243);
txtLog.Multiline = true;
txtLog.Name = "txtLog";
txtLog.ScrollBars = ScrollBars.Vertical;
txtLog.Size = new Size(1130, 550);
txtLog.TabIndex = 15;
//
// pgProfile
//
pgProfile.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
pgProfile.CategoryForeColor = SystemColors.ActiveCaption;
pgProfile.Location = new Point(1177, 80);
pgProfile.Name = "pgProfile";
pgProfile.Size = new Size(320, 713);
pgProfile.TabIndex = 16;
//
// lblPath
//
lblPath.Location = new Point(12, 12);
lblPath.Name = "lblPath";
lblPath.Size = new Size(150, 23);
lblPath.TabIndex = 17;
lblPath.Text = "Root Path & Binary:";
//
// MainForm
//
ClientSize = new Size(1519, 808);
Controls.Add(txtRootPath);
Controls.Add(btnBrowse);
Controls.Add(txtBinName);
Controls.Add(btnEditYaml);
Controls.Add(comboProfiles);
Controls.Add(btnAddProfile);
Controls.Add(btnRemoveProfile);
Controls.Add(comboService);
Controls.Add(txtURL);
Controls.Add(txtCommandPreview);
Controls.Add(btnRun);
Controls.Add(btnStop);
Controls.Add(btnOpenCookies);
Controls.Add(btnEditServiceConfig);
Controls.Add(btnClearLog);
Controls.Add(txtLog);
Controls.Add(pgProfile);
Controls.Add(lblPath);
Icon = (Icon)resources.GetObject("$this.Icon");
MinimumSize = new Size(960, 680);
Name = "MainForm";
Text = "Unshackle Master GUI";
ResumeLayout(false);
PerformLayout();
}
}
}

375
Shackle/MainForm.cs Normal file
View File

@@ -0,0 +1,375 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
namespace UnshackleGUI
{
public partial class MainForm : Form
{
private string _configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json");
private string _paramsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "params.json");
private AppSettings _appSettings = new AppSettings();
private List<UnshackleParameter> _parameterDefinitions = new List<UnshackleParameter>();
private Dictionary<string, object> _propertyValues = new Dictionary<string, object>();
private Process? _currentProcess;
public MainForm()
{
InitializeComponent();
ApplyDarkTheme();
LoadParamsAndConfig();
// EVENT: This updates the command line the moment a value changes
pgProfile.PropertyValueChanged += (s, e) =>
{
UpdateCommandPreview();
if (comboProfiles.SelectedItem != null)
{
string selected = comboProfiles.SelectedItem.ToString();
_appSettings.Profiles[selected] =
new Dictionary<string, object>(_propertyValues);
}
SaveConfig();
};
comboService.SelectedIndexChanged += (s, e) => UpdateCommandPreview();
txtURL.TextChanged += (s, e) => UpdateCommandPreview();
txtBinName.TextChanged += (s, e) => UpdateCommandPreview();
btnRun.Click += btnRun_Click;
btnStop.Click += btnStop_Click;
btnBrowse.Click += btnBrowse_Click;
btnOpenCookies.Click += btnOpenCookies_Click;
btnEditServiceConfig.Click += btnEditServiceConfig_Click;
btnClearLog.Click += btnClearLog_Click;
btnEditYaml.Click += btnEditYaml_Click;
btnAddProfile.Click += btnAddProfile_Click;
btnRemoveProfile.Click += btnRemoveProfile_Click;
}
private void LoadParamsAndConfig()
{
// 1. Load Parameters (Rules)
if (File.Exists(_paramsPath))
{
var json = File.ReadAllText(_paramsPath);
_parameterDefinitions = JsonConvert.DeserializeObject<List<UnshackleParameter>>(json) ?? new List<UnshackleParameter>();
foreach (var p in _parameterDefinitions)
{
// Ensure every parameter has a value in the dictionary
if (!_propertyValues.ContainsKey(p.Name))
_propertyValues[p.Name] = p.Default ?? "";
}
}
// 2. Load Config (Paths/Profiles)
if (File.Exists(_configPath))
{
var json = File.ReadAllText(_configPath);
_appSettings = JsonConvert.DeserializeObject<AppSettings>(json) ?? new AppSettings();
txtRootPath.Text = _appSettings.RootPath;
txtBinName.Text = _appSettings.BinaryName;
}
if (_appSettings.Profiles == null || _appSettings.Profiles.Count == 0)
{
_appSettings.Profiles = new Dictionary<string, Dictionary<string, object>>();
_appSettings.Profiles["Default"] = new Dictionary<string, object>(_propertyValues);
}
comboProfiles.DataSource = null;
comboProfiles.DataSource = _appSettings.Profiles.Keys.ToList();
comboProfiles.SelectedIndexChanged += (s, e) =>
{
if (comboProfiles.SelectedItem == null) return;
string selected = comboProfiles.SelectedItem.ToString();
if (_appSettings.Profiles.TryGetValue(selected, out var values))
{
_propertyValues = new Dictionary<string, object>(values);
pgProfile.SelectedObject =
new DynamicObject(_propertyValues, _parameterDefinitions);
UpdateCommandPreview();
}
};
// 3. Bind to Grid using the FIXED Descriptor
pgProfile.SelectedObject = new DynamicObject(_propertyValues, _parameterDefinitions);
RefreshFolders();
UpdateCommandPreview();
}
private void UpdateCommandPreview()
{
StringBuilder sb = new StringBuilder();
sb.Append($"{txtBinName.Text} run unshackle dl ");
foreach (var p in _parameterDefinitions)
{
if (!_propertyValues.TryGetValue(p.Name, out object val)) continue;
// Handle Booleans
if (p.Type == "Bool" && val is bool b && b)
{
sb.Append($"{p.Flag} ");
}
// Handle Text/Selection/Numbers
else if (p.Type != "Bool" && val != null)
{
string sVal = val.ToString();
// Skip empty, "any", or "0" (for default bitrates)
if (!string.IsNullOrWhiteSpace(sVal) && sVal != "any" && sVal != "0")
{
if (sVal.Contains(" ")) sVal = $"\"{sVal}\"";
sb.Append($"{p.Flag} {sVal} ");
}
}
}
sb.Append($"{comboService.Text} {txtURL.Text}");
txtCommandPreview.Text = sb.ToString();
}
private void btnEditServiceConfig_Click(object? sender, EventArgs e)
{
string yamlPath = Path.Combine(txtRootPath.Text, "unshackle", "services", comboService.Text, "config.yaml");
if (File.Exists(yamlPath))
Process.Start(new ProcessStartInfo(yamlPath) { UseShellExecute = true });
else
MessageBox.Show($"No config.yaml found for {comboService.Text}");
}
private async void btnRun_Click(object? sender, EventArgs e)
{
string finalCmd = txtCommandPreview.Text;
if (string.IsNullOrWhiteSpace(finalCmd)) return;
ToggleUI(true);
txtLog.AppendText($"> Executing: {finalCmd}{Environment.NewLine}");
try { await Task.Run(() => RunCli(finalCmd)); }
catch (Exception ex) { AppendLog($"[ERROR]: {ex.Message}"); }
finally { ToggleUI(false); }
}
private void RunCli(string cmd)
{
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = "cmd.exe",
// /c = Run command and then terminate
// chcp 65001 = Force console to use UTF-8 encoding
// && = Run the actual command immediately after setting encoding
Arguments = $"/c chcp 65001 && {cmd}",
WorkingDirectory = txtRootPath.Text,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true,
StandardOutputEncoding = Encoding.UTF8
};
// Ensure Python scripts know to use UTF-8
psi.EnvironmentVariables["PYTHONIOENCODING"] = "utf-8";
using (_currentProcess = Process.Start(psi))
{
if (_currentProcess == null) return;
_currentProcess.OutputDataReceived += (s, e) =>
{
// Filter out the noisy "Active code page: 65001" message from CMD
if (!string.IsNullOrEmpty(e.Data) && !e.Data.Contains("Active code page"))
AppendLog(e.Data);
};
_currentProcess.ErrorDataReceived += (s, e) => AppendLog(e.Data);
_currentProcess.BeginOutputReadLine();
_currentProcess.BeginErrorReadLine();
_currentProcess.WaitForExit();
}
}
private void AppendLog(string? text)
{
if (string.IsNullOrEmpty(text)) return;
this.BeginInvoke(new Action(() => { txtLog.AppendText(text + Environment.NewLine); }));
}
private void ApplyDarkTheme()
{
this.BackColor = Color.FromArgb(30, 30, 30);
this.ForeColor = Color.White;
foreach (Control c in this.Controls) UpdateControlTheme(c);
}
private void UpdateControlTheme(Control c)
{
c.BackColor = Color.FromArgb(45, 45, 48);
c.ForeColor = Color.White;
if (c is TextBox tb) tb.BorderStyle = BorderStyle.FixedSingle;
if (c is Button btn) { btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderColor = Color.Gray; }
if (c is PropertyGrid pg)
{
pg.BackColor = Color.FromArgb(37, 37, 38);
pg.ViewBackColor = Color.FromArgb(37, 37, 38);
pg.ViewForeColor = Color.White;
pg.LineColor = Color.FromArgb(45, 45, 48);
}
foreach (Control child in c.Controls) UpdateControlTheme(child);
}
private void SaveConfig()
{
_appSettings.RootPath = txtRootPath.Text;
_appSettings.BinaryName = txtBinName.Text;
File.WriteAllText(_configPath, JsonConvert.SerializeObject(_appSettings, Formatting.Indented));
}
private void RefreshFolders()
{
comboService.Items.Clear();
string path = Path.Combine(txtRootPath.Text, "unshackle", "services");
if (Directory.Exists(path))
{
var dirs = Directory.GetDirectories(path).Select(Path.GetFileName).ToArray();
comboService.Items.AddRange(dirs.Cast<object>().ToArray());
if (comboService.Items.Count > 0) comboService.SelectedIndex = 0;
}
}
private void ComboProfiles_SelectedIndexChanged(object? sender, EventArgs e)
{
if (comboProfiles.SelectedItem == null) return;
string selected = comboProfiles.SelectedItem.ToString();
if (_appSettings.Profiles.TryGetValue(selected, out var values))
{
_propertyValues = new Dictionary<string, object>(values);
pgProfile.SelectedObject =
new DynamicObject(_propertyValues, _parameterDefinitions);
UpdateCommandPreview();
}
}
private void btnAddProfile_Click(object? sender, EventArgs e)
{
string name = Microsoft.VisualBasic.Interaction.InputBox(
"Enter profile name:",
"New Profile",
"NewProfile");
if (string.IsNullOrWhiteSpace(name))
return;
if (_appSettings.Profiles.ContainsKey(name))
{
MessageBox.Show("Profile already exists.");
return;
}
// Clone current settings into new profile
_appSettings.Profiles[name] =
new Dictionary<string, object>(_propertyValues);
comboProfiles.DataSource = null;
comboProfiles.DataSource = _appSettings.Profiles.Keys.ToList();
comboProfiles.SelectedItem = name;
SaveConfig();
}
private void btnRemoveProfile_Click(object? sender, EventArgs e)
{
if (comboProfiles.SelectedItem == null)
return;
string selected = comboProfiles.SelectedItem.ToString();
if (selected == "Default")
{
MessageBox.Show("Default profile cannot be deleted.");
return;
}
if (!_appSettings.Profiles.ContainsKey(selected))
return;
_appSettings.Profiles.Remove(selected);
comboProfiles.DataSource = null;
comboProfiles.DataSource = _appSettings.Profiles.Keys.ToList();
comboProfiles.SelectedIndex = 0;
SaveConfig();
}
private void ToggleUI(bool r) => this.BeginInvoke(new Action(() => { btnRun.Enabled = !r; btnStop.Visible = r; }));
private void btnStop_Click(object? sender, EventArgs e) { _currentProcess?.Kill(true); }
private void btnClearLog_Click(object? sender, EventArgs e) => txtLog.Clear();
private void btnBrowse_Click(object? sender, EventArgs e)
{
using (var fbd = new FolderBrowserDialog()) if (fbd.ShowDialog() == DialogResult.OK) { txtRootPath.Text = fbd.SelectedPath; SaveConfig(); RefreshFolders(); }
}
private void btnOpenCookies_Click(object? sender, EventArgs e)
{
string p = Path.Combine(txtRootPath.Text, "unshackle", "cookies", comboService.Text);
Directory.CreateDirectory(p); Process.Start("explorer.exe", p);
}
private void btnEditYaml_Click(object? sender, EventArgs e)
{
string yamlPath = Path.Combine(txtRootPath.Text, "unshackle/unshackle.yaml");
if (File.Exists(yamlPath)) Process.Start(new ProcessStartInfo(yamlPath) { UseShellExecute = true });
}
}
// --- DATA MODELS ---
public class AppSettings
{
public string RootPath { get; set; } = @"C:\DEVINE\unshackle";
public string BinaryName { get; set; } = "uv";
public Dictionary<string, Dictionary<string, object>> Profiles { get; set; }
= new Dictionary<string, Dictionary<string, object>>();
}
public class UnshackleParameter
{
public string Flag { get; set; } = "";
public string Name { get; set; } = "";
public string Type { get; set; } = "Text";
public List<string>? Options { get; set; }
public object? Default { get; set; }
public string Category { get; set; } = "Misc";
}
}

16507
Shackle/MainForm.resx Normal file

File diff suppressed because it is too large Load Diff

19
Shackle/Program.cs Normal file
View File

@@ -0,0 +1,19 @@
using UnshackleGUI;
namespace Shackle
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new MainForm());
}
}
}

63
Shackle/Properties/Resources.Designer.cs generated Normal file
View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Shackle.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Shackle.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
Shackle/Properties/Settings.Designer.cs generated Normal file
View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Shackle.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

75
Shackle/Shackle.csproj Normal file
View File

@@ -0,0 +1,75 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<EnableCompressionInSingleFile>false</EnableCompressionInSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
<DebugType>none</DebugType>
<PackageIcon>8p5oo8p5oo8p5oo.png</PackageIcon>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="8p5oo8p5oo8p5oo.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="8p5oo8p5oo8p5oo.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="params.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\PublishProfiles\" />
</ItemGroup>
</Project>

7
Shackle/config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"RootPath": "C:\\DEVINE\\unshackle",
"BinaryName": "uv",
"Profiles": {
"Default": {}
}
}

226
Shackle/params.json Normal file
View File

@@ -0,0 +1,226 @@
[
{
"Flag": "-p",
"Name": "Profile",
"Type": "Text",
"Default": "",
"Category": "1. Account"
},
{
"Flag": "--proxy",
"Name": "Proxy",
"Type": "Text",
"Default": "",
"Category": "1. Account"
},
{
"Flag": "-q",
"Name": "Quality",
"Type": "Selection",
"Options": [ "2160", "1080", "720", "480" ],
"Default": "2160",
"Category": "2. Video"
},
{
"Flag": "-v",
"Name": "VideoCodec",
"Type": "Selection",
"Options": [
"any",
"avc",
"h.264",
"hevc",
"h.265",
"vc1",
"vc-1",
"vp8",
"vp9",
"av1"
],
"Default": "any",
"Category": "2. Video"
},
{
"Flag": "-r",
"Name": "Range",
"Type": "Selection",
"Options": ["any", "sdr", "hlg", "hdr10", "hdr10p", "dv", "hybrid" ],
"Default": "sdr",
"Category": "2. Video"
},
{
"Flag": "-vb",
"Name": "VideoBitrate",
"Type": "Number",
"Default": 0,
"Category": "2. Video"
},
{
"Flag": "-a",
"Name": "AudioCodec",
"Type": "Selection",
"Options": [
"any",
"aac",
"ac3",
"ec3",
"ac4",
"opus",
"ogg",
"dts",
"alac",
"flac"
],
"Default": "any",
"Category": "3. Audio"
},
{
"Flag": "-ab",
"Name": "AudioBitrate",
"Type": "Number",
"Default": 0,
"Category": "3. Audio"
},
{
"Flag": "-c",
"Name": "Channels",
"Type": "Text",
"Default": "",
"Category": "3. Audio"
},
{
"Flag": "--noatmos",
"Name": "NoAtmos",
"Type": "Bool",
"Default": false,
"Category": "3. Audio"
},
{
"Flag": "-w",
"Name": "WantedEpisodes",
"Type": "Text",
"Default": "",
"Category": "4. Selection"
},
{
"Flag": "-l",
"Name": "Language",
"Type": "Text",
"Default": "en,orig",
"Category": "4. Selection"
},
{
"Flag": "--latest-episode",
"Name": "LatestOnly",
"Type": "Bool",
"Default": false,
"Category": "4. Selection"
},
{
"Flag": "-sl",
"Name": "SubtitleLang",
"Type": "Text",
"Default": "",
"Category": "4. Selection"
},
{
"Flag": "-fs",
"Name": "ForcedSubs",
"Type": "Bool",
"Default": false,
"Category": "4. Selection"
},
{
"Flag": "--sub-format",
"Name": "SubFormat",
"Type": "Selection",
"Options": [
"any",
"subrip",
"srt",
"substationalpha",
"ssa",
"substationalphav4",
"ass",
"timedtextmarkuplang",
"ttml",
"webvtt",
"vtt",
"sami",
"smi",
"microdvd",
"sub",
"mpl2",
"tmp",
"fttml",
"stpp",
"fvtt",
"wvtt"
],
"Default": "any",
"Category": "5. Formatting"
},
{
"Flag": "--tag",
"Name": "GroupTag",
"Type": "Text",
"Default": "",
"Category": "5. Formatting"
},
{
"Flag": "-V",
"Name": "VideoOnly",
"Type": "Bool",
"Default": false,
"Category": "6. Filters"
},
{
"Flag": "-A",
"Name": "AudioOnly",
"Type": "Bool",
"Default": false,
"Category": "6. Filters"
},
{
"Flag": "-S",
"Name": "SubsOnly",
"Type": "Bool",
"Default": false,
"Category": "6. Filters"
},
{
"Flag": "--list",
"Name": "ListTracks",
"Type": "Bool",
"Default": false,
"Category": "7. Debug/DryRun"
},
{
"Flag": "--slow",
"Name": "SlowMode",
"Type": "Bool",
"Default": false,
"Category": "8. Engine"
},
{
"Flag": "--workers",
"Name": "Workers",
"Type": "Number",
"Default": 0,
"Category": "8. Engine"
},
{
"Flag": "--no-mux",
"Name": "NoMux",
"Type": "Bool",
"Default": false,
"Category": "8. Engine"
},
{
"Flag": "--best-available",
"Name": "BestAvailable",
"Type": "Bool",
"Default": true,
"Category": "8. Engine"
}
]