Deluge client for XBMC

Suggestions and discussion of future versions
pramodbutte
New User
New User
Posts: 7
Joined: Wed Jun 30, 2010 6:40 pm

Deluge client for XBMC

Post by pramodbutte »

Hi all,

I am trying to write a deluge client XBMC script to display the torrent status within XBMC.

I am trying to connect to the deluge daemon running locally, but cannot do so. Any help is appreciated I am posting a basic class I am building to connect to deluge daemon.

Code: Select all


#import xbmc
#import xbmcgui
from datetime import datetime
from deluge.common import ftime, fsize, fspeed
from deluge.ui.client import client
from twisted.internet import reactor
from optparse import OptionParser
import codecs
import logging
import os
import sys

class DelugeInfo:
    uri = None
    options = None
    sessionstate = None
    sessionstatefound = False

    STATE_DOWNLOADING = 4
    STATE_SEEDING = 3
    STATE_QUEUED = 2
    STATE_PAUSED = 1
    STATE_UNKNOWN = 0
        
    def __init__(self, options):
        self.options = options
        self.d = client.connect(host="127.0.0.1",port=58846,username="",password="")
        print self.d
        print client.connected()

def main():
    options = None
    delugeInfo = DelugeInfo(options)


if __name__ == '__main__':
    main()
    sys.exit()

when I run this code I get the output as:

print self.d outputs '<Deferred at 0x221be18>'
print client.connected() outputs 'False

and I do not get any server log where a connection attempt was made.

What am I doing wrong? Any help will be appreciated

Thank you

Edit:

I am using latest deluge 1.3.0_rc and python 2.6.
Eclipse ide with pyDev extension
gazpachoking
Moderator
Moderator
Posts: 315
Joined: Sat Aug 18, 2007 2:28 pm
Location: Pittsburgh, USA

Re: Deluge client for XBMC

Post by gazpachoking »

pramodbutte
New User
New User
Posts: 7
Joined: Wed Jun 30, 2010 6:40 pm

Re: Deluge client for XBMC

Post by pramodbutte »

Thank you for your quick reply! I actually have referred to the link before.
My problem is even after adding this code

Code: Select all

class DelugeInfo:
    uri = None
    options = None
    sessionstate = None
    sessionstatefound = False
    STATE_DOWNLOADING = 4
    STATE_SEEDING = 3
    STATE_QUEUED = 2
    STATE_PAUSED = 1
    STATE_UNKNOWN = 0
        
    def __init__(self, options):
        self.options = options
        d = client.connect(host="127.0.0.1",port=58846,username="",password="")
        print d
        d.addCallback(self.on_connect_success)
        d.addErrback(self.on_connect_fail)
        
    def on_connect_success(result):
        print "connected"
        print "result: ", result
        client.disconnect()
        reactor.stop()
        
    def on_connect_fail(result):
        print "failed"
        print "result: ", result
        pass
I have NO output on the console and my server log does not indicate any attempt from a client to connect.
Is there a specific package I need to install before the client.connect code will actually talk with the daemon running on the localhost?
gazpachoking
Moderator
Moderator
Posts: 315
Joined: Sat Aug 18, 2007 2:28 pm
Location: Pittsburgh, USA

Re: Deluge client for XBMC

Post by gazpachoking »

I didn't look too closely at your code, but it looks like you need to start the reactor. The twisted calls and callbacks don't start going till you call reactor.run()
pramodbutte
New User
New User
Posts: 7
Joined: Wed Jun 30, 2010 6:40 pm

Re: Deluge client for XBMC

Post by pramodbutte »

Yes... I had forgotten to start the reactor.

Again that you very much for your time. I really appreciate your help
pramodbutte
New User
New User
Posts: 7
Joined: Wed Jun 30, 2010 6:40 pm

Deluge and XBMC python version conflict

Post by pramodbutte »

I am trying to write a XBMC client for deluge. But the internal XBMC python interpreter used python 2.4 and the deluge + twisted uses python 2.6.
Currently when I run a the client using python 2.6 interpreter, it connects and gets information from the server. but the same client in XBMC does not connect.
does anyone know what would be the best way to work around this discrepancy?
Thank you!
johnnyg
Top Bloke
Top Bloke
Posts: 1522
Joined: Sun Oct 28, 2007 4:00 am
Location: Sydney, Australia

Re: Deluge and XBMC python version conflict

Post by johnnyg »

Deluge requires python version 2.5 at least.
Is there no way to upgrade the internal python interpreter?
pramodbutte
New User
New User
Posts: 7
Joined: Wed Jun 30, 2010 6:40 pm

Re: Deluge and XBMC python version conflict

Post by pramodbutte »

I think you can configure and build with python 2.6 interpreter, but then the script will not be distributable :(
pramodbutte
New User
New User
Posts: 7
Joined: Wed Jun 30, 2010 6:40 pm

Re: Deluge and XBMC python version conflict

Post by pramodbutte »

Is there a specific library used by Deluge using python 2.5 which may work under python 2.4? an older version perhaps? e.g. twisted
rflores2323
Member
Member
Posts: 33
Joined: Wed Feb 10, 2010 5:49 pm

Re: Deluge client for XBMC

Post by rflores2323 »

Im very interested in this as I use xbmc and would love to be able to see my torrent status thru xbmc.

let us know how the progress is coming along and PM me when its finished if possible. Im sure you going to advise the xbmc forums also if not I can.
Post Reply