34 Commits
0.3.1 ... 0.8.0

Author SHA1 Message Date
JohnDoee
1da0e6cfb2 Merge branch 'release/0.8.0' 2017-08-12 13:27:50 +02:00
JohnDoee
e494dad9bf better remote control 2017-08-12 13:27:32 +02:00
JohnDoee
d0d43b8c66 Merge tag '0.7.1' into develop
SSL Support
2016-09-07 20:05:50 +02:00
JohnDoee
5228870bec Merge branch 'release/0.7.1' 2016-09-07 20:05:41 +02:00
JohnDoee
a5d44a536a Added support for SSL fixing #10, Made it more clear how partial download works, fixing #6 2016-09-07 20:00:49 +02:00
JohnDoee
28aa99750a Merge tag '0.7.0' into develop
Simpler streaming support and trying to prevent end of the line problems
2016-08-21 20:04:03 +02:00
JohnDoee
8e97331c2c Merge branch 'release/0.7.0' 2016-08-21 20:03:33 +02:00
JohnDoee
67ff10b144 better streaming 2016-08-21 20:03:19 +02:00
JohnDoee
21fd98dfea Merge tag '0.6.1' into develop
fixed changelog
2016-06-24 20:49:41 +02:00
JohnDoee
1cf05ed46c Merge branch 'release/0.6.1' 2016-06-24 20:49:35 +02:00
JohnDoee
49c4733a1e bumped version and fixed changelog 2016-06-24 20:49:12 +02:00
JohnDoee
a29a69ba11 Merge tag '0.6.0' into develop
small bugfixes
2016-06-24 20:42:53 +02:00
JohnDoee
0bd7b8d40d Merge branch 'release/0.6.0' 2016-06-24 20:42:46 +02:00
JohnDoee
6b2817ce5e bumped version and updated changelog 2016-06-24 20:42:39 +02:00
JohnDoee
0cc8ed4280 improved algorithm a little, changed default to not use streaming url 2016-06-24 20:31:21 +02:00
JohnDoee
636bd0edc2 fixed small bug with file releasing 2015-12-08 19:35:41 +01:00
JohnDoee
6bc72dbc44 Problem with filename encoding 2015-11-22 16:21:10 +01:00
JohnDoee
c85c5763d6 Listening to 0.0.0.0 instead of 127.0.0.1 when attempted address is not local 2015-11-22 16:20:58 +01:00
JohnDoee
bcc2067e55 Proper handling of name / not name in requested file 2015-11-22 16:20:37 +01:00
JohnDoee
1d31efa48c fixed small bug with unloading 2015-11-21 20:29:42 +01:00
JohnDoee
5859a19e0e Merge tag '0.5.0' into develop
Partial rewrite
2015-11-21 19:25:59 +01:00
JohnDoee
4290a0b821 Merge branch 'release/0.5.0' 2015-11-21 19:25:54 +01:00
JohnDoee
634219f0f8 added support for direct torrent streaming 2015-11-21 19:05:01 +01:00
JohnDoee
342b9f77a4 fixed bug related to path streaming 2015-11-18 11:40:11 +01:00
JohnDoee
8f03e719fa restructured plugin 2015-11-17 22:41:14 +01:00
JohnDoee
8c010abe16 Merge tag '0.4.1' into develop
Fixed old Deluge bug
2015-07-19 21:37:53 +02:00
JohnDoee
e92f9029a4 Merge branch 'release/0.4.1' 2015-07-19 21:37:44 +02:00
JohnDoee
a483bfe599 updated readme and bumped version 2015-07-19 21:37:34 +02:00
JohnDoee
f3ee7f4270 fixed bug with old deluge version 2015-07-19 21:34:01 +02:00
JohnDoee
91e8da6dfd Merge tag '0.4.0' into develop
WebUI support
2015-07-19 19:21:23 +02:00
JohnDoee
2e4b166528 Merge branch 'release/0.4.0' 2015-07-19 19:21:19 +02:00
JohnDoee
aaf70bbfc8 Updated Readme and bumped version 2015-07-19 19:21:09 +02:00
JohnDoee
52661abf52 Tried to improve scheduling algorithm and added WebUI support as requested in #2 2015-07-19 19:18:59 +02:00
JohnDoee
a9dae5bc90 Added download instructions to readme 2015-06-18 21:23:54 +02:00
8 changed files with 1788 additions and 617 deletions

View File

@@ -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
@@ -11,6 +11,11 @@ the user to stream a file using HTTP.
Technically, it tries to download the part of a file the user requests and
downloads ahead, this enables seeking in video files.
## Where to download
You can download this release on Github. Look for the "releases" tab on the repository page.
Under that tab, eggs for Python 2.6 and 2.7 should exist.
## How to use
* Install plugin
@@ -18,7 +23,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.
@@ -30,14 +34,38 @@ 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 support for the WebUI
* There are a few situations where an uncaught exception is thrown.
* Add feedback when preparing stream.
# Version Info
## 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
## Version 0.3
* Fixed bug when streaming multiple files.
* Changed to try to prioritize end pieces more aggressively to not leave them hanging.
@@ -48,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

View File

@@ -42,7 +42,7 @@ from setuptools import setup
__plugin_name__ = "Streaming"
__author__ = "John Doee"
__author_email__ = "johndoee@tidalstream.org"
__version__ = "0.3.1"
__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."""

File diff suppressed because it is too large Load Diff

View File

@@ -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">&lt;b&gt;Settings&lt;/b&gt;</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">&lt;b&gt;File Serving Settings&lt;/b&gt;</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">&lt;b&gt;Advanced Settings&lt;/b&gt;</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>

View File

@@ -31,20 +31,358 @@ Copyright:
statement from all source files in the program, then also delete it here.
*/
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: '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,
defaultType: 'textfield',
defaults: {
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,
}));
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: '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',
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 control username'
}));
om.bind('remote_password', fieldset.add({
xtype: 'textfield',
inputType: '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(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);
}
});
StreamingPlugin = Ext.extend(Deluge.Plugin, {
constructor: function(config) {
config = Ext.apply({
name: "Streaming"
}, config);
StreamingPlugin.superclass.constructor.call(this, config);
},
'name': 'Streaming',
onDisable: function() {
deluge.menus.filePriorities.remove('streamthis');
deluge.preferences.selectPage(_('Plugins'));
deluge.preferences.removePage(this.prefsPage);
this.prefsPage.destroy();
},
onEnable: function() {
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',
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) {
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;
}
});
}
});
new StreamingPlugin();
Deluge.registerPlugin('Streaming', StreamingPlugin);

View File

@@ -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()

View File

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

View File

@@ -46,10 +46,4 @@ from common import get_resource
class WebUI(WebPluginBase):
scripts = [get_resource("streaming.js")]
def enable(self):
pass
def disable(self):
pass
scripts = [get_resource("streaming.js")]