Git Product home page Git Product logo

Comments (11)

JohnDoee avatar JohnDoee commented on May 27, 2024

As far as I remember, you can't modify the deluge-console interface via plugins.

BUT, doing that is a ~10 line Python script or you can use the built-in HTTP API (known as remote control in settings). The HTTP API can probably be done with something like curl.

I'd be happy to whip up an example for any of those.

from deluge-streaming.

wjtk4444 avatar wjtk4444 commented on May 27, 2024

Such script would be a really nice addition to this plugin, the more automation the better. I'm currently working on a mpv script that allows user to open a torrent file/link from clipboard, starts sequential download using deluge daemon and plays the file. I'd like to use your plugin instead of sequential download as it's definitely a better option for streaming torrents, but I can't see a way to communicate with it from lua script.

I believe that a solution made in python would be better, as it would allow me to make my script work on all platforms with python installed. I believe that curl isn't available,on windows, at least not without some nasty hacks.

from deluge-streaming.

JohnDoee avatar JohnDoee commented on May 27, 2024

Make a virtual environment and install dependency

virtualenv venv
venv/bin/pip install deluge-client

Create your simple script

import argparse

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', type=str, help='Path to torrent')

    args = parser.parse_args()

    with open(args.path, 'rb') as f:
        filedata = f.read()

    client = DelugeRPCClient('127.0.0.1', 58846, args.username, args.password)
    client.connect()

    result = client.streaming.stream_torrent(None, None, filedata, None, None, True)
    print(result['url'])

You can bundle deluge-client with your project when you distribute it simply by putting the python library in the same folder.

Logic to automatically find Deluge Daemon connection information can be found here: https://github.com/JohnDoee/autotorrent/blob/develop/autotorrent/clients/deluge.py#L55-L98

from deluge-streaming.

JohnDoee avatar JohnDoee commented on May 27, 2024

I formalized the example a bit here https://github.com/JohnDoee/deluge-streaming/tree/develop/examples/cli-stream

from deluge-streaming.

wjtk4444 avatar wjtk4444 commented on May 27, 2024

Cool, thanks. That's exactly what I wanted to add, but I had no idea how to make deluge take both urls and files as an argument.

filedata = urllib.urlopen(args.path_or_url).read()

I think that the issue can be closed now, but I'll leave the decision up to you.

from deluge-streaming.

JohnDoee avatar JohnDoee commented on May 27, 2024

If you're happy, I'm happy !

from deluge-streaming.

wjtk4444 avatar wjtk4444 commented on May 27, 2024

One more question regarding the case: How would one go about passing a magnet link as an argument? It's neither a file or an url. I mean, it technically is an url, but not for Python's urllib at least.
I tried to add another case, but it doesn't seem to work.

elif args.path_or_url.startswith('magnet:'):
    filedata = args.path_or_url

from deluge-streaming.

JohnDoee avatar JohnDoee commented on May 27, 2024

The plugin doesn't support magnet links, at least not yet. Feel free to open a ticket about it.

from deluge-streaming.

JohnDoee avatar JohnDoee commented on May 27, 2024

To add a bit to this, the benefit of this client versus the 100 others (like the one used in popcorn time or by kodi-elementum) is that it is can be used on private tracker.

That's also why I added multi-rar streaming support.

from deluge-streaming.

wjtk4444 avatar wjtk4444 commented on May 27, 2024

Just to clarify things - is it your plugin or the deluge-client python package that doesn't support magnet urls? I find it weird either way, deluge itself and deluge-console seems to support everything out of the box.

from deluge-streaming.

JohnDoee avatar JohnDoee commented on May 27, 2024

The streaming plugin doesn't support adding them because it has an additional step, wait for Deluge to download the .torrent file.

from deluge-streaming.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.