Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=109)
-   -   Auto torrent uploader (http://www.bvlist.com/showthread.php?t=8568)

firefly 3rd December 2012 15:37

Auto torrent uploader
 
Hey there,


Here is a auto torrent uploader that ive tested and it works on tbdev.

What you need..

1) Ubuntu Desktop, If you are using a remote server then you will need to install
a KDE or Ubuntu desktop with VNC server. This is mainly for setting up the plugin you will not realy need to access your server via VNC cause once setup you will use Deluge GUI.


2) Run these commands(root)

# apt-get update

# cd ~

# cd /tmp

# wget http://peak.telecommunity.com/dist/ez_setup.py

# sudo python ez_setup.py

# sudo easy_install requests

Then use take this script and create

bot.py

Code:

#!/usr/bin/python
#Edit theses
username = ""
password = ""
TrackerURL = "http://yoursite.com/announce.php?passkey=XXXXXXXXXXXXXXXXXXXXXX"
log = "/home/auto/uploadlog.text"
watchdir = "/home/auto/watch/"
blocksize = 18 # 2^blocksize | 18^2 = 256kb per block
homedir = "/home/auto/"
#-------------------------------------------------------------------------------------------------------


import  sys
from sys import argv


logfile = open(log, 'a')
logfile.write("-----------------------------------------------\n")
try:
    torrentid= argv[1]
    torrentname= argv[2]
    torrentpath= argv[3]
except:
    logfile.write("No args given :(\n")
    logfile.close()
    sys.exit("Not run with Deluge")


logfile.write("New Upload\n")
logfile.write("-----------------------------------------------\n")
logfile.write("Torrent Name: " + torrentname + "\n")
logfile.write("Torrent Path: " + torrentpath + "\n")
mktorrentcmd = "mktorrent -p -a '" + TrackerURL + "' '" + torrentpath + "/" + torrentname + "' "
mktorrentcmd += "-o '" + homedir  + torrentname + ".torrent'"
logfile.write("Making torrent with " + mktorrentcmd + "\n")
import os
os.system(mktorrentcmd)


try:
    import requests
    print "requests loaded"
except:
    logfile.write("Please install requests\n")
    sys.exit("Missing requests")


url = "http://www.ninjacentral.za.net/takelogin.php"
user = {'username' : username, 'password' : password}
UploadURL = "http://www.ninjacentral.za.net/takeupload.php"


try:
    r = requests.post(url, data=user)
    cookies = r.cookies
    logfile.write("Logged in" + mktorrentcmd + "\n")
except:
    print "Ninja not up"
    sys.exit("Missing requests")


torrent_location = homedir  + torrentname + ".torrent"


torrent = {'file': open(torrent_location, 'rb')}
#Upload Crap
data = {"MAX_FILE_SIZE" : 262144, "name" : "",
        "filetype" : 2, "nfo" : "", "artist" : "",
        "ulbum" : "", "year" : "", "format": "",
        "bitrate" : "", "nfo2" : "", "link" : "",
        "descr" : "Description to follow soon <3", "type" : 36}


r = requests.post(UploadURL, cookies=cookies, data=data, files=torrent)


logfile.write("Moving to watch directory: " + "mv '~/" + torrentname + ".torrent' '" + watchdir + torrentname + ".torrent'" + "\n")
os.system("mv '" + homedir + torrentname + ".torrent' '" + watchdir + torrentname + ".torrent'")


logfile.close()

Place it in your home directory and make it executable .

Edit your details and change the attributes according to your upload form.

Open deluge go to plugins enable execute and place the full path to the script
as seen here
http://dev.deluge-torrent.org/wiki/Plugins/Execute

But for completed torrent not added torrent

Then make sure the watch directory is also set in deluge.

If you want fully automated your will need to install http://www.invitescene.com/index.php...ut-any-addons/


All times are GMT +2. The time now is 08:25.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.