Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Console bittorrent and bittorrent (psuedo) deamon HOWTO
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
nx12
Apprentice
Apprentice


Joined: 14 Jan 2004
Posts: 193

PostPosted: Tue Nov 09, 2004 5:27 am    Post subject: Reply with quote

what about webtorrent?
_________________
signature sucks
Back to top
View user's profile Send private message
Twink
Apprentice
Apprentice


Joined: 06 Dec 2002
Posts: 178
Location: New Zealand

PostPosted: Sun Dec 12, 2004 11:58 pm    Post subject: Reply with quote

I remembered seeing this script a month or so back and thinking that I'd have to test it out sometime, well i finally have and like it however I thought of a few extensions that might be nice but i'm having a little trouble with it.

I want to run this as a cron job every X minutes, easy enough however obviously it will have to check if the script is already running before doing anything.

Code:

if [ "`ps -A | grep btdir.sh`" != "" ]; then
  exit
fi


Looks good but can't be placed inside the same script as it will detect its current instance and exit thus never working. It could be moved to a different script and execute btdir.sh if the pass checks, it could check for btdownloadcurses.py instead of btdir.sh, or it could

Code:

if [ "`ps -A | grep btdir.sh | wc -l`" != "1" ]; then
  exit
fi


although I haven't tested this one it should in theory work fine.

Next problem is btdownloadcurses and even btdownloadheadless dont seem to like running without being attached to a terminal for me, no idea why at all. So i figured screen could come to the rescue.

screen -R bt -X screen btdownloadcurses.py --minport 6900 --max_upload_rate 3 --maxport 6999 --responsefile "$I" ||...

so what that should do in theory is resume (or create) a screen session called bt, then create a new window in the screen and run the btdownload command, doesn't seem to work for me. I figure i must be doing something wrong but unsure.

So if anyone has done anything similar with this, or with another client etc it would be nice to know about it. I hear Azureus can monitor directories but i'd rather not have something that relies on X, also i'd like to be able to check up on it remotely which i dont know if i can do with Azureus (rather not run yet another web module thingy, unless it uses like apache maybe?)
Back to top
View user's profile Send private message
andyfaeglasgow
Apprentice
Apprentice


Joined: 09 Sep 2004
Posts: 170

PostPosted: Wed Jan 26, 2005 8:43 pm    Post subject: Reply with quote

Code:
#!/bin/bash

#########################################################
#  Md Mooktakim Ahmed   mma@mooktakim.com               #
#  http://www.mooktakim.com                             #
#                                                       #
# This is a script i use to start multiple bittorrent   #
# downloads. Basicly i've edited the         #
# btdownloadcurses.py file so that it exits after a   #
# complete download. Then this script runs many    #
# downloads one after the other, so that multiple    #
# downloads is possible, without any intervention.   #
# and i must say it works very well. It keeps a log and   #
# renames the torrent files into .OLD so that it does   #
# not get redownloaded. There is also some nice    #
# colourful outputs, just to complete the whole script   #
#                                                       #
# As always, this script is GPL Licensed.               #
#                                                       #
#########################################################

TMP="btdir.log"
DATE=`date +%Y-%m-%d`
TIME=`date +%r`
##ADDED
IFS="
"
##ADDED end
die()
{
   echo -e $*
   exit 1
}
echo "$DATE - $TIME -- ### New download started ###" >> $TMP
dir=$*

test -d $dir || die "$dir doesn't exist\nUsage:\n\tbtdir <dir>"
ls $dir/*.torrent >/dev/null 2>&1 || die "No torrents available in $dir"

files=$(cd $dir && ls *.torrent)

for I in $files
do
   if `test -e $dir/$I`
   then
      echo "$I exists"
   else
      echo "-- Torrents doesn't exist" >> $TMP
      echo "-- $dir/$I does not exist" >> $TMP
      echo "-- EXITING" >> $TMP
      die "Torrent $dir/$I doesn't exist"
   fi
done
echo "-- Torrents exist" >> $TMP
echo "-- Download will now be started..." >> $TMP
echo "*** All torrents exist."
echo "*** Download will now be started..."
echo "***"" Downloading from $dir ""***"""

sleep 5

for I in $files
do
   cd $dir || die "ERROR: Cannot change to directory [1;33$dir"
   echo "$TIME -- $dir/$I --- Started" >> $TMP
##MODIFIED
   btdownloadcurses.py --minport 6900 --max_upload_rate 3 --maxport 6999 --responsefile "$I" || die "ERROR: bittorrent exited with an error for [1;33$I"
##MODIFIED end
   echo "$TIME -- $dir/$I --- DONE!" >> $TMP
   echo "***"" $I ""***"""
   mv $I $I.OLD
done

echo "***"" #### ALL ### DONE ### ""***"""
echo "$TIME -- *** #### ALL ### DONE ### ***" >> $TMP


Alternatively it can be done in one line; thus :-)

Code:


find . -name '*.torrent' -exec yourTunedTorrentClient.py '{}' ';'



Where "yourTunedTorrentClient.py" is one that exits some time after finishing it's download. (I'd recommend putting a sleep for 10 mins in the .py file to help other uploaders). Any parameters you wish to pass to the client should be placed after '{}' and before ';' You could even use this to queue all torrent files in your system, wherever they may be, simply replace the . after find with / . I'll leave other possibilities up to your imagination.
Back to top
View user's profile Send private message
eyebex
n00b
n00b


Joined: 23 Jul 2005
Posts: 65

PostPosted: Fri Nov 18, 2005 8:44 pm    Post subject: Reply with quote

Nice How-To guys, thanks. However, I just emerged net-p2p/bittorrent-4.1.7 and there are no traces of btdownloadcurses.py or btlaunchmany.py. What do I need to do to get these?

EDIT: I solved the issue by writing my own ebuild for BitTorrent 4.1.8, see https://forums.gentoo.org/viewtopic-p-2889013.html#2889013.
Back to top
View user's profile Send private message
ra0
n00b
n00b


Joined: 30 Oct 2004
Posts: 5

PostPosted: Sat Nov 19, 2005 8:55 pm    Post subject: Reply with quote

I think you should try rtorrent.
IMHO it's the best console bittorrent client out there. It's small,fast and supports multiple downloads.
Code:
emerge rtorrent
Back to top
View user's profile Send private message
ayem
n00b
n00b


Joined: 24 Mar 2004
Posts: 19
Location: Krakow PL

PostPosted: Sun Feb 19, 2006 12:55 am    Post subject: Reply with quote

and works perfectly with screen - so this tutorial is apropriate for this one too.
_________________
ayem
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum