mirror of
https://github.com/JohnDoee/deluge-streaming/
synced 2026-07-01 07:31:17 -07:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1da0e6cfb2 | ||
|
|
e494dad9bf | ||
|
|
d0d43b8c66 | ||
|
|
5228870bec | ||
|
|
a5d44a536a | ||
|
|
28aa99750a | ||
|
|
8e97331c2c | ||
|
|
67ff10b144 | ||
|
|
21fd98dfea | ||
|
|
1cf05ed46c | ||
|
|
49c4733a1e | ||
|
|
a29a69ba11 | ||
|
|
0bd7b8d40d | ||
|
|
6b2817ce5e | ||
|
|
0cc8ed4280 | ||
|
|
636bd0edc2 | ||
|
|
6bc72dbc44 | ||
|
|
c85c5763d6 | ||
|
|
bcc2067e55 | ||
|
|
1d31efa48c | ||
|
|
5859a19e0e | ||
|
|
4290a0b821 | ||
|
|
634219f0f8 | ||
|
|
342b9f77a4 | ||
|
|
8f03e719fa | ||
|
|
8c010abe16 | ||
|
|
e92f9029a4 | ||
|
|
a483bfe599 | ||
|
|
f3ee7f4270 | ||
|
|
91e8da6dfd |
37
README.md
37
README.md
@@ -1,7 +1,7 @@
|
||||
# Streaming Plugin
|
||||
https://github.com/JohnDoee/deluge-streaming
|
||||
|
||||
(c)2015 by Anders Jensen <johndoee@tidalstream.org>
|
||||
(c)2016 by Anders Jensen <johndoee@tidalstream.org>
|
||||
|
||||
## Description
|
||||
|
||||
@@ -23,7 +23,6 @@ Under that tab, eggs for Python 2.6 and 2.7 should exist.
|
||||
* Select _files_ tab
|
||||
* Right-click a file.
|
||||
* Click _Stream this file_
|
||||
* **WAIT**, it will try to buffer the first pieces of the file before generating a link (no feedback yet).
|
||||
* Select the link, open it in a media player, e.g. VLC or MPC
|
||||
|
||||
If you want to stream from a non-local computer, e.g. your seedbox, you will need to change the IP in option to the external server ip.
|
||||
@@ -35,13 +34,35 @@ make Deluge an abstraction layer for the [TidalStream](http://www.tidalstream.or
|
||||
|
||||
The _allow remote_ option is to allow remote add and stream of torrents.
|
||||
|
||||
## ToDo
|
||||
|
||||
* Add feedback when preparing stream.
|
||||
|
||||
# Version Info
|
||||
|
||||
## Version 0.3.0
|
||||
## Version 0.8.0
|
||||
* Improved remote control of streaming to make it work as originally intended.
|
||||
|
||||
## Version 0.7.1
|
||||
* Trying to fix bug where piece buffer went empty
|
||||
* Added support for SSL.
|
||||
|
||||
## Version 0.7.0
|
||||
* Shrinked code by redoing queue algorithm. This should prevent more stalled downloads and allow it to act bittorrenty if necessary.
|
||||
* Added support for waiting for end pieces to satisfy some video players (KODI)
|
||||
|
||||
## Version 0.6.1
|
||||
* Should not have been in changelog: Fixed "resume on complete" broken-ness (i hope)
|
||||
|
||||
## Version 0.6.0
|
||||
* Fixed URL encoding error
|
||||
* Fixed "resume on complete" broken-ness (i hope)
|
||||
* Changed default to not use stream urls
|
||||
|
||||
## Version 0.5.0
|
||||
* Restructured the whole plugin
|
||||
* Added support for StreamProtocol
|
||||
|
||||
## Version 0.4.1
|
||||
* Fixed bug with old Deluge versions
|
||||
|
||||
## Version 0.4.0
|
||||
* Added WebUI support
|
||||
* Improved scheduling algorithm
|
||||
|
||||
@@ -55,4 +76,4 @@ The _allow remote_ option is to allow remote add and stream of torrents.
|
||||
* Improved buffering algorithm, not using only deadline anymore.
|
||||
|
||||
## Version 0.1
|
||||
* Initial working release
|
||||
* Initial working release
|
||||
|
||||
3
setup.py
3
setup.py
@@ -42,7 +42,7 @@ from setuptools import setup
|
||||
__plugin_name__ = "Streaming"
|
||||
__author__ = "John Doee"
|
||||
__author_email__ = "johndoee@tidalstream.org"
|
||||
__version__ = "0.4.0"
|
||||
__version__ = "0.8.0"
|
||||
__url__ = "https://github.com/JohnDoee/deluge-streaming"
|
||||
__license__ = "GPLv3"
|
||||
__description__ = "Enables streaming of files while downloading them."
|
||||
@@ -59,7 +59,6 @@ downloads ahead, this enables seeking in video files.
|
||||
* Select _files_ tab
|
||||
* Right-click a file.
|
||||
* Click _Stream this file_
|
||||
* **WAIT**, it will try to buffer the first pieces of the file before generating a link (no feedback yet).
|
||||
* Select the link, open it in a media player, e.g. VLC or MPC
|
||||
|
||||
If you want to stream from a non-local computer, e.g. your seedbox, you will need to change the IP in option to the external server ip."""
|
||||
|
||||
1082
streaming/core.py
1082
streaming/core.py
File diff suppressed because it is too large
Load Diff
@@ -1,158 +1,634 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Fri Aug 8 23:34:44 2008 -->
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.16 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="prefs_box">
|
||||
<widget class="GtkVBox" id="prefs_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="label_box">
|
||||
<widget class="GtkFrame" id="settings_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label_ip">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">IP:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Port:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label_reset_complete">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Reset "do not download" when streamed file is complete:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label_allow_remote">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Allow remote control:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label_remote_username">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Remote username:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label_remote_password">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Remote password:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="settings_alignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">10</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="settings_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_download_only_streamed">
|
||||
<property name="label" translatable="yes">Download only streamed files, skip the other files</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="settings_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Settings</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="input_box">
|
||||
<widget class="GtkFrame" id="serving_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_ip">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_reset_complete">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_allow_remote">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_remote_username">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_remote_password">
|
||||
<property name="visible">True</property>
|
||||
<property name="visibility">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="settings_alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">10</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="settings_vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="remote_username_label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Hostname: </property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_ip">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="remote_username_label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Port: </property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="input_serve_webui">
|
||||
<property name="label" translatable="yes">Serve files via WebUI</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="settings_vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="input_serve_standalone">
|
||||
<property name="label" translatable="yes">Serve files via standalone</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">input_serve_webui</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="remote_alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">20</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="remote_vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_use_ssl">
|
||||
<property name="label" translatable="yes">Use SSL</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">20</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="input_ssl_cert_daemon">
|
||||
<property name="label" translatable="yes">Use Daemon/WebUI Certificate</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="input_ssl_cert_custom">
|
||||
<property name="label" translatable="yes">Custom Certificate</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">input_ssl_cert_daemon</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">20</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Private key file path</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_ssl_priv_key_path">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Certificate and chains file path</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_ssl_cert_path">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="serving_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>File Serving Settings</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="settings_frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="settings_alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">10</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="settings_vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="settings_vbox5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_allow_remote">
|
||||
<property name="label" translatable="yes">Allow remote control</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="remote_alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">32</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="remote_vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="remote_username_hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="remote_username_label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Remote control username:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_remote_username">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="remote_password_hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="remote_password_label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Remote control password:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="input_remote_password">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="visibility">False</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="remote_url_hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="remote_url_label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Remote control url:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="output_remote_url">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="editable">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_use_stream_urls">
|
||||
<property name="label" translatable="yes">Use stream urls</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_auto_open_stream_urls">
|
||||
<property name="label" translatable="yes">Auto-open stream urls</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="settings_label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Advanced Settings</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
@@ -35,17 +35,38 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
title: 'Streaming',
|
||||
border: false,
|
||||
layout: 'form',
|
||||
|
||||
autoScroll: true,
|
||||
_fields: {},
|
||||
|
||||
initComponent: function() {
|
||||
PreferencePage.superclass.initComponent.call(this);
|
||||
|
||||
|
||||
var om = this.optionsManager = new Deluge.OptionsManager();
|
||||
this.on('show', this.onPageShow, this);
|
||||
|
||||
|
||||
var fieldset = this.add({
|
||||
xtype: 'fieldset',
|
||||
border: false,
|
||||
title: 'Streaming',
|
||||
title: 'Settings',
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 1,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
}
|
||||
});
|
||||
|
||||
om.bind('download_only_streamed', fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'download_only_streamed',
|
||||
boxLabel: 'Download only streamed files, skip the other files',
|
||||
}));
|
||||
|
||||
fieldset = this.add({
|
||||
xtype: 'fieldset',
|
||||
border: false,
|
||||
title: 'File Serving Settings',
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 110,
|
||||
@@ -54,71 +75,241 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
width: 180,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
om.bind('ip', fieldset.add({
|
||||
name: 'ip',
|
||||
fieldLabel: 'Hostname',
|
||||
}));
|
||||
|
||||
om.bind('port', fieldset.add({
|
||||
name: 'port',
|
||||
fieldLabel: _('Port'),
|
||||
decimalPrecision: 0,
|
||||
minValue: -1,
|
||||
maxValue: 99999
|
||||
maxValue: 99999,
|
||||
}));
|
||||
|
||||
om.bind('ip', fieldset.add({
|
||||
name: 'ip',
|
||||
fieldLabel: 'IP'
|
||||
}));
|
||||
|
||||
om.bind('reset_complete', fieldset.add({
|
||||
|
||||
fieldset = this.add({
|
||||
xtype: 'fieldset',
|
||||
border: false,
|
||||
autoHeight: true,
|
||||
defaultType: 'radio',
|
||||
style: 'margin-bottom: 5px; margin-top: 0; padding-bottom: 5px; padding-top: 0;',
|
||||
width: 240,
|
||||
labelWidth: 1
|
||||
});
|
||||
|
||||
this._fields['serve_method_webui'] = fieldset.add({
|
||||
name: 'serve_method',
|
||||
boxLabel: 'Serve files via WebUI',
|
||||
inputValue: 'webui',
|
||||
disabled: true
|
||||
});
|
||||
|
||||
om.bind('serve_method', this._fields['serve_method_webui']);
|
||||
|
||||
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']);
|
||||
|
||||
|
||||
om.bind('use_ssl', fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'reset_complete',
|
||||
fieldLabel: 'Reset "do not download" when streamed file is complete',
|
||||
name: 'use_ssl',
|
||||
boxLabel: 'Use SSL',
|
||||
style: 'margin-left: 12px;'
|
||||
}));
|
||||
|
||||
|
||||
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;',
|
||||
width: 240,
|
||||
labelWidth: 1
|
||||
});
|
||||
|
||||
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']);
|
||||
|
||||
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']);
|
||||
|
||||
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,
|
||||
}
|
||||
});
|
||||
|
||||
om.bind('ssl_priv_key_path', fieldset.add({
|
||||
name: 'ssl_priv_key_path',
|
||||
fieldLabel: 'Private key file path'
|
||||
}));
|
||||
|
||||
om.bind('ssl_cert_path', fieldset.add({
|
||||
name: 'ssl_cert_path',
|
||||
fieldLabel: 'Certificate and chains file path'
|
||||
}));
|
||||
|
||||
fieldset = this.add({
|
||||
xtype: 'fieldset',
|
||||
border: false,
|
||||
title: 'Advanced settings',
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 1,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
}
|
||||
});
|
||||
|
||||
om.bind('allow_remote', fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'allow_remote',
|
||||
fieldLabel: 'Allow remote control checkbox',
|
||||
boxLabel: 'Allow remote control',
|
||||
style: 'margin-left: 12px;'
|
||||
}));
|
||||
|
||||
|
||||
fieldset = this.add({
|
||||
xtype: 'fieldset',
|
||||
border: false,
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 110,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
}
|
||||
});
|
||||
|
||||
om.bind('remote_username', fieldset.add({
|
||||
xtype: 'textfield',
|
||||
name: 'remote_username',
|
||||
fieldLabel: 'Remote username'
|
||||
fieldLabel: 'Remote control username'
|
||||
}));
|
||||
|
||||
|
||||
om.bind('remote_password', fieldset.add({
|
||||
name: 'remote_password',
|
||||
xtype: 'textfield',
|
||||
inputType: 'password',
|
||||
fieldLabel: 'Remote password'
|
||||
name: 'remote_password',
|
||||
fieldLabel: 'Remote control password'
|
||||
}));
|
||||
|
||||
fieldset.add({
|
||||
xtype: 'textfield',
|
||||
id: 'remote_url',
|
||||
name: 'remote_url',
|
||||
readOnly: true,
|
||||
fieldLabel: 'Remote control url'
|
||||
});
|
||||
|
||||
fieldset = this.add({
|
||||
xtype: 'fieldset',
|
||||
border: false,
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 1,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
}
|
||||
});
|
||||
|
||||
om.bind('use_stream_urls', fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'use_stream_urls',
|
||||
boxLabel: 'Use stream urls',
|
||||
style: 'margin-left: 12px;'
|
||||
}));
|
||||
|
||||
om.bind('auto_open_stream_urls', fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'auto_open_stream_urls',
|
||||
boxLabel: 'Auto-open stream urls',
|
||||
style: 'margin-left: 12px;'
|
||||
}));
|
||||
},
|
||||
|
||||
onApply: function() {
|
||||
|
||||
var changed = this.optionsManager.getDirty();
|
||||
for (var key in this._fields) {
|
||||
if (this._fields.hasOwnProperty(key)) {
|
||||
var v = this._fields[key];
|
||||
if (v.checked) {
|
||||
changed[v.name] = v.inputValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Ext.isObjectEmpty(changed)) {
|
||||
deluge.client.streaming.set_config(changed, {
|
||||
success: this.onSetConfig,
|
||||
scope: this
|
||||
});
|
||||
|
||||
|
||||
for (var key in deluge.config) {
|
||||
deluge.config[key] = this.optionsManager.get(key);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onSetConfig: function() {
|
||||
|
||||
onSetConfig: function(result) {
|
||||
this.optionsManager.commit();
|
||||
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);
|
||||
}
|
||||
}
|
||||
this.updateRemoteUrl(this.optionsManager);
|
||||
},
|
||||
|
||||
|
||||
onGotConfig: function(config) {
|
||||
this.optionsManager.set(config);
|
||||
this.updateRemoteUrl(this.optionsManager);
|
||||
},
|
||||
|
||||
|
||||
onPageShow: function() {
|
||||
deluge.client.streaming.get_config({
|
||||
success: this.onGotConfig,
|
||||
scope: this
|
||||
})
|
||||
},
|
||||
|
||||
updateRemoteUrl: function(optionsManager) {
|
||||
var apiUrl = 'http';
|
||||
if (optionsManager.get('use_ssl'))
|
||||
apiUrl += 's';
|
||||
apiUrl += '://' + optionsManager.get('ip') + ':' + optionsManager.get('port') + '/streaming/stream';
|
||||
Ext.getCmp('remote_url').setValue(apiUrl);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -127,7 +318,7 @@ StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
||||
|
||||
onDisable: function() {
|
||||
deluge.menus.filePriorities.remove('streamthis');
|
||||
|
||||
|
||||
deluge.preferences.selectPage(_('Plugins'));
|
||||
deluge.preferences.removePage(this.prefsPage);
|
||||
this.prefsPage.destroy();
|
||||
@@ -136,8 +327,30 @@ StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
||||
onEnable: function() {
|
||||
this.prefsPage = new PreferencePage();
|
||||
deluge.preferences.addPage(this.prefsPage);
|
||||
|
||||
|
||||
console.log('Streaming plugin loaded');
|
||||
var doStream = function (tid, fileIndex) {
|
||||
deluge.client.streaming.stream_torrent(tid, null, null, fileIndex, true, {
|
||||
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);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
deluge.menus.filePriorities.addMenuItem({
|
||||
id: 'streamthis',
|
||||
text: 'Stream this file',
|
||||
@@ -150,20 +363,26 @@ StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
||||
var fileIndex = nodes[0].attributes.fileIndex;
|
||||
var tid = files.torrentId;
|
||||
if (fileIndex >= 0) {
|
||||
deluge.client.streaming.stream_torrent(tid, fileIndex, {
|
||||
success: function (result) {
|
||||
if (result.status == 'success') {
|
||||
Ext.Msg.alert('Stream ready', 'URL for stream: <a target="_blank" href="' + result.url + '">' + result.url + '</a>');
|
||||
} else {
|
||||
Ext.Msg.alert('Stream failed', 'Error message: ' + result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
doStream(tid, fileIndex);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Deluge.registerPlugin('Streaming', StreamingPlugin);
|
||||
@@ -12,7 +12,12 @@ class NoRangeStaticProducer(static.NoRangeStaticProducer):
|
||||
def resumeProducing(self):
|
||||
if not self.request:
|
||||
return
|
||||
|
||||
data = yield defer.maybeDeferred(self.fileObject.read, self.bufferSize)
|
||||
|
||||
if not self.request:
|
||||
return
|
||||
|
||||
if data:
|
||||
# this .write will spin the reactor, calling .doWrite and then
|
||||
# .resumeProducing again, so be prepared for a re-entrant call
|
||||
@@ -27,13 +32,19 @@ class SingleRangeStaticProducer(static.SingleRangeStaticProducer):
|
||||
def resumeProducing(self):
|
||||
if not self.request:
|
||||
return
|
||||
|
||||
data = yield defer.maybeDeferred(self.fileObject.read,
|
||||
min(self.bufferSize, self.size - self.bytesWritten))
|
||||
|
||||
if not self.request:
|
||||
return
|
||||
|
||||
if data:
|
||||
self.bytesWritten += len(data)
|
||||
# this .write will spin the reactor, calling .doWrite and then
|
||||
# .resumeProducing again, so be prepared for a re-entrant call
|
||||
self.request.write(data)
|
||||
|
||||
if self.request and self.bytesWritten == self.size:
|
||||
self.request.unregisterProducer()
|
||||
self.request.finish()
|
||||
@@ -44,6 +55,7 @@ class MultipleRangeStaticProducer(static.MultipleRangeStaticProducer):
|
||||
def resumeProducing(self):
|
||||
if not self.request:
|
||||
return
|
||||
|
||||
data = []
|
||||
dataLength = 0
|
||||
done = False
|
||||
@@ -64,10 +76,16 @@ class MultipleRangeStaticProducer(static.MultipleRangeStaticProducer):
|
||||
except StopIteration:
|
||||
done = True
|
||||
break
|
||||
|
||||
if not self.request:
|
||||
return
|
||||
|
||||
self.request.write(''.join(data))
|
||||
|
||||
if done:
|
||||
self.request.unregisterProducer()
|
||||
self.request.finish()
|
||||
self.stopProducing()
|
||||
self.request = None
|
||||
|
||||
class FilelikeObjectResource(static.File):
|
||||
@@ -141,6 +159,7 @@ class FilelikeObjectResource(static.File):
|
||||
producer = self.makeProducer(request, self.fileObject)
|
||||
|
||||
if request.method == 'HEAD':
|
||||
self.fileObject.close()
|
||||
return ''
|
||||
|
||||
producer.start()
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
import json
|
||||
import gtk
|
||||
import webbrowser
|
||||
|
||||
from deluge.log import LOG as log
|
||||
from deluge.ui.client import client
|
||||
@@ -46,8 +48,41 @@ from deluge.plugins.pluginbase import GtkPluginBase
|
||||
import deluge.component as component
|
||||
import deluge.common
|
||||
|
||||
from twisted.internet import reactor, defer, threads
|
||||
from twisted.web import server, resource
|
||||
|
||||
from common import get_resource
|
||||
|
||||
class LocalAddResource(resource.Resource):
|
||||
gtkui = None
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, gtkui):
|
||||
self.gtkui = gtkui
|
||||
resource.Resource.__init__(self)
|
||||
|
||||
def render_GET(self, request):
|
||||
useragent = request.getHeader('User-Agent')
|
||||
if 'Deluge-Streamer' not in useragent:
|
||||
request.setResponseCode(401)
|
||||
return 'Unauthorized'
|
||||
|
||||
torrent_url = request.args.get('url', None)
|
||||
if not torrent_url:
|
||||
return json.dumps({'status': 'error', 'message': 'missing url in request'})
|
||||
|
||||
torrent_file = request.args.get('file', None)
|
||||
if torrent_file:
|
||||
torrent_file = torrent_file[0]
|
||||
|
||||
infohash = request.args.get('infohash', None)
|
||||
if infohash:
|
||||
infohash = infohash[0]
|
||||
|
||||
client.streaming.stream_torrent(url=torrent_url[0], infohash=infohash, filepath_or_index=torrent_file).addCallback(self.gtkui.stream_ready)
|
||||
|
||||
return json.dumps({'status': 'ok', 'message': 'queued'})
|
||||
|
||||
class GtkUI(GtkPluginBase):
|
||||
def enable(self):
|
||||
self.glade = gtk.glade.XML(get_resource("config.glade"))
|
||||
@@ -55,41 +90,94 @@ class GtkUI(GtkPluginBase):
|
||||
component.get("Preferences").add_page("Streaming", self.glade.get_widget("prefs_box"))
|
||||
component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
|
||||
component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
|
||||
|
||||
|
||||
file_menu = component.get("MainWindow").main_glade.get_widget('menu_file_tab')
|
||||
|
||||
|
||||
self.sep = gtk.SeparatorMenuItem()
|
||||
self.item = gtk.MenuItem(_("_Stream this file"))
|
||||
self.item.connect("activate", self.on_menuitem_stream)
|
||||
|
||||
|
||||
file_menu.append(self.sep)
|
||||
file_menu.append(self.item)
|
||||
|
||||
self.sep.show()
|
||||
self.item.show()
|
||||
|
||||
torrentmenu = component.get("MenuBar").torrentmenu
|
||||
|
||||
self.sep_torrentmenu = gtk.SeparatorMenuItem()
|
||||
self.item_torrentmenu = gtk.MenuItem(_("_Stream this torrent"))
|
||||
self.item_torrentmenu.connect("activate", self.on_torrentmenu_menuitem_stream)
|
||||
|
||||
torrentmenu.append(self.sep_torrentmenu)
|
||||
torrentmenu.append(self.item_torrentmenu)
|
||||
|
||||
self.sep_torrentmenu.show()
|
||||
self.item_torrentmenu.show()
|
||||
|
||||
self.resource = LocalAddResource(self)
|
||||
self.site = server.Site(self.resource)
|
||||
self.listening = reactor.listenTCP(40747, self.site, interface='127.0.0.1')
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def disable(self):
|
||||
component.get("Preferences").remove_page("Streaming")
|
||||
component.get("PluginManager").deregister_hook("on_apply_prefs", self.on_apply_prefs)
|
||||
component.get("PluginManager").deregister_hook("on_show_prefs", self.on_show_prefs)
|
||||
|
||||
|
||||
file_menu = component.get("MainWindow").main_glade.get_widget('menu_file_tab')
|
||||
|
||||
file_menu.remove(self.item)
|
||||
file_menu.remove(self.sep)
|
||||
|
||||
torrentmenu = component.get("MenuBar").torrentmenu
|
||||
|
||||
torrentmenu.remove(self.item_torrentmenu)
|
||||
torrentmenu.remove(self.sep_torrentmenu)
|
||||
|
||||
self.site.stopFactory()
|
||||
yield self.listening.stopListening()
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def on_apply_prefs(self):
|
||||
log.debug("applying prefs for Streaming")
|
||||
|
||||
if self.glade.get_widget("input_serve_standalone").get_active():
|
||||
serve_method = 'standalone'
|
||||
elif self.glade.get_widget("input_serve_webui").get_active():
|
||||
serve_method = 'webui'
|
||||
|
||||
if self.glade.get_widget("input_ssl_cert_daemon").get_active():
|
||||
ssl_source = 'daemon'
|
||||
elif self.glade.get_widget("input_ssl_cert_custom").get_active():
|
||||
ssl_source = 'custom'
|
||||
|
||||
config = {
|
||||
"ip": self.glade.get_widget("input_ip").get_text(),
|
||||
"port": int(self.glade.get_widget("input_port").get_text()),
|
||||
"use_stream_urls": self.glade.get_widget("input_use_stream_urls").get_active(),
|
||||
"auto_open_stream_urls": self.glade.get_widget("input_auto_open_stream_urls").get_active(),
|
||||
"allow_remote": self.glade.get_widget("input_allow_remote").get_active(),
|
||||
"reset_complete": self.glade.get_widget("input_reset_complete").get_active(),
|
||||
"download_only_streamed": self.glade.get_widget("input_download_only_streamed").get_active(),
|
||||
"use_ssl": self.glade.get_widget("input_use_ssl").get_active(),
|
||||
"remote_username": self.glade.get_widget("input_remote_username").get_text(),
|
||||
"remote_password": self.glade.get_widget("input_remote_password").get_text(),
|
||||
"ssl_priv_key_path": self.glade.get_widget("input_ssl_priv_key_path").get_text(),
|
||||
"ssl_cert_path": self.glade.get_widget("input_ssl_cert_path").get_text(),
|
||||
"serve_method": serve_method,
|
||||
"ssl_source": ssl_source,
|
||||
}
|
||||
|
||||
client.streaming.set_config(config)
|
||||
|
||||
result = yield client.streaming.set_config(config)
|
||||
|
||||
if result:
|
||||
message_type, message_class, message = result
|
||||
if message_type == 'error':
|
||||
topic = 'Unknown error type'
|
||||
if message_class == 'ssl':
|
||||
topic = 'SSL Failed'
|
||||
|
||||
dialogs.ErrorDialog(topic, message).run()
|
||||
|
||||
def on_show_prefs(self):
|
||||
client.streaming.get_config().addCallback(self.cb_get_config)
|
||||
@@ -98,28 +186,53 @@ class GtkUI(GtkPluginBase):
|
||||
"callback for on show_prefs"
|
||||
self.glade.get_widget("input_ip").set_text(config["ip"])
|
||||
self.glade.get_widget("input_port").set_text(str(config["port"]))
|
||||
self.glade.get_widget("input_use_stream_urls").set_active(config["use_stream_urls"])
|
||||
self.glade.get_widget("input_auto_open_stream_urls").set_active(config["auto_open_stream_urls"])
|
||||
self.glade.get_widget("input_allow_remote").set_active(config["allow_remote"])
|
||||
self.glade.get_widget("input_reset_complete").set_active(config["reset_complete"])
|
||||
self.glade.get_widget("input_use_ssl").set_active(config["use_ssl"])
|
||||
self.glade.get_widget("input_download_only_streamed").set_active(config["download_only_streamed"])
|
||||
self.glade.get_widget("input_remote_username").set_text(config["remote_username"])
|
||||
self.glade.get_widget("input_remote_password").set_text(config["remote_password"])
|
||||
self.glade.get_widget("input_ssl_priv_key_path").set_text(config["ssl_priv_key_path"])
|
||||
self.glade.get_widget("input_ssl_cert_path").set_text(config["ssl_cert_path"])
|
||||
|
||||
self.glade.get_widget("input_serve_standalone").set_active(config["serve_method"] == "standalone")
|
||||
self.glade.get_widget("input_serve_webui").set_active(config["serve_method"] == "webui")
|
||||
|
||||
self.glade.get_widget("input_ssl_cert_daemon").set_active(config["ssl_source"] == "daemon")
|
||||
self.glade.get_widget("input_ssl_cert_custom").set_active(config["ssl_source"] == "custom")
|
||||
|
||||
api_url = 'http%s://%s:%s/streaming/stream' % (('s' if config["use_ssl"] else ''), config["ip"], config["port"])
|
||||
self.glade.get_widget("output_remote_url").set_text(api_url)
|
||||
|
||||
def stream_ready(self, result):
|
||||
if result['status'] == 'success':
|
||||
if result.get('use_stream_urls', False):
|
||||
url = "stream+%s" % result['url']
|
||||
if result.get('auto_open_stream_urls', False):
|
||||
threads.deferToThread(webbrowser.open, url)
|
||||
else:
|
||||
dialogs.InformationDialog('Stream ready', '<a href="%s">Click here to open it</a>' % url).run()
|
||||
else:
|
||||
dialogs.ErrorDialog('Stream ready', 'Copy the link into a media player', details=result['url']).run()
|
||||
else:
|
||||
dialogs.ErrorDialog('Stream failed', 'Was unable to prepare the stream', details=result).run()
|
||||
|
||||
def on_menuitem_stream(self, data=None):
|
||||
torrent_id = component.get("TorrentView").get_selected_torrents()[0]
|
||||
|
||||
|
||||
ft = component.get("TorrentDetails").tabs['Files']
|
||||
paths = ft.listview.get_selection().get_selected_rows()[1]
|
||||
|
||||
|
||||
selected = []
|
||||
for path in paths:
|
||||
selected.append(ft.treestore.get_iter(path))
|
||||
|
||||
def stream_ready(result):
|
||||
if result['status'] == 'success':
|
||||
dialogs.ErrorDialog('Stream ready', 'Copy the link into a media player', details=result['url']).run()
|
||||
else:
|
||||
dialogs.ErrorDialog('Stream failed', 'Was unable to prepare the stream', details=result).run()
|
||||
|
||||
|
||||
for select in selected:
|
||||
path = ft.get_file_path(select)
|
||||
client.streaming.stream_torrent(torrent_id, path).addCallback(stream_ready)
|
||||
break
|
||||
client.streaming.stream_torrent(infohash=torrent_id, filepath_or_index=path, includes_name=True).addCallback(self.stream_ready)
|
||||
break
|
||||
|
||||
def on_torrentmenu_menuitem_stream(self, data=None):
|
||||
torrent_id = component.get("TorrentView").get_selected_torrents()[0]
|
||||
client.streaming.stream_torrent(infohash=torrent_id).addCallback(self.stream_ready)
|
||||
|
||||
Reference in New Issue
Block a user