Skip to content

Commit 6846f4f

Browse files
author
Anders Jensen
committed
Merge branch 'release/0.11.0'
2 parents fae5c77 + b8183d0 commit 6846f4f

16 files changed

Lines changed: 1101 additions & 57 deletions

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ _trial_temp
2424
*.komodoproject
2525
docs/_build*
2626
.env*
27-
27+
EGG-INFO
2828

2929
# for bundling
3030
thomas
3131
six.py
3232
rarfile.py
3333
rfc6266.py
3434
lepl
35-
pytz
35+
pytz

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Streaming Plugin
22
https://github.com/JohnDoee/deluge-streaming
33

4-
(c)2016 by Anders Jensen <johndoee@tidalstream.org>
4+
(c)2019 by Anders Jensen <johndoee@tidalstream.org>
55

66
## Description
77

@@ -48,6 +48,13 @@ The _allow remote_ option is to allow remote add and stream of torrents.
4848
* [ ] Better feedback when using API
4949
* [ ] Fix problems when removing torrent from Deluge (sea of errors)
5050

51+
# Important Deluge 2 information
52+
53+
While developing the Deluge 2 version of this plugin I hit a few problems that might be visible for you too.
54+
55+
* When shutting down Deluge an exception / error happens every time, this bug is reported.
56+
* Sometimes the Web UI does not load plugins correctly, try restarting Deluge and refresh your browser if this happens.
57+
5158
# HTTP API Usage
5259

5360
## Prerequisite
@@ -100,6 +107,11 @@ List of URL GET Arguments
100107

101108
# Version Info
102109

110+
## Version 0.11.0
111+
* Initial support for Deluge 2 / Python 3
112+
* Added support for aggressive piece prioritization when it should not be necessary.
113+
* Fixed bug related to paused torrent with no data downloaded.
114+
103115
## Version 0.10.5
104116
* Added support for serving files inline
105117

create-egg.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

create-egg2.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
virtualenv .env-egg2
2+
.env-egg2/bin/pip install -U thomas
3+
ln -s .env-egg2/lib/python*/site-packages/thomas .
4+
ln -s .env-egg2/lib/python*/site-packages/rarfile.py .
5+
ln -s .env-egg2/lib/python*/site-packages/six.py .
6+
ln -s .env-egg2/lib/python*/site-packages/rfc6266.py .
7+
ln -s .env-egg2/lib/python*/site-packages/lepl .
8+
ln -s .env-egg2/lib/python*/site-packages/pytz .
9+
.env-egg2/bin/python setup.py bdist_egg

create-egg3.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
python3 -m venv .env-egg3
2+
.env-egg3/bin/pip install -U thomas
3+
ln -s .env-egg3/lib/python*/site-packages/thomas .
4+
ln -s .env-egg3/lib/python*/site-packages/rarfile.py .
5+
ln -s .env-egg3/lib/python*/site-packages/six.py .
6+
ln -s .env-egg3/lib/python*/site-packages/rfc6266.py .
7+
ln -s .env-egg3/lib/python*/site-packages/lepl .
8+
ln -s .env-egg3/lib/python*/site-packages/pytz .
9+
.env-egg3/bin/python setup.py bdist_egg

examples/http-api/streamtorrent.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import argparse
2+
13
import requests
24

