Browse Source

Merge pull request #2875 from fuzeman/feature/dev_rtorrent

[rtorrent] Fixed how torrent status is determined
pull/2897/head
Ruud Burger 11 years ago
parent
commit
82c0592e49
  1. 24
      couchpotato/core/downloaders/rtorrent/main.py

24
couchpotato/core/downloaders/rtorrent/main.py

@ -174,6 +174,21 @@ class rTorrent(Downloader):
log.error('Failed to send torrent to rTorrent: %s', err)
return False
def getTorrentStatus(self, torrent):
if torrent.hashing or torrent.hash_checking or torrent.message:
return 'busy'
if not torrent.complete:
return 'busy'
if not torrent.open:
return 'completed'
if torrent.state and torrent.active:
return 'seeding'
return 'busy'
def getAllDownloadStatus(self, ids):
log.debug('Checking rTorrent download status.')
@ -198,17 +213,10 @@ class rTorrent(Downloader):
torrent_files.append(sp(file_path))
status = 'busy'
if torrent.complete:
if torrent.active:
status = 'seeding'
else:
status = 'completed'
release_downloads.append({
'id': torrent.info_hash,
'name': torrent.name,
'status': status,
'status': self.getTorrentStatus(torrent),
'seed_ratio': torrent.ratio,
'original_status': torrent.state,
'timeleft': str(timedelta(seconds = float(torrent.left_bytes) / torrent.down_rate)) if torrent.down_rate > 0 else -1,

Loading…
Cancel
Save