mirror of
https://github.com/JohnDoee/deluge-streaming/
synced 2026-07-02 16:01:17 -07:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30340a25a2 | ||
|
|
287efadb3e | ||
|
|
d6e7fc83b8 | ||
|
|
b159bc2be5 | ||
|
|
e8f24b34bb | ||
|
|
a7fff07379 | ||
|
|
6846f4fc52 | ||
|
|
b8183d01dd | ||
|
|
da05a6de1b | ||
|
|
d058d1d914 | ||
|
|
934048dd46 | ||
|
|
fae5c777fc | ||
|
|
490a083b6e | ||
|
|
c314e9381b | ||
|
|
fb739cedbe | ||
|
|
8ab94d22b9 | ||
|
|
4b1d3799b5 | ||
|
|
1398e5042b | ||
|
|
de54ed067a | ||
|
|
7cfdfc79fe | ||
|
|
0c88dfd2e1 | ||
|
|
706c0f71d3 | ||
|
|
d90549e60a | ||
|
|
9c4c6f5db2 | ||
|
|
a20e623223 | ||
|
|
119cac1a56 | ||
|
|
86c6b0db00 | ||
|
|
73ddeb021c | ||
|
|
21f1d77568 | ||
|
|
015a7cbc7a | ||
|
|
3417b109ec | ||
|
|
3a3c90ed8b | ||
|
|
bfe0f9f49c | ||
|
|
9e38de34f2 | ||
|
|
ec02a2e61d | ||
|
|
0e63ed4ebc | ||
|
|
ba6c689d98 | ||
|
|
ce7f6efd6d | ||
|
|
7aed811b78 | ||
|
|
37753a23e4 | ||
|
|
cdf2a5515a | ||
|
|
14c23065b5 | ||
|
|
3af5c420f8 | ||
|
|
cc13b032ea |
15
.gitignore
vendored
15
.gitignore
vendored
@@ -23,8 +23,13 @@ dropin.cache
|
||||
_trial_temp
|
||||
*.komodoproject
|
||||
docs/_build*
|
||||
apiserver/metadata/imdbhandler.py
|
||||
apiserver/metadata/malhandler.py
|
||||
apiserver/services/search.py
|
||||
apiserver/services/control.py
|
||||
apiserver/services/files.py
|
||||
.env*
|
||||
EGG-INFO
|
||||
|
||||
# for bundling
|
||||
thomas
|
||||
six.py
|
||||
rarfile.py
|
||||
rfc6266.py
|
||||
lepl
|
||||
pytz
|
||||
|
||||
105
README.md
105
README.md
@@ -1,7 +1,7 @@
|
||||
# Streaming Plugin
|
||||
https://github.com/JohnDoee/deluge-streaming
|
||||
|
||||
(c)2016 by Anders Jensen <johndoee@tidalstream.org>
|
||||
(c)2020 by Anders Jensen <johndoee@tridentstream.org>
|
||||
|
||||
## Description
|
||||
|
||||
@@ -38,12 +38,113 @@ By using a small tool it is possible to it's possible to open streams directly i
|
||||
## Motivation
|
||||
|
||||
The plugin is not meant to be used as a right-click to stream thing. The idea is to
|
||||
make Deluge an abstraction layer for the [TidalStream](http://www.tidalstream.org/) project, i.e. torrents to http on demand.
|
||||
make Deluge an abstraction layer for the [Tidalstream](http://www.tidalstream.org/) project, i.e. torrents to http on demand.
|
||||
|
||||
The _allow remote_ option is to allow remote add and stream of torrents.
|
||||
|
||||
## Todo
|
||||
|
||||
* [ ] Better feedback in interface about streams
|
||||
* [ ] Better feedback when using API
|
||||
* [ ] Fix problems when removing torrent from Deluge (sea of errors)
|
||||
|
||||
# Important Deluge 2 information
|
||||
|
||||
While developing the Deluge 2 version of this plugin I hit a few problems that might be visible for you too.
|
||||
|
||||
* When shutting down Deluge an exception / error happens every time, this bug is reported.
|
||||
* Sometimes the Web UI does not load plugins correctly, try restarting Deluge and refresh your browser if this happens.
|
||||
|
||||
# HTTP API Usage
|
||||
|
||||
## Prerequisite
|
||||
|
||||
Install and enable the plugin. Afterwards, head into Streaming settings and enable "Allow remote control".
|
||||
The URL found in the "Remote control url" field is where the API can be reached. The auth used is Basic Auth.
|
||||
|
||||
## Usage
|
||||
|
||||
There is only one end-point and that is where a torrent stream can be requested.
|
||||
|
||||
Both return the same responses and all responses are JSON encoded.
|
||||
All successfully authenticated responses have status code 200.
|
||||
|
||||
## POST /streaming/stream
|
||||
|
||||
POST body must be the raw torrent you want to stream. No form formatting or anything can be used.
|
||||
|
||||
List of URL GET Arguments
|
||||
|
||||
* **path**: Path inside the torrent file to either a folder or a file you want to stream. The plugin will try to guess the best one. **Optional**. **Default**: '' (i.e. find the best file in the whole torrent)
|
||||
* **infohash**: Infohash of the torrent you want to stream, can make it a bit faster as it can avoid reading POST body. **Optional**.
|
||||
* **label**: If label plugin is enabled and the torrent is actually added then give the torrent this label. **Optional**. **Default**: ''
|
||||
* **wait_for_end_pieces**: Wait for the first and last piece in the streamed file to be fully downloaded. Can be necessary for some video players. It also enforces that the torrent can be actually downloaded. If the key exist with any (even empty) value, the feature is enabled. **Optional**. **Default**: false
|
||||
|
||||
## GET /streaming/stream
|
||||
|
||||
* **infohash**: Does the same as when POSTed. **Mandatory**.
|
||||
* **path**: Does the same as when POSTed. **Optional**.
|
||||
* **wait_for_end_pieces**: Does the same as when POSTed. **Optional**.
|
||||
|
||||
## Success Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success", # Always equals this
|
||||
"filename" "horse.mkv", # Filename of the streamed torrent
|
||||
"url": "http://example.com/" # URL where the file can be reached by e.g. a media player
|
||||
}
|
||||
```
|
||||
|
||||
## Error Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "error", # Always equals this
|
||||
"message" "Torrent failed" # description for why it failed
|
||||
}
|
||||
```
|
||||
|
||||
# Version Info
|
||||
|
||||
## Version 0.12.0
|
||||
|
||||
* Fixed small breaking bug
|
||||
|
||||
## Version 0.12.0
|
||||
|
||||
* Moved to reading pieces through Deluge to avoid unflushed data
|
||||
* Fixed Deluge 2 / libtorrent related bug
|
||||
|
||||
## Version 0.11.0
|
||||
* Initial support for Deluge 2 / Python 3
|
||||
* Added support for aggressive piece prioritization when it should not be necessary.
|
||||
* Fixed bug related to paused torrent with no data downloaded.
|
||||
|
||||
## Version 0.10.5
|
||||
* Added support for serving files inline
|
||||
|
||||
## Version 0.10.4
|
||||
* Trying to set max priority less as it destroys performance
|
||||
|
||||
## Version 0.10.3
|
||||
* Added label support
|
||||
* Reverse proxy config / replace URL config
|
||||
* Ensure internal Deluge state is updated before trying to use it
|
||||
|
||||
## Version 0.10.2
|
||||
* Busting cache when waiting for piece
|
||||
* Math error in calculating size of readable bytes
|
||||
|
||||
## Version 0.10.1
|
||||
* Small bugfixes related to priorities, should actually make sequential download work.
|
||||
|
||||
## Version 0.10.0
|
||||
* Rewrote large parts of the code
|
||||
* Now using [thomas](https://github.com/JohnDoee/thomas) as file-reading core - this adds support for multi-rar streaming.
|
||||
* Faster streaming by reading directly from disk
|
||||
* Reverse proxy mode
|
||||
|
||||
## Version 0.9.0
|
||||
* Few bugfixes
|
||||
* Added support for Deluge 2
|
||||
|
||||
9
create-egg2.sh
Executable file
9
create-egg2.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
virtualenv .env-egg2
|
||||
.env-egg2/bin/pip install -U thomas
|
||||
ln -s .env-egg2/lib/python*/site-packages/thomas .
|
||||
ln -s .env-egg2/lib/python*/site-packages/rarfile.py .
|
||||
ln -s .env-egg2/lib/python*/site-packages/six.py .
|
||||
ln -s .env-egg2/lib/python*/site-packages/rfc6266.py .
|
||||
ln -s .env-egg2/lib/python*/site-packages/lepl .
|
||||
ln -s .env-egg2/lib/python*/site-packages/pytz .
|
||||
.env-egg2/bin/python setup.py bdist_egg
|
||||
9
create-egg3.sh
Executable file
9
create-egg3.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
python3 -m venv .env-egg3
|
||||
.env-egg3/bin/pip install -U thomas
|
||||
ln -s .env-egg3/lib/python*/site-packages/thomas .
|
||||
ln -s .env-egg3/lib/python*/site-packages/rarfile.py .
|
||||
ln -s .env-egg3/lib/python*/site-packages/six.py .
|
||||
ln -s .env-egg3/lib/python*/site-packages/rfc6266.py .
|
||||
ln -s .env-egg3/lib/python*/site-packages/lepl .
|
||||
ln -s .env-egg3/lib/python*/site-packages/pytz .
|
||||
.env-egg3/bin/python setup.py bdist_egg
|
||||
23
examples/cli-stream/README.md
Normal file
23
examples/cli-stream/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Commandline Tool to stream
|
||||
|
||||
Stream from the commandline.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Python
|
||||
* deluge_client python package
|
||||
|
||||
## Installation example
|
||||
|
||||
```bash
|
||||
virtualenv cli-example
|
||||
cli-example/bin/pip install deluge_client
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Open a torrent directly in VLC on Linux or OSX.
|
||||
|
||||
```bash
|
||||
vlc `cli-example/bin/python stream-cli.py username password my_video.torrent`
|
||||
```
|
||||
28
examples/cli-stream/stream-cli.py
Normal file
28
examples/cli-stream/stream-cli.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import argparse
|
||||
import urllib
|
||||
|
||||
from deluge_client import DelugeRPCClient
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Stream something.')
|
||||
parser.add_argument('username', type=str, help='Deluge username')
|
||||
parser.add_argument('password', type=str, help='Deluge password')
|
||||
parser.add_argument('path_or_url', type=str, help='Path or URL to torrent')
|
||||
|
||||
parser.add_argument('--hostname', '-o', type=str, default='localhost', help='Deluge daemon hostname or ip')
|
||||
parser.add_argument('--port', '-p', type=int, default=58846, help='Deluge daemon port')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.path_or_url.startswith('http'):
|
||||
filedata = urllib.urlopen(args.path_or_url).read()
|
||||
else:
|
||||
with open(args.path_or_url, 'rb') as f:
|
||||
filedata = f.read()
|
||||
|
||||
client = DelugeRPCClient(args.hostname, args.port, args.username, args.password)
|
||||
client.connect()
|
||||
|
||||
result = client.streaming.stream_torrent(None, None, filedata, None, None, True)
|
||||
print(result['url'])
|
||||
33
examples/http-api/README.md
Normal file
33
examples/http-api/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# HTTP API
|
||||
|
||||
Stream using the HTTP API built into Deluge Streaming.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Python
|
||||
* requests package
|
||||
|
||||
## Config
|
||||
|
||||
You need to enable HTTP API in Deluge Streaming config.
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from streamtorrent import stream_torrent
|
||||
|
||||
if __name__ == '__main__':
|
||||
with open('TPB.AFK.2013.1080p.h264-SimonKlose', 'rb') as f:
|
||||
torrent_data = f.read()
|
||||
|
||||
# Stream 1080p TPB AFK using infohash to avoid posting the torrent
|
||||
# if it already exist.
|
||||
url = stream_torrent(
|
||||
'http://stream:password@127.0.0.1:46123/streaming/stream',
|
||||
infohash='411a7a164505636ab1a8276395b375a3a30bff32',
|
||||
torrent_body=torrent_data,
|
||||
label='tpbafk'
|
||||
)
|
||||
print('we can stream %s' % (url, ))
|
||||
```
|
||||
|
||||
96
examples/http-api/streamtorrent.py
Normal file
96
examples/http-api/streamtorrent.py
Normal file
@@ -0,0 +1,96 @@
|
||||
import argparse
|
||||
|
||||
import requests
|
||||
|
||||
class FailedToStreamException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def stream_torrent(remote_control_url, infohash=None, path=None, wait_for_end_pieces=True, label=None, torrent_body=None):
|
||||
"""
|
||||
Add a torrent to deluge, stream it and return a URL to where it can be watched.
|
||||
|
||||
All optional parameters are optional but you will need to at least provide an infohash (if the torrent is already added)
|
||||
or a torrent_body (if you want the torrent added).
|
||||
|
||||
remote_control_url - The URL found in Deluge Streaming config
|
||||
infohash - Torrent infohash, makes it faster if the torrent is already added
|
||||
path - path inside the torrent you want to stream
|
||||
wait_for_end_pieces - make sure the first and last piece are downloaded before returning url.
|
||||
This might be necessary for some players
|
||||
label - Label to set in deluge
|
||||
torrent_body - The content of the .torrent file you want to stream
|
||||
"""
|
||||
first_part, second_part = remote_control_url.split('@')
|
||||
username, password = first_part.split('/')[2].split(':')
|
||||
url = '/'.join(first_part.split('/')[:2]) + '/' + second_part
|
||||
|
||||
params = {}
|
||||
if infohash:
|
||||
params['infohash'] = infohash
|
||||
|
||||
if wait_for_end_pieces:
|
||||
params['wait_for_end_pieces'] = wait_for_end_pieces
|
||||
|
||||
if path:
|
||||
params['path'] = path
|
||||
|
||||
if label:
|
||||
params['label'] = label
|
||||
|
||||
if infohash: # try to stream it without posting torrent body first
|
||||
r = requests.get(url, auth=(username, password), params=params)
|
||||
if r.status_code != 200:
|
||||
raise FailedToStreamException('Got non-200 error code from Deluge')
|
||||
|
||||
data = r.json()
|
||||
if data['status'] == 'success':
|
||||
return data['url']
|
||||
else:
|
||||
raise FailedToStreamException('Request failed: %r' % (data, ))
|
||||
|
||||
if torrent_body:
|
||||
r = requests.post(url, auth=(username, password), params=params, data=torrent_body)
|
||||
if r.status_code != 200:
|
||||
raise FailedToStreamException('Got non-200 error code from Deluge')
|
||||
|
||||
data = r.json()
|
||||
if data['status'] == 'success':
|
||||
return data['url']
|
||||
else:
|
||||
raise FailedToStreamException('Request failed: %r' % (data, ))
|
||||
|
||||
raise FailedToStreamException('Streaming was never successful')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description="Stream some torrents")
|
||||
parser.add_argument('url', help="Full API Url including auth info")
|
||||
parser.add_argument('--infohash', nargs='?', help="Infohash of torrent to stream")
|
||||
parser.add_argument('--path', nargs='?', help="Path to file within the torrent to stream")
|
||||
parser.add_argument('--label', nargs='?', help="Label to add the torrent with")
|
||||
parser.add_argument('--torrent', nargs='?', help="Path to the torrent to stream", type=argparse.FileType(mode='rb'))
|
||||
parser.add_argument('--skip_wait_for_end_pieces', help="Wait until client downloaded the first and last piece of the torrent", action='store_false')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
kwargs = {
|
||||
'remote_control_url': args.url,
|
||||
'wait_for_end_pieces': args.skip_wait_for_end_pieces
|
||||
}
|
||||
|
||||
if args.infohash:
|
||||
kwargs['infohash'] = args.infohash
|
||||
|
||||
if args.path:
|
||||
kwargs['path'] = args.path
|
||||
|
||||
if args.label:
|
||||
kwargs['label'] = args.label
|
||||
|
||||
if args.torrent:
|
||||
kwargs['torrent_body'] = args.torrent.read()
|
||||
|
||||
result = stream_torrent(**kwargs)
|
||||
print('URL %s' % (result, ))
|
||||
25
setup.py
25
setup.py
@@ -37,12 +37,12 @@
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
__plugin_name__ = "Streaming"
|
||||
__author__ = "Anders Jensen"
|
||||
__author_email__ = "johndoee@tidalstream.org"
|
||||
__version__ = "0.9.0"
|
||||
__author_email__ = "johndoee@tridentstream.org"
|
||||
__version__ = "0.12.1"
|
||||
__url__ = "https://github.com/JohnDoee/deluge-streaming"
|
||||
__license__ = "GPLv3"
|
||||
__description__ = "Enables streaming of files while downloading them."
|
||||
@@ -64,6 +64,17 @@ downloads ahead, this enables seeking in video files.
|
||||
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."""
|
||||
__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]}
|
||||
|
||||
REQUIREMENTS_PACKAGES = [
|
||||
'thomas',
|
||||
'lepl',
|
||||
'pytz',
|
||||
]
|
||||
|
||||
REQUIREMENTS_MODULES = [
|
||||
'rarfile',
|
||||
'rfc6266',
|
||||
]
|
||||
|
||||
setup(
|
||||
name=__plugin_name__,
|
||||
version=__version__,
|
||||
@@ -73,8 +84,10 @@ setup(
|
||||
url=__url__,
|
||||
license=__license__,
|
||||
long_description=__long_description__ if __long_description__ else __description__,
|
||||
# install_requires=REQUIREMENTS_PACKAGES,
|
||||
|
||||
packages=[__plugin_name__.lower()],
|
||||
packages=[__plugin_name__.lower()] + ['%s.%s' % (x, y) for x in REQUIREMENTS_PACKAGES for y in find_packages(x)] + REQUIREMENTS_PACKAGES,
|
||||
py_modules=REQUIREMENTS_MODULES,
|
||||
package_data = __pkg_data__,
|
||||
|
||||
entry_points="""
|
||||
@@ -82,7 +95,9 @@ setup(
|
||||
%s = %s:CorePlugin
|
||||
[deluge.plugin.gtkui]
|
||||
%s = %s:GtkUIPlugin
|
||||
[deluge.plugin.gtk3ui]
|
||||
%s = %s:Gtk3UIPlugin
|
||||
[deluge.plugin.web]
|
||||
%s = %s:WebUIPlugin
|
||||
""" % ((__plugin_name__, __plugin_name__.lower())*3)
|
||||
""" % ((__plugin_name__, __plugin_name__.lower())*4)
|
||||
)
|
||||
|
||||
@@ -42,20 +42,27 @@ from deluge.plugins.init import PluginInitBase
|
||||
|
||||
class CorePlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from core import Core as _plugin_cls
|
||||
from .core import Core as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
super(CorePlugin, self).__init__(plugin_name)
|
||||
|
||||
|
||||
class GtkUIPlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from gtkui import GtkUI as _plugin_cls
|
||||
from .gtkui import GtkUI as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
super(GtkUIPlugin, self).__init__(plugin_name)
|
||||
|
||||
|
||||
class Gtk3UIPlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from .gtk3ui import Gtk3UI as PluginClass
|
||||
self._plugin_cls = PluginClass
|
||||
super(Gtk3UIPlugin, self).__init__(plugin_name)
|
||||
|
||||
|
||||
class WebUIPlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from webui import WebUI as _plugin_cls
|
||||
from .webui import WebUI as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
super(WebUIPlugin, self).__init__(plugin_name)
|
||||
|
||||
1111
streaming/core.py
1111
streaming/core.py
File diff suppressed because it is too large
Load Diff
@@ -26,19 +26,26 @@
|
||||
<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>
|
||||
<widget class="GtkVBox" id="settings_vbox">
|
||||
<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>
|
||||
<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>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
@@ -160,9 +167,73 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox54">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="input_reverse_proxy_enabled">
|
||||
<property name="label" translatable="yes">Enable Reverse Proxy</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>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox55">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="reverse_proxy_base_url_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Reverse Proxy Base 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="input_reverse_proxy_base_url">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">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">3</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="visible">False</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
@@ -175,16 +246,16 @@
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</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>
|
||||
<!-- <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="visible">False</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
@@ -198,12 +269,12 @@
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</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>
|
||||
<!-- <property name="left_padding">20</property> -->
|
||||
<child>
|
||||
<widget class="GtkVBox" id="remote_vbox1">
|
||||
<property name="visible">True</property>
|
||||
@@ -364,7 +435,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
@@ -436,7 +507,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<!-- <child>
|
||||
<widget class="GtkHBox" id="remote_username_hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
@@ -476,7 +547,7 @@
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</child> -->
|
||||
<child>
|
||||
<widget class="GtkHBox" id="remote_password_hbox1">
|
||||
<property name="visible">True</property>
|
||||
@@ -498,7 +569,7 @@
|
||||
<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="visibility">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
|
||||
708
streaming/data/config.ui
Normal file
708
streaming/data/config.ui
Normal file
@@ -0,0 +1,708 @@
|
||||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 2.16 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="prefs_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="settings_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object 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>
|
||||
<object class="GtkVBox" id="settings_vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="settings_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object 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>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="serving_frame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object 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>
|
||||
<object class="GtkVBox" id="settings_vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="remote_username_label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Hostname: </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="remote_username_label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Port: </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox54">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="input_reverse_proxy_enabled">
|
||||
<property name="label" translatable="yes">Enable Reverse Proxy</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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox55">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="reverse_proxy_base_url_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Reverse Proxy Base Url: </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="input_reverse_proxy_base_url">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<!-- <child>
|
||||
<object class="GtkRadioButton" id="input_serve_webui">
|
||||
<property name="label" translatable="yes">Serve files via WebUI</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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child> -->
|
||||
<child>
|
||||
<object class="GtkVBox" id="settings_vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<!-- <child>
|
||||
<object class="GtkRadioButton" id="input_serve_standalone">
|
||||
<property name="label" translatable="yes">Serve files via standalone</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>
|
||||
<property name="group">input_serve_webui</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child> -->
|
||||
<child>
|
||||
<object class="GtkAlignment" id="remote_alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<!-- <property name="left_padding">20</property> -->
|
||||
<child>
|
||||
<object class="GtkVBox" id="remote_vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">20</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">20</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object 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>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
<object 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>
|
||||
<object class="GtkVBox" id="settings_vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="settings_vbox5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="remote_alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">32</property>
|
||||
<child>
|
||||
<object 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>
|
||||
<object class="GtkHBox" id="remote_password_hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="input_remote_password">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="visibility">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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="remote_url_hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="input_use_stream_urls">
|
||||
<property name="label" translatable="yes">Use stream protocol 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="input_auto_open_stream_urls">
|
||||
<property name="label" translatable="yes">Auto-open stream protocol 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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="input_aggressive_prioritizing">
|
||||
<property name="label" translatable="yes">Aggressive prioritizing</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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object 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>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -35,7 +35,10 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
title: 'Streaming',
|
||||
border: false,
|
||||
layout: 'form',
|
||||
header: false,
|
||||
autoScroll: true,
|
||||
autoHeight: true,
|
||||
width: 320,
|
||||
_fields: {},
|
||||
|
||||
initComponent: function() {
|
||||
@@ -50,10 +53,12 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
title: 'Settings',
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 1,
|
||||
labelAlign: 'top',
|
||||
labelWidth: 150,
|
||||
width: 300,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
width: 280,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,10 +74,12 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
title: 'File Serving Settings',
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 110,
|
||||
labelAlign: 'top',
|
||||
labelWidth: 150,
|
||||
width: 280,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
width: 260,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,13 +96,22 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
maxValue: 99999,
|
||||
}));
|
||||
|
||||
var field = fieldset.add({
|
||||
xtype: 'togglefield',
|
||||
name: 'reverse_proxy_base_url',
|
||||
fieldLabel: 'Reverse Proxy Config',
|
||||
});
|
||||
|
||||
om.bind('reverse_proxy_enabled', field.toggle);
|
||||
om.bind('reverse_proxy_base_url', field.input);
|
||||
|
||||
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,
|
||||
width: 280,
|
||||
labelWidth: 1
|
||||
});
|
||||
|
||||
@@ -130,7 +146,7 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
autoHeight: true,
|
||||
defaultType: 'radio',
|
||||
style: 'margin-left: 24px; margin-bottom: 5px; margin-top: 0; padding-bottom: 5px; padding-top: 0;',
|
||||
width: 240,
|
||||
width: 280,
|
||||
labelWidth: 1
|
||||
});
|
||||
|
||||
@@ -164,12 +180,12 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
|
||||
om.bind('ssl_priv_key_path', fieldset.add({
|
||||
name: 'ssl_priv_key_path',
|
||||
fieldLabel: 'Private key file path'
|
||||
fieldLabel: 'Private key file path',
|
||||
}));
|
||||
|
||||
om.bind('ssl_cert_path', fieldset.add({
|
||||
name: 'ssl_cert_path',
|
||||
fieldLabel: 'Certificate and chains file path'
|
||||
fieldLabel: 'Certificate and chains file path',
|
||||
}));
|
||||
|
||||
fieldset = this.add({
|
||||
@@ -178,10 +194,12 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
title: 'Advanced settings',
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 1,
|
||||
labelAlign: 'top',
|
||||
labelWidth: 150,
|
||||
width: 280,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
width: 260,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -189,7 +207,8 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
xtype: 'checkbox',
|
||||
name: 'allow_remote',
|
||||
boxLabel: 'Allow remote control',
|
||||
style: 'margin-left: 12px;'
|
||||
style: 'margin-left: 12px;',
|
||||
width: 150
|
||||
}));
|
||||
|
||||
fieldset = this.add({
|
||||
@@ -197,22 +216,23 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
border: false,
|
||||
style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px',
|
||||
autoHeight: true,
|
||||
labelWidth: 110,
|
||||
labelAlign: 'top',
|
||||
labelWidth: 150,
|
||||
width: 260,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
width: 240,
|
||||
}
|
||||
});
|
||||
|
||||
om.bind('remote_username', fieldset.add({
|
||||
xtype: 'textfield',
|
||||
name: 'remote_username',
|
||||
fieldLabel: 'Remote control username'
|
||||
}));
|
||||
// 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'
|
||||
}));
|
||||
@@ -233,7 +253,7 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
labelWidth: 1,
|
||||
defaultType: 'textfield',
|
||||
defaults: {
|
||||
width: 180,
|
||||
width: 200,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -250,6 +270,13 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
boxLabel: 'Auto-open stream protocol urls',
|
||||
style: 'margin-left: 12px;'
|
||||
}));
|
||||
|
||||
om.bind('aggressive_prioritizing', fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'aggressive_prioritizing',
|
||||
boxLabel: 'Aggressive prioritizing',
|
||||
style: 'margin-left: 12px;'
|
||||
}));
|
||||
},
|
||||
|
||||
onApply: function() {
|
||||
@@ -308,7 +335,7 @@ PreferencePage = Ext.extend(Ext.Panel, {
|
||||
var apiUrl = 'http';
|
||||
if (optionsManager.get('use_ssl'))
|
||||
apiUrl += 's';
|
||||
apiUrl += '://' + optionsManager.get('ip') + ':' + optionsManager.get('port') + '/streaming/stream';
|
||||
apiUrl += '://' + optionsManager.get('remote_username') + ':' + optionsManager.get('remote_password') + '@' + optionsManager.get('ip') + ':' + optionsManager.get('port') + '/streaming/stream';
|
||||
Ext.getCmp('remote_url').setValue(apiUrl);
|
||||
}
|
||||
});
|
||||
@@ -329,20 +356,23 @@ StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
||||
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, {
|
||||
var doStream = function (tid, fileIndex, asInline) {
|
||||
deluge.client.streaming.stream_torrent(tid, null, null, fileIndex, true, false, null, asInline, {
|
||||
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;
|
||||
if (asInline) {
|
||||
window.open(result.url, '_blank');
|
||||
} else {
|
||||
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>');
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -350,6 +380,28 @@ StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
||||
})
|
||||
}
|
||||
|
||||
var triggerStreamFile = function (asInline) {
|
||||
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, asInline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deluge.menus.filePriorities.addMenuItem({
|
||||
id: 'playthis',
|
||||
text: 'Play in browser',
|
||||
iconCls: 'icon-resume',
|
||||
handler: function (item, event) {
|
||||
deluge.menus.filePriorities.hide();
|
||||
triggerStreamFile(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
deluge.menus.filePriorities.addMenuItem({
|
||||
id: 'streamthis',
|
||||
@@ -357,15 +409,26 @@ StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
||||
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);
|
||||
}
|
||||
}
|
||||
triggerStreamFile(false);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var triggerStreamTorrent = function (asInline) {
|
||||
var ids = deluge.torrents.getSelectedIds();
|
||||
if (ids) {
|
||||
doStream(ids[0], null, asInline);
|
||||
}
|
||||
}
|
||||
|
||||
deluge.menus.torrent.addMenuItem({
|
||||
id: 'playthistorrent',
|
||||
text: 'Play in browser',
|
||||
iconCls: 'icon-resume',
|
||||
handler: function (item, event) {
|
||||
deluge.menus.torrent.hide();
|
||||
triggerStreamTorrent(true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -376,10 +439,7 @@ StreamingPlugin = Ext.extend(Deluge.Plugin, {
|
||||
iconCls: 'icon-down',
|
||||
handler: function (item, event) {
|
||||
deluge.menus.torrent.hide();
|
||||
var ids = deluge.torrents.getSelectedIds();
|
||||
if (ids) {
|
||||
doStream(ids[0]);
|
||||
}
|
||||
triggerStreamTorrent(false);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
234
streaming/gtk3ui.py
Normal file
234
streaming/gtk3ui.py
Normal file
@@ -0,0 +1,234 @@
|
||||
#
|
||||
# gtkui.py
|
||||
#
|
||||
# Copyright (C) 2009 John Doee <johndoee@tidalstream.org>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository.Gtk import MenuItem, SeparatorMenuItem
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.plugins.pluginbase import Gtk3PluginBase
|
||||
from deluge.ui.client import client
|
||||
from deluge.ui.gtk3 import dialogs
|
||||
from twisted.internet import defer, threads
|
||||
|
||||
from .common import get_resource
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def execute_url(url):
|
||||
if sys.platform == 'win32':
|
||||
os.startfile(url)
|
||||
elif sys.platform == 'darwin':
|
||||
subprocess.Popen(['open', url])
|
||||
else:
|
||||
try:
|
||||
subprocess.Popen(['xdg-open', url])
|
||||
except OSError:
|
||||
print('Unable to open URL %s' % (url, ))
|
||||
|
||||
|
||||
class Gtk3UI(Gtk3PluginBase):
|
||||
def enable(self):
|
||||
self.builder = Gtk.Builder()
|
||||
self.builder.add_from_file(get_resource('config.ui'))
|
||||
|
||||
component.get('Preferences').add_page('Streaming', self.builder.get_object('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 = self.get_widget('menu_file_tab')
|
||||
|
||||
self.sep = SeparatorMenuItem()
|
||||
self.item = 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 = SeparatorMenuItem()
|
||||
self.item_torrentmenu = 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()
|
||||
|
||||
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 = self.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)
|
||||
|
||||
def get_widget(self, widget_name):
|
||||
main_builder = component.get('MainWindow').get_builder()
|
||||
return main_builder.get_object(widget_name)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def on_apply_prefs(self):
|
||||
log.debug("applying prefs for Streaming")
|
||||
|
||||
serve_method = 'standalone'
|
||||
# if self.builder.get_object("input_serve_standalone").get_active():
|
||||
# serve_method = 'standalone'
|
||||
# elif self.builder.get_object("input_serve_webui").get_active():
|
||||
# serve_method = 'webui'
|
||||
|
||||
if self.builder.get_object("input_ssl_cert_daemon").get_active():
|
||||
ssl_source = 'daemon'
|
||||
elif self.builder.get_object("input_ssl_cert_custom").get_active():
|
||||
ssl_source = 'custom'
|
||||
|
||||
config = {
|
||||
"ip": self.builder.get_object("input_ip").get_text(),
|
||||
"port": int(self.builder.get_object("input_port").get_text()),
|
||||
"use_stream_urls": self.builder.get_object("input_use_stream_urls").get_active(),
|
||||
"auto_open_stream_urls": self.builder.get_object("input_auto_open_stream_urls").get_active(),
|
||||
"aggressive_prioritizing": self.builder.get_object("input_aggressive_prioritizing").get_active(),
|
||||
"allow_remote": self.builder.get_object("input_allow_remote").get_active(),
|
||||
"download_only_streamed": self.builder.get_object("input_download_only_streamed").get_active(),
|
||||
"reverse_proxy_enabled": self.builder.get_object("input_reverse_proxy_enabled").get_active(),
|
||||
# "download_in_order": self.builder.get_object("input_download_in_order").get_active(),
|
||||
"use_ssl": self.builder.get_object("input_use_ssl").get_active(),
|
||||
# "remote_username": self.builder.get_object("input_remote_username").get_text(),
|
||||
"reverse_proxy_base_url": self.builder.get_object("input_reverse_proxy_base_url").get_text(),
|
||||
"remote_password": self.builder.get_object("input_remote_password").get_text(),
|
||||
"ssl_priv_key_path": self.builder.get_object("input_ssl_priv_key_path").get_text(),
|
||||
"ssl_cert_path": self.builder.get_object("input_ssl_cert_path").get_text(),
|
||||
"serve_method": serve_method,
|
||||
"ssl_source": ssl_source,
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
def cb_get_config(self, config):
|
||||
"""callback for on show_prefs"""
|
||||
self.builder.get_object("input_ip").set_text(config["ip"])
|
||||
self.builder.get_object("input_port").set_text(str(config["port"]))
|
||||
self.builder.get_object("input_use_stream_urls").set_active(config["use_stream_urls"])
|
||||
self.builder.get_object("input_auto_open_stream_urls").set_active(config["auto_open_stream_urls"])
|
||||
self.builder.get_object("input_aggressive_prioritizing").set_active(config["aggressive_prioritizing"])
|
||||
self.builder.get_object("input_allow_remote").set_active(config["allow_remote"])
|
||||
self.builder.get_object("input_use_ssl").set_active(config["use_ssl"])
|
||||
self.builder.get_object("input_download_only_streamed").set_active(config["download_only_streamed"])
|
||||
self.builder.get_object("input_reverse_proxy_enabled").set_active(config["reverse_proxy_enabled"])
|
||||
# self.builder.get_object("input_download_in_order").set_active(config["download_in_order"])
|
||||
# self.builder.get_object("input_download_everything").set_active(not config["download_in_order"] and not config["download_only_streamed"])
|
||||
# self.builder.get_object("input_remote_username").set_text(config["remote_username"])
|
||||
self.builder.get_object("input_reverse_proxy_base_url").set_text(config["reverse_proxy_base_url"])
|
||||
self.builder.get_object("input_remote_password").set_text(config["remote_password"])
|
||||
self.builder.get_object("input_ssl_priv_key_path").set_text(config["ssl_priv_key_path"])
|
||||
self.builder.get_object("input_ssl_cert_path").set_text(config["ssl_cert_path"])
|
||||
|
||||
# self.builder.get_object("input_serve_standalone").set_active(config["serve_method"] == "standalone")
|
||||
# self.builder.get_object("input_serve_webui").set_active(config["serve_method"] == "webui")
|
||||
|
||||
self.builder.get_object("input_ssl_cert_daemon").set_active(config["ssl_source"] == "daemon")
|
||||
self.builder.get_object("input_ssl_cert_custom").set_active(config["ssl_source"] == "custom")
|
||||
|
||||
api_url = 'http%s://%s:%s@%s:%s/streaming/stream' % (('s' if config["use_ssl"] else ''), config["remote_username"], config["remote_password"], config["ip"], config["port"])
|
||||
self.builder.get_object("output_remote_url").set_text(api_url)
|
||||
|
||||
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)
|
||||
|
||||
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))
|
||||
|
||||
for select in selected:
|
||||
path = ft.get_file_path(select)
|
||||
client.streaming.stream_torrent(infohash=torrent_id, filepath_or_index=path, includes_name=True).addCallback(self.stream_ready)
|
||||
break
|
||||
|
||||
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(execute_url, url)
|
||||
else:
|
||||
def on_dialog_callback(response):
|
||||
if response == Gtk.ResponseType.YES:
|
||||
threads.deferToThread(execute_url, url)
|
||||
|
||||
dialogs.YesNoDialog('Stream ready', 'Do you want to play the video?').run().addCallback(on_dialog_callback)
|
||||
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()
|
||||
@@ -63,7 +63,7 @@ def execute_url(url):
|
||||
try:
|
||||
subprocess.Popen(['xdg-open', url])
|
||||
except OSError:
|
||||
print 'Unable to open URL %s' % (url, )
|
||||
print('Unable to open URL %s' % (url, ))
|
||||
|
||||
|
||||
class GtkUI(GtkPluginBase):
|
||||
@@ -124,10 +124,11 @@ class GtkUI(GtkPluginBase):
|
||||
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'
|
||||
serve_method = 'standalone'
|
||||
# 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'
|
||||
@@ -141,8 +142,11 @@ class GtkUI(GtkPluginBase):
|
||||
"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(),
|
||||
"download_only_streamed": self.glade.get_widget("input_download_only_streamed").get_active(),
|
||||
"reverse_proxy_enabled": self.glade.get_widget("input_reverse_proxy_enabled").get_active(),
|
||||
# "download_in_order": self.glade.get_widget("input_download_in_order").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_username": self.glade.get_widget("input_remote_username").get_text(),
|
||||
"reverse_proxy_base_url": self.glade.get_widget("input_reverse_proxy_base_url").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(),
|
||||
@@ -173,18 +177,22 @@ class GtkUI(GtkPluginBase):
|
||||
self.glade.get_widget("input_allow_remote").set_active(config["allow_remote"])
|
||||
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_reverse_proxy_enabled").set_active(config["reverse_proxy_enabled"])
|
||||
# self.glade.get_widget("input_download_in_order").set_active(config["download_in_order"])
|
||||
# self.glade.get_widget("input_download_everything").set_active(not config["download_in_order"] and not config["download_only_streamed"])
|
||||
# self.glade.get_widget("input_remote_username").set_text(config["remote_username"])
|
||||
self.glade.get_widget("input_reverse_proxy_base_url").set_text(config["reverse_proxy_base_url"])
|
||||
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_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"])
|
||||
api_url = 'http%s://%s:%s@%s:%s/streaming/stream' % (('s' if config["use_ssl"] else ''), config["remote_username"], config["remote_password"], config["ip"], config["port"])
|
||||
self.glade.get_widget("output_remote_url").set_text(api_url)
|
||||
|
||||
def stream_ready(self, result):
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import base64
|
||||
|
||||
from twisted.web.resource import Resource as TwistedResource, _computeAllowedMethods
|
||||
from twisted.web import server
|
||||
from twisted.internet import defer
|
||||
@@ -22,19 +24,17 @@ class Resource(TwistedResource):
|
||||
if auth_header:
|
||||
auth_header = auth_header.split(' ')
|
||||
if len(auth_header) > 1 and auth_header[0] == 'Basic':
|
||||
userpass = auth_header[1].decode('base64').split(':')
|
||||
userpass = base64.b64decode(auth_header[1].encode('utf-8')).decode('utf-8').split(':')
|
||||
if len(userpass) == 2:
|
||||
username, password = userpass
|
||||
if self.username == username and self.password == password:
|
||||
authenticated = True
|
||||
|
||||
if not authenticated:
|
||||
print auth_header
|
||||
print self.username, self.password
|
||||
request.setResponseCode(401)
|
||||
return 'Unauthorized'
|
||||
return b'Unauthorized'
|
||||
|
||||
m = getattr(self, 'render_' + request.method, None)
|
||||
m = getattr(self, 'render_' + request.method.decode('utf-8'), None)
|
||||
if not m:
|
||||
# This needs to be here until the deprecated subclasses of the
|
||||
# below three error resources in twisted.web.error are removed.
|
||||
|
||||
139
streaming/torrentfile.py
Normal file
139
streaming/torrentfile.py
Normal file
@@ -0,0 +1,139 @@
|
||||
import logging
|
||||
import mimetypes
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
from thomas import InputBase
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
PIECE_REQUEST_HISTORY_TIME = 10
|
||||
MAX_PIECE_REQUEST_COUNT = 20
|
||||
|
||||
class DelugeTorrentInput(InputBase):
|
||||
plugin_name = 'torrent_file'
|
||||
protocols = []
|
||||
|
||||
current_piece_data = None
|
||||
can_read_to = None
|
||||
last_available_piece = None
|
||||
_pos = None
|
||||
_closed = False
|
||||
|
||||
def __init__(self, item, torrent_handler, infohash, offset, path):
|
||||
self.item = item
|
||||
self.torrent_handler = torrent_handler
|
||||
self.torrent = torrent_handler.get_torrent(infohash)
|
||||
self.infohash = infohash
|
||||
self.offset = offset
|
||||
self.path = path
|
||||
self.piece_buffer = {}
|
||||
self.requested_pieces = {}
|
||||
self.piece_consumption_time = []
|
||||
self.size, self.filename, self.content_type = self.get_info()
|
||||
|
||||
def get_info(self):
|
||||
logger.info('Getting info about %r' % (self.path, ))
|
||||
|
||||
content_type = mimetypes.guess_type(self.path)[0] or 'bytes'
|
||||
|
||||
return self.item['size'], os.path.basename(self.path), content_type
|
||||
|
||||
def ensure_exists(self):
|
||||
if not os.path.exists(self.path):
|
||||
self.torrent.can_read(self.offset)
|
||||
|
||||
def tell(self):
|
||||
return self._pos
|
||||
|
||||
def seek(self, pos):
|
||||
self.ensure_exists()
|
||||
self._pos = pos
|
||||
logger.debug('Seeking at %s torrentfile_id %r' % (self.tell(), id(self)))
|
||||
self.torrent.add_reader(self, self.item.path, self.offset + self.tell(), self.offset + self.size)
|
||||
|
||||
def _read(self, num):
|
||||
data = self.current_piece_data.read(num)
|
||||
self._pos += len(data)
|
||||
return data
|
||||
|
||||
def read(self, num):
|
||||
if self.current_piece_data:
|
||||
data = self._read(num)
|
||||
if data:
|
||||
return data
|
||||
|
||||
self.ensure_exists()
|
||||
|
||||
if self._pos is None:
|
||||
self.seek(0)
|
||||
|
||||
logger.debug('Trying to read %s from %i torrentfile_id %r' % (self.path, self.tell(), id(self)))
|
||||
tell = self.tell()
|
||||
if self.can_read_to is None or self.can_read_to <= tell:
|
||||
can_read_result = self.torrent.can_read(self.offset + tell)
|
||||
self.last_available_piece = can_read_result[1]
|
||||
self.can_read_to = can_read_result[0] + tell
|
||||
|
||||
current_piece, rest = self.current_piece
|
||||
logger.debug('Calculated last available piece is %s offset %s can_read_to %s piece_length %s' % (self.last_available_piece, self.offset, self.can_read_to, self.torrent.piece_length))
|
||||
|
||||
while self.piece_consumption_time and self.piece_consumption_time[0] < time.time() - PIECE_REQUEST_HISTORY_TIME:
|
||||
self.piece_consumption_time.pop(0)
|
||||
|
||||
max_piece_count = (self.last_available_piece - current_piece) + 1
|
||||
pieces_to_request = min(min(max(2, len(self.piece_consumption_time)), max_piece_count), MAX_PIECE_REQUEST_COUNT)
|
||||
|
||||
logger.debug('New piece request status pieces_to_request: %s piece_consumption_time: %s max_piece_count: %s' % (pieces_to_request, len(self.piece_consumption_time), max_piece_count, ))
|
||||
logger.debug('Requested pieces: %r' % (self.requested_pieces.items()))
|
||||
logger.debug('Piece buffer: %r' % (self.piece_buffer.keys()))
|
||||
|
||||
for piece in range(current_piece, current_piece + pieces_to_request):
|
||||
if piece in self.requested_pieces:
|
||||
continue
|
||||
|
||||
logger.debug('Requesting piece %s' % (piece, ))
|
||||
self.requested_pieces[piece] = threading.Event()
|
||||
self.torrent.request_piece(piece)
|
||||
|
||||
for _ in range(1000):
|
||||
if self.requested_pieces[current_piece].wait(1):
|
||||
break
|
||||
if self._closed:
|
||||
return b''
|
||||
else:
|
||||
return b''
|
||||
|
||||
for delete_piece in [p for p in self.piece_buffer.keys() if p < current_piece]:
|
||||
del self.piece_buffer[delete_piece]
|
||||
|
||||
for delete_piece in [p for p in self.requested_pieces.keys() if p < current_piece]:
|
||||
del self.requested_pieces[delete_piece]
|
||||
|
||||
self.current_piece_data = self.piece_buffer[current_piece]
|
||||
self.current_piece_data.seek(rest)
|
||||
self.piece_consumption_time.append(time.time())
|
||||
logger.debug('Returning %s bytes' % (num, ))
|
||||
return self._read(num)
|
||||
|
||||
@property
|
||||
def current_piece(self):
|
||||
from_byte = self.offset + self.tell()
|
||||
piece_length = self.torrent.piece_length
|
||||
piece, rest = divmod(from_byte, piece_length)
|
||||
return piece, rest
|
||||
|
||||
def new_piece_available(self, piece, data):
|
||||
if piece not in self.requested_pieces or self.requested_pieces[piece].is_set():
|
||||
return
|
||||
|
||||
logger.debug("Setting data for piece %s" % (piece, ))
|
||||
self.piece_buffer[piece] = BytesIO(data)
|
||||
self.requested_pieces[piece].set()
|
||||
|
||||
def close(self):
|
||||
self.torrent.remove_reader(self)
|
||||
self._closed = True
|
||||
@@ -36,14 +36,20 @@
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
import logging
|
||||
|
||||
from deluge.log import LOG as log
|
||||
from deluge.ui.client import client
|
||||
from deluge import component
|
||||
from deluge.plugins.pluginbase import WebPluginBase
|
||||
|
||||
from common import get_resource
|
||||
from .common import get_resource
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class WebUI(WebPluginBase):
|
||||
scripts = [get_resource("streaming.js")]
|
||||
|
||||
def enable(self):
|
||||
pass
|
||||
|
||||
def disable(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user