Chris, rozumiem, że chcesz ustawić maksymalne pobieranie jednego pliku na raz, czy tak? Czy wykorzystałeś do tego plik pythonowy, czy może wkleiłeś ustawienia do pliku konfiguracyjnego rtorrent (tak zrozumiałem z treści wiadomości)?
Edycja:
Kod: Zaznacz cały
#!/usr/bin/env python
# Now you can dynamically change the maximum number of simultaneous
# downloads writing the new number to the file "max_downloads_file" and
# then sending a signal SIGHUP to the rtorrentqueuemanager process.
import glob
import stat
import os
import shutil
import time
import signal
watch = "/share/storage/rtorrent/watch"
session = "/share/storage/rtorrent/session"
queue = "/share/storage/rtorrent/loading"
max_downloads_file = "/share/storage/rtorrent/max_downloads"
max_downloads = 2
def handler_sighup(signum, frame):
f = open(max_downloads_file, "r")
max_downloads = int(f.readline())
f.close()
#### START
signal.signal(signal.SIGHUP, handler_sighup)
while True:
time.sleep(60)
bz2files = glob.glob(queue + "/*.torrent.bz2")
for i in bz2files :
os.system('bzip2 -d ' + i)
gzipfiles = glob.glob(queue + "/*.torrent.gz")
for i in gzipfiles :
os.system('gunzip ' + i)
sfiles = glob.glob(session + "/*.torrent")
oldesttime = 0
oldestfile = ""
if len(sfiles) < max_downloads :
qfiles = glob.glob(queue + "/*.torrent")
for i in qfiles :
ftime = os.stat(i)[stat.ST_MTIME]
if oldesttime == 0 or ftime < oldesttime :
oldesttime = ftime
oldestfile = i
if oldestfile != "" :
shutil.move(oldestfile, watch)
Powyższy kod powinieneś wkleić do pliku:
rtorrentqueuemanager.py, następnie uruchomić
rtorrenta i dopiero na koniec, poleceniem
gdzie
python - nazwa interpretatora języka (niech mnie ktoś w razie czego poprawi)
rtorrentqueuemanager.py - nazwa pliku uruchamianego
& - dodanie tego znaku na końcu powoduje wykonywanie kodu w tle, dzięki czemu możesz zamknąć konsolę bez niebezpieczeństwa zamknięcia programu.