2015-01-22 19:41:44 +01:00
|
|
|
/*
|
|
|
|
|
Script: streaming.js
|
|
|
|
|
The client-side javascript code for the Streaming plugin.
|
|
|
|
|
|
|
|
|
|
Copyright:
|
|
|
|
|
(C) John Doee 2009 <johndoee@tidalstream.org>
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, write to:
|
|
|
|
|
The Free Software Foundation, Inc.,
|
|
|
|
|
51 Franklin Street, Fifth Floor
|
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
In addition, as a special exception, the copyright holders give
|
|
|
|
|
permission to link the code of portions of this program with the OpenSSL
|
|
|
|
|
library.
|
|
|
|
|
You must obey the GNU General Public License in all respects for all of
|
|
|
|
|
the code used other than OpenSSL. If you modify file(s) with this
|
|
|
|
|
exception, you may extend this exception to your version of the file(s),
|
|
|
|
|
but you are not obligated to do so. If you do not wish to do so, delete
|
|
|
|
|
this exception statement from your version. If you delete this exception
|
|
|
|
|
statement from all source files in the program, then also delete it here.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
PreferencePage = Ext.extend(Ext.Panel, {
|
|
|
|
|
title: 'Streaming',
|
|
|
|
|
border: false,
|
|
|
|
|
layout: 'form',
|
2018-08-24 21:20:53 +02:00
|
|
|
header: false,
|
2016-09-07 20:00:49 +02:00
|
|
|
autoScroll: true,
|
2018-08-24 21:20:53 +02:00
|
|
|
autoHeight: true,
|
|
|
|
|
width: 320,
|
2016-09-07 20:00:49 +02:00
|
|
|
_fields: {},
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
initComponent: function() {
|
|
|
|
|
PreferencePage.superclass.initComponent.call(this);
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
var om = this.optionsManager = new Deluge.OptionsManager();
|
|
|
|
|
this.on('show', this.onPageShow, this);
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
var fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
2016-09-07 20:00:49 +02:00
|
|
|
title: 'Settings',
|
|
|
|
|
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
|
|
|
|
autoHeight: true,
|
2018-08-24 21:20:53 +02:00
|
|
|
labelAlign: 'top',
|
|
|
|
|
labelWidth: 150,
|
|
|
|
|
width: 300,
|
2016-09-07 20:00:49 +02:00
|
|
|
defaultType: 'textfield',
|
|
|
|
|
defaults: {
|
2018-08-24 21:20:53 +02:00
|
|
|
width: 280,
|
2016-09-07 20:00:49 +02:00
|
|
|
}
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('download_only_streamed', fieldset.add({
|
|
|
|
|
xtype: 'checkbox',
|
|
|
|
|
name: 'download_only_streamed',
|
|
|
|
|
boxLabel: 'Download only streamed files, skip the other files',
|
|
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
|
|
|
|
title: 'File Serving Settings',
|
2015-07-19 19:18:59 +02:00
|
|
|
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
|
|
|
|
autoHeight: true,
|
2018-08-24 21:20:53 +02:00
|
|
|
labelAlign: 'top',
|
|
|
|
|
labelWidth: 150,
|
|
|
|
|
width: 280,
|
2015-07-19 19:18:59 +02:00
|
|
|
defaultType: 'textfield',
|
|
|
|
|
defaults: {
|
2018-08-24 21:20:53 +02:00
|
|
|
width: 260,
|
2015-07-19 19:18:59 +02:00
|
|
|
}
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('ip', fieldset.add({
|
|
|
|
|
name: 'ip',
|
|
|
|
|
fieldLabel: 'Hostname',
|
|
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
om.bind('port', fieldset.add({
|
|
|
|
|
name: 'port',
|
|
|
|
|
fieldLabel: _('Port'),
|
|
|
|
|
decimalPrecision: 0,
|
|
|
|
|
minValue: -1,
|
2016-09-07 20:00:49 +02:00
|
|
|
maxValue: 99999,
|
2015-07-19 19:18:59 +02:00
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2018-08-24 21:20:53 +02:00
|
|
|
var field = fieldset.add({
|
|
|
|
|
xtype: 'togglefield',
|
|
|
|
|
name: 'reverse_proxy_base_url',
|
|
|
|
|
fieldLabel: 'Reverse Proxy Config',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
om.bind('reverse_proxy_enabled', field.toggle);
|
|
|
|
|
om.bind('reverse_proxy_base_url', field.input);
|
|
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
|
|
|
|
autoHeight: true,
|
|
|
|
|
defaultType: 'radio',
|
|
|
|
|
style: 'margin-bottom: 5px; margin-top: 0; padding-bottom: 5px; padding-top: 0;',
|
2018-08-24 21:20:53 +02:00
|
|
|
width: 280,
|
2016-09-07 20:00:49 +02:00
|
|
|
labelWidth: 1
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
this._fields['serve_method_webui'] = fieldset.add({
|
|
|
|
|
name: 'serve_method',
|
|
|
|
|
boxLabel: 'Serve files via WebUI',
|
|
|
|
|
inputValue: 'webui',
|
|
|
|
|
disabled: true
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('serve_method', this._fields['serve_method_webui']);
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
this._fields['serve_method_standalone'] = fieldset.add({
|
|
|
|
|
name: 'serve_method',
|
|
|
|
|
boxLabel: 'Serve files via standalone',
|
|
|
|
|
inputValue: 'standalone',
|
|
|
|
|
disabled: true
|
|
|
|
|
});
|
|
|
|
|
om.bind('serve_method', this._fields['serve_method_standalone']);
|
2017-08-12 13:27:32 +02:00
|
|
|
|
|
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('use_ssl', fieldset.add({
|
2015-11-17 22:41:14 +01:00
|
|
|
xtype: 'checkbox',
|
2016-09-07 20:00:49 +02:00
|
|
|
name: 'use_ssl',
|
|
|
|
|
boxLabel: 'Use SSL',
|
|
|
|
|
style: 'margin-left: 12px;'
|
2015-11-17 22:41:14 +01:00
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
|
|
|
|
autoHeight: true,
|
|
|
|
|
defaultType: 'radio',
|
|
|
|
|
style: 'margin-left: 24px; margin-bottom: 5px; margin-top: 0; padding-bottom: 5px; padding-top: 0;',
|
2018-08-24 21:20:53 +02:00
|
|
|
width: 280,
|
2016-09-07 20:00:49 +02:00
|
|
|
labelWidth: 1
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
this._fields['ssl_source_daemon'] = fieldset.add({
|
|
|
|
|
name: 'ssl_source',
|
|
|
|
|
boxLabel: 'Use Daemon/WebUI Certificate',
|
|
|
|
|
inputValue: 'daemon',
|
|
|
|
|
value: 'daemon'
|
|
|
|
|
})
|
|
|
|
|
om.bind('ssl_source', this._fields['ssl_source_daemon']);
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
this._fields['ssl_source_custom'] = fieldset.add({
|
|
|
|
|
name: 'ssl_source',
|
|
|
|
|
boxLabel: 'Custom Certificate',
|
|
|
|
|
inputValue: 'custom',
|
|
|
|
|
value: 'custom'
|
|
|
|
|
});
|
|
|
|
|
om.bind('ssl_source', this._fields['ssl_source_custom']);
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
|
|
|
|
style: 'margin-left: 24px; margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
|
|
|
|
autoHeight: true,
|
|
|
|
|
labelWidth: 110,
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
defaults: {
|
|
|
|
|
width: 130,
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('ssl_priv_key_path', fieldset.add({
|
|
|
|
|
name: 'ssl_priv_key_path',
|
2018-08-24 21:20:53 +02:00
|
|
|
fieldLabel: 'Private key file path',
|
2015-11-17 22:41:14 +01:00
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('ssl_cert_path', fieldset.add({
|
|
|
|
|
name: 'ssl_cert_path',
|
2018-08-24 21:20:53 +02:00
|
|
|
fieldLabel: 'Certificate and chains file path',
|
2015-07-19 19:18:59 +02:00
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
|
|
|
|
title: 'Advanced settings',
|
|
|
|
|
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
|
|
|
|
autoHeight: true,
|
2018-08-24 21:20:53 +02:00
|
|
|
labelAlign: 'top',
|
|
|
|
|
labelWidth: 150,
|
|
|
|
|
width: 280,
|
2016-09-07 20:00:49 +02:00
|
|
|
defaultType: 'textfield',
|
|
|
|
|
defaults: {
|
2018-08-24 21:20:53 +02:00
|
|
|
width: 260,
|
2016-09-07 20:00:49 +02:00
|
|
|
}
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
om.bind('allow_remote', fieldset.add({
|
|
|
|
|
xtype: 'checkbox',
|
|
|
|
|
name: 'allow_remote',
|
2016-09-07 20:00:49 +02:00
|
|
|
boxLabel: 'Allow remote control',
|
2018-08-24 21:20:53 +02:00
|
|
|
style: 'margin-left: 12px;',
|
|
|
|
|
width: 150
|
2015-07-19 19:18:59 +02:00
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
|
|
|
|
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
|
|
|
|
autoHeight: true,
|
2018-08-24 21:20:53 +02:00
|
|
|
labelAlign: 'top',
|
|
|
|
|
labelWidth: 150,
|
|
|
|
|
width: 260,
|
2016-09-07 20:00:49 +02:00
|
|
|
defaultType: 'textfield',
|
|
|
|
|
defaults: {
|
2018-08-24 21:20:53 +02:00
|
|
|
width: 240,
|
2016-09-07 20:00:49 +02:00
|
|
|
}
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2018-08-17 19:02:58 +02:00
|
|
|
// om.bind('remote_username', fieldset.add({
|
|
|
|
|
// xtype: 'textfield',
|
|
|
|
|
// name: 'remote_username',
|
|
|
|
|
// fieldLabel: 'Remote control username'
|
|
|
|
|
// }));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
om.bind('remote_password', fieldset.add({
|
2016-09-07 20:00:49 +02:00
|
|
|
xtype: 'textfield',
|
2015-07-19 19:18:59 +02:00
|
|
|
name: 'remote_password',
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldLabel: 'Remote control password'
|
|
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
|
|
|
|
fieldset.add({
|
|
|
|
|
xtype: 'textfield',
|
|
|
|
|
id: 'remote_url',
|
|
|
|
|
name: 'remote_url',
|
|
|
|
|
readOnly: true,
|
|
|
|
|
fieldLabel: 'Remote control url'
|
|
|
|
|
});
|
|
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
fieldset = this.add({
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
border: false,
|
|
|
|
|
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
|
|
|
|
autoHeight: true,
|
|
|
|
|
labelWidth: 1,
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
defaults: {
|
2018-08-24 21:20:53 +02:00
|
|
|
width: 200,
|
2016-09-07 20:00:49 +02:00
|
|
|
}
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('use_stream_urls', fieldset.add({
|
|
|
|
|
xtype: 'checkbox',
|
|
|
|
|
name: 'use_stream_urls',
|
2017-08-18 17:01:16 +02:00
|
|
|
boxLabel: 'Use stream protocol urls',
|
2016-09-07 20:00:49 +02:00
|
|
|
style: 'margin-left: 12px;'
|
|
|
|
|
}));
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
om.bind('auto_open_stream_urls', fieldset.add({
|
|
|
|
|
xtype: 'checkbox',
|
|
|
|
|
name: 'auto_open_stream_urls',
|
2017-08-18 17:01:16 +02:00
|
|
|
boxLabel: 'Auto-open stream protocol urls',
|
2016-09-07 20:00:49 +02:00
|
|
|
style: 'margin-left: 12px;'
|
2015-07-19 19:18:59 +02:00
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onApply: function() {
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
var changed = this.optionsManager.getDirty();
|
2016-09-07 20:00:49 +02:00
|
|
|
for (var key in this._fields) {
|
|
|
|
|
if (this._fields.hasOwnProperty(key)) {
|
|
|
|
|
var v = this._fields[key];
|
|
|
|
|
if (v.checked) {
|
|
|
|
|
changed[v.name] = v.inputValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-19 19:18:59 +02:00
|
|
|
if (!Ext.isObjectEmpty(changed)) {
|
|
|
|
|
deluge.client.streaming.set_config(changed, {
|
|
|
|
|
success: this.onSetConfig,
|
|
|
|
|
scope: this
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
for (var key in deluge.config) {
|
|
|
|
|
deluge.config[key] = this.optionsManager.get(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2016-09-07 20:00:49 +02:00
|
|
|
onSetConfig: function(result) {
|
2015-07-19 19:18:59 +02:00
|
|
|
this.optionsManager.commit();
|
2016-09-07 20:00:49 +02:00
|
|
|
if (result) {
|
|
|
|
|
var message_type = result[0];
|
|
|
|
|
var message_class = result[1];
|
|
|
|
|
var message = result[2];
|
|
|
|
|
if (message_type == 'error') {
|
|
|
|
|
var topic = 'Unknown error type'
|
|
|
|
|
if (message_class == 'ssl') {
|
|
|
|
|
topic = 'SSL Failed'
|
|
|
|
|
}
|
|
|
|
|
Ext.Msg.alert(topic, message);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-08-12 13:27:32 +02:00
|
|
|
this.updateRemoteUrl(this.optionsManager);
|
2015-07-19 19:18:59 +02:00
|
|
|
},
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
onGotConfig: function(config) {
|
|
|
|
|
this.optionsManager.set(config);
|
2017-08-12 13:27:32 +02:00
|
|
|
this.updateRemoteUrl(this.optionsManager);
|
2015-07-19 19:18:59 +02:00
|
|
|
},
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
onPageShow: function() {
|
|
|
|
|
deluge.client.streaming.get_config({
|
|
|
|
|
success: this.onGotConfig,
|
|
|
|
|
scope: this
|
|
|
|
|
})
|
2017-08-12 13:27:32 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
updateRemoteUrl: function(optionsManager) {
|
|
|
|
|
var apiUrl = 'http';
|
|
|
|
|
if (optionsManager.get('use_ssl'))
|
|
|
|
|
apiUrl += 's';
|
2018-08-17 19:02:58 +02:00
|
|
|
apiUrl += '://' + optionsManager.get('remote_username') + ':' + optionsManager.get('remote_password') + '@' + optionsManager.get('ip') + ':' + optionsManager.get('port') + '/streaming/stream';
|
2017-08-12 13:27:32 +02:00
|
|
|
Ext.getCmp('remote_url').setValue(apiUrl);
|
2015-07-19 19:18:59 +02:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-01-22 19:41:44 +01:00
|
|
|
StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
2015-07-19 19:18:59 +02:00
|
|
|
'name': 'Streaming',
|
2015-01-22 19:41:44 +01:00
|
|
|
|
|
|
|
|
onDisable: function() {
|
2015-07-19 19:18:59 +02:00
|
|
|
deluge.menus.filePriorities.remove('streamthis');
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
deluge.preferences.selectPage(_('Plugins'));
|
|
|
|
|
deluge.preferences.removePage(this.prefsPage);
|
|
|
|
|
this.prefsPage.destroy();
|
2015-01-22 19:41:44 +01:00
|
|
|
},
|
|
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
onEnable: function() {
|
|
|
|
|
this.prefsPage = new PreferencePage();
|
|
|
|
|
deluge.preferences.addPage(this.prefsPage);
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
console.log('Streaming plugin loaded');
|
2015-11-21 19:05:01 +01:00
|
|
|
var doStream = function (tid, fileIndex) {
|
2015-11-22 16:20:37 +01:00
|
|
|
deluge.client.streaming.stream_torrent(tid, null, null, fileIndex, true, {
|
2015-11-21 19:05:01 +01:00
|
|
|
success: function (result) {
|
|
|
|
|
console.log('Got result', result);
|
|
|
|
|
if (result.status == 'success') {
|
|
|
|
|
var url = result.url;
|
|
|
|
|
if (result.use_stream_urls) {
|
|
|
|
|
url = 'stream+' + url;
|
|
|
|
|
if (result.auto_open_stream_urls) {
|
|
|
|
|
window.location.assign(url);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Ext.Msg.alert('Stream ready', 'URL for stream: <a target="_blank" href="' + url + '">' + url + '</a>');
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.alert('Stream failed', 'Error message: ' + result.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2017-08-12 13:27:32 +02:00
|
|
|
|
|
|
|
|
|
2015-07-19 19:18:59 +02:00
|
|
|
deluge.menus.filePriorities.addMenuItem({
|
|
|
|
|
id: 'streamthis',
|
|
|
|
|
text: 'Stream this file',
|
|
|
|
|
iconCls: 'icon-down',
|
|
|
|
|
handler: function (item, event) {
|
|
|
|
|
deluge.menus.filePriorities.hide();
|
|
|
|
|
var files = deluge.details.items.items[2];
|
|
|
|
|
var nodes = files.getSelectionModel().getSelectedNodes();
|
|
|
|
|
if (nodes) {
|
|
|
|
|
var fileIndex = nodes[0].attributes.fileIndex;
|
|
|
|
|
var tid = files.torrentId;
|
|
|
|
|
if (fileIndex >= 0) {
|
2015-11-21 19:05:01 +01:00
|
|
|
doStream(tid, fileIndex);
|
2015-07-19 19:18:59 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-08-12 13:27:32 +02:00
|
|
|
|
2015-11-21 19:05:01 +01:00
|
|
|
deluge.menus.torrent.addMenuItem({
|
|
|
|
|
id: 'streamthistorrent',
|
|
|
|
|
text: 'Stream this torrent',
|
|
|
|
|
iconCls: 'icon-down',
|
|
|
|
|
handler: function (item, event) {
|
|
|
|
|
deluge.menus.torrent.hide();
|
|
|
|
|
var ids = deluge.torrents.getSelectedIds();
|
|
|
|
|
if (ids) {
|
|
|
|
|
doStream(ids[0]);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-01-22 19:41:44 +01:00
|
|
|
}
|
|
|
|
|
});
|
2015-07-19 19:18:59 +02:00
|
|
|
Deluge.registerPlugin('Streaming', StreamingPlugin);
|