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);