Cleanup and Fixes and Inplace - Oh My

Add option to extract all archives to torrent root, destination folder, or true in-place.
Add sonarr/radarr support (marks torrent "incomplete" until extraction is done).
Bundle 7z.exe for windows users.
Fix GTK UI not working...at all.
Improve web and GTK UI so they're uniform, have radio buttons, etc.
This commit is contained in:
d8ahazard
2019-12-27 16:05:53 -06:00
parent a9140d33a1
commit 3d4740b95b
14 changed files with 537 additions and 438 deletions

View File

@@ -0,0 +1,178 @@
/*!
* simpleextractor.js
*
* Copyright (c) Damien Churchill 2010 <damoxc@gmail.com>
* Copyright (C) Digitalhigh 2019 <donate.to.digitalhigh@gmail.com>
*
*
*/
Ext.ns('Deluge.ux.preferences');
/**
* @class Deluge.ux.preferences.SimpleExtractorPage
* @extends Ext.Panel
*/
Deluge.ux.preferences.SimpleExtractorPage = Ext.extend(Ext.Panel, {
title: _('SimpleExtractor'),
layout: 'fit',
border: false,
initComponent: function() {
Deluge.ux.preferences.SimpleExtractorPage.superclass.initComponent.call(this);
this.form = this.add({
xtype: 'form',
layout: 'form',
border: false,
autoHeight: true
});
this.behaviorSet = this.form.add({
xtype: 'fieldset',
border: false,
title: '',
autoHeight: true,
labelAlign: 'top',
labelWidth: 80,
defaultType: 'textfield'
});
this.behaviorSet.add({
xtype: 'label',
fieldLabel: _('<b>Extract Behavior:</b></br>'),
labelSeparator : '',
name: '',
width: '97%'
});
// Behavior Label
// Add radio group for extract behavior
this.extractBehavior = this.behaviorSet.add({
xtype: 'radiogroup',
columns: 1,
colspan: 2,
style: 'margin-left: 10px',
items: [
{
boxLabel: _('Selected Folder'),
name: 'extract_behavior',
inputValue: "extract_selected_folder"
},
{
boxLabel: _('Torrent Root'),
name: 'extract_behavior',
inputValue: "extract_torrent_root"
},
{
boxLabel: _('In-Place'),
name: 'extract_behavior',
inputValue: "extract_in_place"
}
],
});
this.destinationSet = this.form.add({
xtype: 'fieldset',
border: false,
title: '',
autoHeight: true,
labelAlign: 'top',
labelWidth: 80,
defaultType: 'textfield'
});
// Destination label
this.extractPath = this.destinationSet.add({
fieldLabel: _('<b>Destination:</b></br>'),
name: 'extract_path',
labelSeparator : '',
width: '97%'
});
this.labelSet = this.form.add({
xtype: 'fieldset',
border: false,
title: '',
autoHeight: true,
labelAlign: 'top',
labelWidth: 80,
defaultType: 'textfield'
});
// Label Filter Label
this.labelFilter = this.labelSet.add({
fieldLabel: _('<b>Label Filtering:</b></br>'),
name: 'label_filter',
labelSeparator : '',
width: '97%'
});
this.labelSet.add({
xtype: 'label',
fieldLabel: _('</br>Comma-separated, leave blank for none.'),
labelSeparator : '',
name: '',
width: '97%'
});
this.on('show', this.updateConfig, this);
},
onApply: function() {
// build settings object
var config = {};
config['extract_path'] = this.extractPath.getValue();
var eBehavior = this.extractBehavior.getValue();
config['extract_in_place'] = false;
config['extract_torrent_root'] = false;
config['extract_selected_folder'] = false;
config[eBehavior] = true;
config['label_filter'] = this.labelFilter.getValue();
deluge.client.simpleextractor.set_config(config);
},
onOk: function() {
this.onApply();
},
updateConfig: function() {
deluge.client.simpleextractor.get_config({
success: function(config) {
this.extractPath.setValue(config['extract_path']);
var behavior = "extract_selected_folder";
if (config['extract_in_place']) {
behavior = 'extract_in_place';
}
if (config['extract_torrent_root']) {
behavior = 'extract_torrent_root';
}
this.extractBehavior.setValue(behavior);
this.labelFilter.setValue(config['label_filter']);
},
scope: this
});
}
});
Deluge.plugins.SimpleExtractorPlugin = Ext.extend(Deluge.Plugin, {
name: 'SimpleExtractor',
onDisable: function() {
deluge.preferences.removePage(this.prefsPage);
},
onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.SimpleExtractorPage());
}
});
Deluge.registerPlugin('SimpleExtractor', Deluge.plugins.SimpleExtractorPlugin);

View File

@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="extractor_prefs_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="extract_behavior">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkRadioButton" id="extract_selected_folder">
<property name="label" translatable="yes">Selected Folder</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">All torrents will be extracted to the selected folder below.</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">extract_torrent_root</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="extract_torrent_root">
<property name="label" translatable="yes">Torrent Root</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Any found archives will be extracted to the root of the torrent directory.</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="extract_in_place">
<property name="label" translatable="yes">In-Place</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Found archives will be extracted where they are found.</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">extract_torrent_root</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Extract Behavior:&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkBox" id="destination_path">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkFileChooserButton" id="folderchooser_path">
<property name="can_focus">False</property>
<property name="action">select-folder</property>
<property name="title" translatable="yes">Select A Folder</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="extract_path">
<property name="can_focus">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Destination:&lt;/b&gt;
</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkEntry" id="label_filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Enter one or more labels to extract, separated by commas. Leave to extract any archive found.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_labels">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Enter labels to extract (comma-separated, leave blank for all)</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Label Filtering:&lt;/b&gt;
</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>