bittorent

Shane Geiger sgeiger at ncee.net
Wed Apr 11 13:11:19 EDT 2007



Jonathan Smith wrote:
> Linus Nordström wrote:
>   
>> Hello
>> Im planing playing a bit whit bittorrent, but I'm having some trouble
>> about where to start. So if anyone could point me in the right
>> direction it would be much appreciated.
>> The best would be if there are some already written modules that
>> handle downloading and seeding torrents, but if that cant be found a
>> good source on how one dose to build some sort of bitorrent client
>> would be nice.
>>
>> thanks in advance
>>     
>
> you might start with bittorrent itself [1] - it is written in python.
>
> [1]: http://www.bittorrent.com/download
>
> -smithj
>   

Snakebite is written entirely in Python.  This sounds like exactly what 
you need.

This covers my successful attempt to set up Snakebite (some time ago).  
It will likely be even easier for you.  These are crude instructions I 
made for myself at the time.  I think reading the documentation and 
using these notes will get you over any hurdles you need to surmount.  
Let me know if you cannot get it to work.



# I used wget to download the two .deb files and then installed those 
with dpkg -i <file> because I had problems with their sources.list 
instructions
wget http://actlab.tv/debian/binary/bittorrent_4.20.8_python2.3.deb; \
wget http://actlab.tv/debian/binary/snakebite.deb ; \
sudo dpkg -i {snakebite.deb,bittorrent_4.20.8_python2.3.deb}
sudo apt-get install libwxgtk2.6-0 python-wxgtk2.6 python-twisted 
python-crypto python-psyco
sudo apt-get update ; sudo apt-get -f install    #  I had to do "apt-get 
-f install" to deal with some dependency problems before I could install 
that


Then modify "sudo vi /etc/snakebite.ini"  (See "CONFIG FILE EXAMPLE" below.)


copy files to /var/snakebite/files/
 -- Do you have to restart snakebite in order to get it to serve files?

If you want to change the look of the Web page, do that in 
/var/snakebite/web


THINGS I MIGHT NEED TO FIX SO THAT IT WILL LISTEN ON PORT 80:
    s = self.r.create_serversocket(6060, '', True)
    -- /usr/lib/python2.3/site-packages/snakebite/server.py: unmodified: 
line 27 of 120 [22%]
    CHANGE IT TO THIS:  s = self.r.create_serversocket(80, '', True)
    APPARENTLY THAT NUMBER IS HARD-CODED


Then "sudo /etc/init.d/snakebite start"


Edit this file to create notes about how to download bittorrent 
clients:  /var/snakebite/web/blurb

To change the stylesheet copy everything between "<STYLE 
TYPE="text/css">" and "</STYLE>" from http://www.ncee.net/index.php to 
/var/snakebite/web/snakebite.css

Then go to:
http://actlab.tv/snakebite/redirect/sgeiger
  - I'm not sure why the redirect doesn't update sometimes.  Is it 
because I didn't set up my snakebite.ini properly?


http://localhost:6060/links
  -- THAT WORKED!!

http://70.13.149.185:6060/links
  -- THAT WORKED!!


------

CONFIG FILE EXAMPLE:

(Note: I used username: sgeiger and password foobar.  )


[Project Snakebite]
dir_web_=/var/snakebite/web
dir_torrents_=/var/snakebite/torrents
dir_files_=/var/snakebite/files
dir_temp_=/var/snakebite/temp
web_server_port=6060
config_port=2020
tracker_port=5050
url_to_update=http://actlab.tv/snakebite/update
username=random
password=random


------

Read this:  http://actlab.tv/snakebite_guide.html

Step 2 - Configure

You can edit your config file manually (/etc/snakebite.ini) or you can 
use the web interface (http://localhost:2020/config). The only thing you 
really need to change out of the box is to enter in your username and 
password for the redirect service. This can be any username and password 
that you want. Your account is automatically created the first time you 
run snakebite.

Step 3 - Run snakebite

You can launch snakebite like any Debian service: /etc/init.d/snakebite 
start.

Step 4 - Check out your links page

If you entered in a username and password, you should be able to look at 
your links page at http://actlab.tv/snakebite/redirect/username. This 
will actually redirect you to your IP on the machine on which you are 
currently running snakebite. This is registered automatically every time 
you run snakebite, so it will be kept up to date if you switch computers 
or have a dynamic IP address. You can also go to 
http://localhost:6060/links to view your links page.

There should be one link, to gag.jpg, a simple strangely-named work-safe 
test file which is just a picture of some guy chilling.

Step 5 - Make some files available for sharing

Just put the files in the snakebite directory (by default 
/var/snakebite/files). Wait a minute or so and then reload your links 
page. The new files should show up on the page and be ready for download.

Step 6 - Download some files

Clicking on any of the links on your links page should cause your 
browser to ask you if you want to save the file or open it in 
BitTorrent. Installing snakebite installs BitTorrent, so if you're 
browser is on the same machine as snakebite it should be installed. If 
you're testing from another machine, you can use the BitTorrent download 
link at the bottom of the links page to download BitTorrent (or just go 
to bittorrent.com). You can use any BitTorrent client that you like. We 
just link to the mainline one because our friends wrote it.

Step 7 - Customize your page

There are three customizable parts to your links page: the user picture, 
the CSS stylesheet, and the blurb at the bottom. These are all in the 
snakebite web directory (by default /var/snakebite/web). Change them to 
whatever you'd like. I find that customizing your user picture makes the 
page feel about ten times more awesome.

Step 8 - Send your link to all of your friends

Remember, the link http://actlab.tv/snakebite/redirect/username will 
always send you to your currently running snakebite even if your IP 
changes. We think this is really handy because we always forget our IP.
If you already using dyndns or something, you can use that instead, we 
won't be hurt.

Step 9 - Reflect

Now you're sharing files over BitTorrent. Who knew that it could be this 
easy? If you have more files to share, you just drop them in the 
directory. Everything is automatic, everything is fun! With all the time 
we just saved setting this up, we can spend more time finding cool files 
to share and making funny user pictures. It's kind of like myspace 
really, except it's not broken every other day. (Well, let's hope.)





-- 
Shane Geiger
IT Director
National Council on Economic Education
sgeiger at ncee.net  |  402-438-8958  |  http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sgeiger.vcf
Type: text/x-vcard
Size: 310 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070411/a2f2b9f5/attachment.vcf>


More information about the Python-list mailing list