# bit torrent

## mogosjoh

what do I need to do to get bit torrent running under gentoo?  an ebuild would be really nice...

  -john

----------

## opello

there's an ebuild for it ... dependency is python (since it runs on python).

----------

## hook

just 

```
emerge bittorent
```

...yeh, bittorent is my love in p2p apps  :Smile: 

----------

## The Khan Artist

And, uh, how do I use it? I tried having Konq open the .torrent file with btdownloadgui.py, and it starts up, asks me where to save the file, allocates space, and then... nothing. It stays at "connection to peers". I'm behind NAT, but BT works just fine in Windows. Any ideas?

----------

## Superduck

Try again or wait a little longer. I also get this at first but after a few minutes it runs fine.

----------

## The Khan Artist

I waited 2 hours and nothing. This was on the Animatrix Part 4 torrent from Slashdot yesterday, so I know it is very popular.

http://f.scarywater.net/

----------

## horza

I don't know about Konq, but this should give you enough of a hint:

"If you've installed the required packages for the Bit Torrent GUI, then you can setup your web browser to automagically run Bit Torrent when you click on a torrent file URL.  To do this with Mozilla or Netscape (6.x or 7.x) follow these steps:

    * As root, add the following line to /etc/mailcap:

          o application/x-bittorrent; /usr/local/bin/BitTorrent-3.2.1b/btdownloadgui.py %s; test=test -n "$DISPLAY"

    * In Mozilla/Netscape, click Edit -> Preferences -> Navigator -> Helper Applications

    * Click the 'New Type' button and enter the following:

          o MIME Type: application/x-bittorrent

          o Description: Bit Torrent

          o Extension: torrent

          o Select 'Open it using the default application'

    * then click OK.

Alternatively, you can just save the torrent files to disk, and fire up Bit Torrent manually.  torrent files are usually between 20k & 100k in size.  Here's how you can run Bit Torrent from a console (non-GUI) once you've saved the torrent file:

btdownloadcurses.py file.torrent"

http://www.linux-sxs.org/internet_browsing/bittorrent.html

Phillip.

----------

## hook

try http://a.scarywater.net  :Smile: 

----------

## xedx

why do i get this?

any ideas?

 :Smile: 

```

$ ./btdownloadcurses.py \[Inf\]_Macross_Zero_-_02_\[FC98E852\].avi.torrent 

Traceback (most recent call last):

  File "./btdownloadcurses.py", line 191, in ?

    run(mainerrlist, argv[1:])

  File "./btdownloadcurses.py", line 138, in run

    download(params, d.chooseFile, d.display, d.finished, d.error, Event(), fieldw)

  File "./BitTorrent/download.py", line 205, in download

    statusfunc, doneflag, config['check_hashes'], data_flunked)

  File "./BitTorrent/StorageWrapper.py", line 49, in __init__

    statusfunc(fractionDone = float(i+1)/len(hashes))

  File "./btdownloadcurses.py", line 98, in display

    blocknum = int(fieldw * fractionDone)

OverflowError: float too large to convert 

```

----------

## Useful Idiot

Try this

```
# btdownloadcurces.py --url file:///path/to/torrent/\[Inf\]_Macross_Zero_-_02_\[FC98E852\].avi.torrent --saveas \[Inf\]_Macross_Zero_-_02_\[FC98E852\].avi
```

----------

## theCoder

I don't know if they're related, but I have had a lot of trouble getting bittorrent to even start up under Gentoo.  The first errors I get are:

```
Traceback (most recent call last):

  File "/usr/lib/python2.2/site-packages/BitTorrent/RawServer.py", line 190, in

listen_forever

    events = self.poll.poll(period * timemult)

TypeError: timeout must be an integer or None

Traceback (most recent call last):

  File "/usr/lib/python2.2/site-packages/BitTorrent/RawServer.py", line 190, in

listen_forever

    events = self.poll.poll(period * timemult)

TypeError: timeout must be an integer or None

Traceback (most recent call last):

  File "/usr/lib/python2.2/site-packages/BitTorrent/RawServer.py", line 190, in

listen_forever

    events = self.poll.poll(period * timemult)

TypeError: timeout must be an integer or None

```

I can fix that by adding the line

```
timemult = 1
```

to RawServer.py right before line 190, but that's hardly the right fix.  And even then, I still get float overflow errors all over the place (sometimes appearing in what appear to be Python libraries and not bittorrent), so bittorrent still doesn't work.  I figure something is really wrong, but I have no idea what.

Does anyone have any tips on what I should be looking for?  Some basic information about my host:

* 2.4 GHz pentium4, 512 MB ram.

* CFLAGS="-O3 -mcpu=pentium4 -march=pentium4 -pipe "

* It's sitting behind a NAT'ing firewall, if that matters.

Any ideas?  Thanks!

----------

## amigadave

 *theCoder wrote:*   

> * CFLAGS="-O3 -mcpu=pentium4 -march=pentium4 -pipe "

 

I'm getting the same errors and i'm also using the -march=pentium4 option. On my other machine with an Athlon XP (and the corresponding march option) I get no problems. Therefore I think Python has problems when compiled for a Pentium 4. There is a warning about this in make.conf, so i guess this is why!

----------

## theCoder

I had heard that about the pentium4 thing, but I haven't had any trouble with it until now.  I tried recompiling python with pentium3 instead, but it still doesn't work right (lots of overflow errors (mostly trying to do things like "int(fractionDone * 1000)"), though it does seem to be downloading, at least when I use the GUI (this is also with my lame timemult = 1 "fix").

Maybe there's something else that should be recompiled with pentium3?

----------

## Chris Finch

If I remember correctly, recompiling just python won't stop the pentium4 optimization related errors. You must recompile glibc.

----------

## theCoder

Yep, that did it -- bittorrent now works perfectly.  So I guess glibc can't be compiled with pentium4 optimizations.  Maybe the ebuild should be modified to prevent/warn about this?

But for anyone else having weird problems with bittorrent, this is probably the fix.

Thanks for the help!

----------

## Chris Finch

 *Quote:*   

> So I guess glibc can't be compiled with pentium4 optimizations. Maybe the ebuild should be modified to prevent/warn about this?

 

If you look at the glibc ebuild you will see that C optimization flags are now stripped out. Also, the comments in make.conf deprecate the use of -march=pentium4 for the time being.

Cheers,

Peter

----------

