that can also be empty on mininova

This commit is contained in:
j 2008-05-25 12:25:41 +02:00
parent 9fca883114
commit 87d7177282

View file

@ -109,9 +109,21 @@ class Mininova(Torrent):
return return
Torrent.__init__(self) Torrent.__init__(self)
ratio = self.data['share ratio'].split(',') ratio = self.data['share ratio'].split(',')
self['seeder'] = int(intValue(ratio[0].replace(',','').strip())) val = intValue(ratio[0].replace(',','').strip())
self['leecher'] = int(intValue(ratio[1].replace(',','').strip())) if val:
self['downloaded'] = int(intValue(self.data['downloads'].replace(',','').strip())) 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 = self.data['added on']
published = published.split(' +')[0] published = published.split(' +')[0]
self['published'] = datetime.strptime(published, "%a, %d %b %Y %H:%M:%S") self['published'] = datetime.strptime(published, "%a, %d %b %Y %H:%M:%S")