35
class FailedToStreamException(Exception):
@@ -44,6 +46,8 @@ def stream_torrent(remote_control_url, infohash=None, path=None, wait_for_end_pi
4446
data = r.json()
4547
if data['status'] == 'success':
4648
return data['url']
49+
else:
50+
raise FailedToStreamException('Request failed: %r' % (data, ))
4751

4852
if torrent_body:
4953
r = requests.post(url, auth=(username, password), params=params, data=torrent_body)
@@ -53,5 +57,40 @@ def stream_torrent(remote_control_url, infohash=None, path=None, wait_for_end_pi
5357
data = r.json()
5458
if data['status'] == 'success':
5559
return data['url']
60+
else:
61+
raise FailedToStreamException('Request failed: %r' % (data, ))
5662

5763
raise FailedToStreamException('Streaming was never successful')
64+
65+
66+
if __name__ == '__main__':
67+
parser = argparse.ArgumentParser(description="Stream some torrents")
68+
parser.add_argument('url', help="Full API Url including auth info")
69+
parser.add_argument('--infohash', nargs='?', help="Infohash of torrent to stream")
70+
parser.add_argument('--path', nargs='?', help="Path to file within the torrent to stream")
71+
parser.add_argument('--label', nargs='?', help="Label to add the torrent with")
72+
parser.add_argument('--torrent', nargs='?', help="Path to the torrent to stream", type=argparse.FileType(mode='rb'))
73+
parser.add_argument('--skip_wait_for_end_pieces', help="Wait until client downloaded the first and last piece of the torrent", action='store_false')
74+
75+
76+
args = parser.parse_args()
77+
78+
kwargs = {
79+
'remote_control_url': args.url,
80+
'wait_for_end_pieces': args.skip_wait_for_end_pieces
81+
}
82+
83+
if args.infohash:
84+
kwargs['infohash'] = args.infohash
85+
86+
if args.path:
87+
kwargs['path'] = args.path
88+
89+
if args.label:
90+
kwargs['label'] = args.label
91+
92+
if args.torrent:
93+
kwargs['torrent_body'] = args.torrent.read()
94+
95+
result = stream_torrent(**kwargs)
96+
print('URL %s' % (result, ))

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
__plugin_name__ = "Streaming"
4343
__author__ = "Anders Jensen"
4444
__author_email__ = "johndoee@tidalstream.org"
45-
__version__ = "0.10.5"
45+
__version__ = "0.11.0"
4646
__url__ = "https://github.com/JohnDoee/deluge-streaming"
4747
__license__ = "GPLv3"
4848
__description__ = "Enables streaming of files while downloading them."
@@ -71,7 +71,6 @@
7171
]
7272

7373
REQUIREMENTS_MODULES = [
74-
'six',
7574
'rarfile',
7675
'rfc6266',
7776
]
@@ -96,7 +95,9 @@
9695
%s = %s:CorePlugin
9796
[deluge.plugin.gtkui]
9897
%s = %s:GtkUIPlugin
98+
[deluge.plugin.gtk3ui]
99+
%s = %s:Gtk3UIPlugin
99100
[deluge.plugin.web]
100101
%s = %s:WebUIPlugin
101-
""" % ((__plugin_name__, __plugin_name__.lower())*3)
102+
""" % ((__plugin_name__, __plugin_name__.lower())*4)
102103
)

streaming/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,27 @@
4242

4343
class CorePlugin(PluginInitBase):
4444
def __init__(self, plugin_name):
45-
from core import Core as _plugin_cls
45+
from .core import Core as _plugin_cls
4646
self._plugin_cls = _plugin_cls
4747
super(CorePlugin, self).__init__(plugin_name)
4848

4949

5050
class GtkUIPlugin(PluginInitBase):
5151
def __init__(self, plugin_name):
52-
from gtkui import GtkUI as _plugin_cls
52+
from .gtkui import GtkUI as _plugin_cls
5353
self._plugin_cls = _plugin_cls
5454
super(GtkUIPlugin, self).__init__(plugin_name)
5555

5656

57+
class Gtk3UIPlugin(PluginInitBase):
58+
def __init__(self, plugin_name):
59+
from .gtk3ui import Gtk3UI as PluginClass
60+
self._plugin_cls = PluginClass
61+
super(Gtk3UIPlugin, self).__init__(plugin_name)
62+
63+
5764
class WebUIPlugin(PluginInitBase):
5865
def __init__(self, plugin_name):
59-
from webui import WebUI as _plugin_cls
66+
from .webui import WebUI as _plugin_cls
6067
self._plugin_cls = _plugin_cls
6168
super(WebUIPlugin, self).__init__(plugin_name)

0 commit comments

Comments
 (0)