def __init__(self, piratebayId): self.data = get_data(piratebayId) if not self.data: return Torrent.__init__(self) published = self.data['uploaded'] published = published.replace(' GMT', '').split(' +')[0] self['published'] = datetime.strptime(published, "%Y-%m-%d %H:%M:%S")
def __init__(self, mininovaId): self.data = get_data(mininovaId) if not self.data: return Torrent.__init__(self) ratio = self.data['share ratio'].split(',') self['seeder'] = -1 self['leecher'] = -1 if len(ratio) == 2: val = int_value(ratio[0].replace(',','').strip()) if val: self['seeder'] = int(val) val = int_value(ratio[1].replace(',','').strip()) if val: self['leecher'] = int(val) val = int_value(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")