From 87d71772826c96d0bf4612b5350ee2a79918be60 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 25 May 2008 12:25:41 +0200 Subject: [PATCH] that can also be empty on mininova --- ox/mininova.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ox/mininova.py b/ox/mininova.py index 948197b..908982c 100644 --- a/ox/mininova.py +++ b/ox/mininova.py @@ -109,9 +109,21 @@ class Mininova(Torrent): return Torrent.__init__(self) ratio = self.data['share ratio'].split(',') - self['seeder'] = int(intValue(ratio[0].replace(',','').strip())) - self['leecher'] = int(intValue(ratio[1].replace(',','').strip())) - self['downloaded'] = int(intValue(self.data['downloads'].replace(',','').strip())) + val = intValue(ratio[0].replace(',','').strip()) + if val: + self['seeder'] = int(val) + else: + self['seeder'] = -1 + val = intValue(ratio[1].replace(',','').strip()) + if val: + self['leecher'] = int(val) + else: + self['leecher'] = -1 + val = intValue(self.data['downloads'].replace(',','').strip()) + if val: + self['downloaded'] = int(val) + else: + self['downloaded'] = -1 published = self.data['added on'] published = published.split(' +')[0] self['published'] = datetime.strptime(published, "%a, %d %b %Y %H:%M:%S")