-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters