xboxscene.org forums

Pages: [1] 2

Author Topic: Control Azureus From Xbox Almost Complete...but  (Read 276 times)

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« on: August 15, 2006, 11:47:00 AM »

Hi,

I have created a python script that currently controls all actions that can be accessed via the azhtmlwebui-plugin which uses port:6886 on the machine running Azureus..

OK. I can control the gui and everything seems ok so I am currently implementing the upload section.
When adding a torrent to the upload the file gets parsed through as a multipart file. Here is a snippet of the html from azhtmlwebui..
------------------------------------------------------------------------------------
#<div id="local">
#<span class="totals">Local Torrent:</span>
#<form name="myform_local" action="index.tmpl?d=u&amp;local=1" method="POST" ENCTYPE="multipart/form-data">

#<input type="file" size="80" name="upfile">
#<br><br>
#<input class="submit" type="submit" value="Go">
               
#</form>
#</div>

I need to try and replicate this but cannot seem to get it to work..Im very new to scripting and especially with HTML/Internet handling so I would really appreciate some help..

A snippet of the 'def' to do this is below:
----------------------------------------------------------
    def Save_Torrent(self,hashno):
        print 'Starting.....'
        dourl= down_link + hashno                                        # This section reads in data from a website
        f = urllib.urlopen(dourl)                                              # and saves the returned data into a binary
        data=f.read()                                                             # file as xxxx.torrent.
        tfile=os.getcwd()+'\\xxxx.torrent'                                #
        tout =os.getcwd()+'\\xxxx.txt'                                     # This does create a valid torrent file that
        g=open(tfile,"wb")                                                      # azureus will read ok when opened.
        g.write(data)
        g.close()
        #os.remove(tfile)
       
        print 'Finished getting Torrent......'
        uu='http://192.168.0.1:6...mpl?d=u&local=1'    # This is the section that I am trying
        x_in  = open(tfile,"rb")                                                  # to get to work. I need to pass the data
        x_out = open(tout,"w")                                                # in the file encoded as a HTTP-POST with
        mimetools.encode(x_in,x_out,"x-uuencode")                   # ENCTYPE = multipart. and pass it to the
        x_data = x_out.read()                                                   # url list in 'uu'.
        print x_data                                                                
        print '--------------------------------'                                    
        ss = urllib.urlencode({'upfile':x_data})                              
        runit = urllib.urlopen(uu,ss)                                          
        print runit                                                                    
        print '--------------------------------'                                    


==========================================================
Any help on this would be really appreciated...
Logged

bjs1400

  • Archived User
  • Jr. Member
  • *
  • Posts: 74
Control Azureus From Xbox Almost Complete...but
« Reply #2 on: August 15, 2006, 01:23:00 PM »

Wow, I think I love you.... love.gif

I have been wanting a way to control azureus from xbmc and this just might be my answer.  I could give you a hand after I put emulauncher to the side for a while.....

Try wrapping your code in code tags so we can see the indentation that python requires so it would be easier for one to help you.
Logged

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« Reply #3 on: August 15, 2006, 04:39:00 PM »

OK decided to go a slightly different way...

If anybody knows how to perform a transfer from xbmc to windows share please let me know. I can do it from the filemanager within XBMC it works fine but I really need to be able to call-it or do it from within Python one this has been done I can release the script for all to use..

Logged

bjs1400

  • Archived User
  • Jr. Member
  • *
  • Posts: 74
Control Azureus From Xbox Almost Complete...but
« Reply #4 on: August 15, 2006, 04:24:00 PM »

http://docs.python.o...ule-shutil.html

That might help, just will probably be a pain with the samba-paths, not sure how you would resolve the network path in python.....
Logged

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« Reply #5 on: August 16, 2006, 12:53:00 PM »

OK I have just done some tweaking on this and it is functional so if anyone wants it here it is:

http://www.bestshari...roller.zip.html

Here is the Install/Setup info:
####################################################################################
#  This script (Azureus.py)has been written to control Azureus running on your local    
#  local network. It current has no real error checking in but it does work.
#
# Install Notes:
# - You must have the 'azwebhtmlgui' plugin installed for this to work at all.
# - Also for ease it is best to enable autoadd of torrents in Azureus this allows
#   you to just copy the torrents over through the GUI.(!Note to do this you must
#   have your directory with your torrents in shared with access to enable others
#   to modify.
# - Modify the Line core_url listed below to match the IP of your PC running Azureus
# - Copy this file and the png files into your scripts directory within XBMC.
#--------------------------------------------------------------------------------------
# - The four main buttons at the top control the program. Click on the button will
#   do the following:
#   *(DOWNLOADS): Press A to update/refresh the list of you currently downloading
#                 torrent. You can then move down and select any of the torrents
#                 you want to control by pressing A. Then you will be sent to the
#                 buttons on the bottom that let you control what you want to do to
#                 the selected torrent. You can press BACK whilst on these buttons to
#                 return to the main buttons again.
#   *(UPLOADS)  : This is identicle to the DOWNLOADS in terms of functionality except
#                 it shows your finished downloads.
#   *(ADD TORRENT):This currently uses EZTV to get a list of the latest torrents that
#                  you can view. Pressing A on a selected torrent will save the file
#                  using the unique hash eg '88shjskks8.torrent'. The file will be
#                  written into the 'torrents' directory.
#   *(EXIT):       Just closes the program.
#
#   Once you have all the torrents you want you can simply goto the XBMC file manager and
#   copy the torrents over to your PC..
#------------------------------------------------------------------------------------------
#
# - IN PROGRESS:
#   As stated this is still a very much in progress script although is functional with
#   all of the Azereus actions available from the azwebhtml gui.
#
# - Tidy up the GUI and add alot more error checking into it.
# - Setup the buttons on the bottom so that when uploads are selected this enables
#   numerous sites to view and download torrents from.
# - Work out how to transfer the torrent to the PC in an automated process. This can be
#   done by the azwebhtmlgui but the torrent needs to be sent as if it was from a multi-
#   part form.(Any one knows how to do this then please drop me a line)
# - Probably alot of other stuff aswell.
#
Logged

bjs1400

  • Archived User
  • Jr. Member
  • *
  • Posts: 74
Control Azureus From Xbox Almost Complete...but
« Reply #6 on: August 16, 2006, 02:15:00 PM »

Can't wait to give it a shot!
Logged

Leglez

  • Archived User
  • Sr. Member
  • *
  • Posts: 262
Control Azureus From Xbox Almost Complete...but
« Reply #7 on: August 16, 2006, 02:16:00 PM »

Would it be possible to make this for uTorrent?
Logged

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« Reply #8 on: August 16, 2006, 02:54:00 PM »

Never really used uTorrent but will look into it.

The only others that I thought of using are:
MiniNova
Demonoid
EZTV (already there but need to add in the other pages or use the series search as well)..
Logged

anitabill

  • Archived User
  • Newbie
  • *
  • Posts: 20
Control Azureus From Xbox Almost Complete...but
« Reply #9 on: August 16, 2006, 05:56:00 PM »

Nice job Chunk

It worked perfectly. I see why you where looking for a way of sending a file to a samba share. That would eliminate the need to go to file manager.

The only thing I would like to see is a way to search for a torrent. Other then that I love it.

Thank you
Logged

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« Reply #10 on: August 17, 2006, 01:29:00 AM »

QUOTE(anitabill @ Aug 17 2006, 12:27 AM) View Post

The only thing I would like to see is a way to search for a torrent. Other then that I love it.


There are quite alot of things that I would like to add to it as time goes by..
Logged

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« Reply #11 on: September 03, 2006, 12:58:00 PM »

There will be a new update of this soon...

Whats been done since the initial release.
- Tidied up the GUI to make it less cluttered.
- Added support so you can download from MiniNova. Previously you could only download from EZTV.
- It will now pass the torrents to Azureus so no need to manually copy through file-manager anymore.
- Added in progress and dialog so you know what going on.

What will be added before the next release.
- Add in more checking and status message to try and make it bulletproof.
- Add in search facilities for both EZTV and MININOVA.

Stay Tuned...
Logged

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« Reply #12 on: September 07, 2006, 05:33:00 AM »

Its Done:

The Azureus controller script has been submitted to xbmcscript.com so I am just waiting for this to be accepted. For those who do not want to wait click the link below.

http://www.bestshari...ller-1.zip.html

####################################################################################
#  This script (Azureus.py)has been written to control Azureus running on your local    
#  local network. It current has no real error checking in but it does work.
#
# Install Notes:
# - You must have the 'azwebhtmlgui' plugin installed for this to work at all.
# - Also for ease it is best to enable autoadd of torrents in Azureus this allows
#   you to just copy the torrents over through the GUI.(!Note to do this you must
#   have your directory with your torrents in shared with access to enable others
#   to modify.
# - A recent version of XBMGUI ie, later than end of july 2006 as I am using the
#   Dialog.numeric
#--------------------------------------------------------------------------------------
# - The four main buttons at the top control the program. Click on the button will
#   do the following:
#   *(DOWNLOADS): Press A to update/refresh the list of you currently downloading
#                 torrent. You can then move down and select any of the torrents
#                 you want to control by pressing A. Then you will be sent to the
#                 buttons on the bottom that let you control what you want to do to
#                 the selected torrent. You can press BACK whilst on these buttons to
#                 return to the main buttons again.
#   *(UPLOADS)  : This is identicle to the DOWNLOADS in terms of functionality except
#                 it shows your finished downloads.
#   *(ADD TORRENT):This currently uses EZTV to get a list of the latest torrents that
#                  you can view. You currently have the ability to also use MiniNova.
#         the torrents are automatically sent to Azureus now so no need to copy.
#   *(OPTIONS):   Menu with config options and exit.
#
#   Once you have all the torrents you want you can simply goto the XBMC file manager and
#   copy the torrents over to your PC..
#------------------------------------------------------------------------------------------
#
# - IN PROGRESS:
#   As stated this is still a very much in progress script although is functional with
#   all of the Azereus actions available from the azwebhtml gui.
#
# - DONE SINCE LAST UPDATE:
# * Now has capability to use config file.
# * Automatically attempts to read config file when started. Otherwise uses the following
#   defaults. AZIP: 192.168.0.1 PORT: 6886 TIMEOUT:30
# * Azureus server IP: is now configurable without having to modify the script.
# * Azureus port no: is now configurable without having to modify the script.
# * Network Timeout: is now configurable without having to modify the script.
# * Ability to Save configs listed above to file.
# * Ability to Re-Read configs from file to overwrite any changes made.
# * All Torrents are now loaded directly into azureus so there is no need to manually
#   copy the files over to your azureus pc.
# * Add Torrent now has the ability to add other good torrent sites.
# * Support to download Torrents from MiniNova.
#   - Has Search Capability.
#   - Has category listings that are read from the server to navigate through the site.
# * EZTV now has a search facility aswell.
# * TIMEOUTS now work properly so if any site has a problem a dialog will be displayed
#   to indicate the error that occurred which avoids the script sitting there waiting
#   for the site to respond..Which could be never..
Logged

DeadPrez

  • Archived User
  • Newbie
  • *
  • Posts: 49
Control Azureus From Xbox Almost Complete...but
« Reply #13 on: September 07, 2006, 06:21:00 AM »

Utorrent is way better, making a script for it would probably be easier, since its one of the most simpliest programs to use, and very user friendly.. But i would'nt know anything about scripts so  (IMG:style_emoticons/default/blink.gif)
Logged

Chunk_1970

  • Archived User
  • Full Member
  • *
  • Posts: 128
Control Azureus From Xbox Almost Complete...but
« Reply #14 on: September 07, 2006, 06:45:00 AM »

QUOTE(DeadPrez @ Sep 7 2006, 12:52 PM) View Post

Utorrent is way better, making a script for it would probably be easier, since its one of the most simpliest programs to use, and very user friendly.. But i would'nt know anything about scripts so  blink.gif


Unfortunately UTorrent does not have a webgui yet as this feature is still in alpha.If and when this happens and alot of people request it I may add it in but until then I believe that Azureus is one of the most widely used BT client..
Logged
Pages: [1] 2