def __init__(self, torrent): download = Root.RTORRENT.d self.name = download.get_name(torrent) self.hash = torrent self.size = float(download.get_size_bytes(torrent)) self.downloaded = float(download.get_bytes_done(torrent)) self.uploaded = download.get_up_total(torrent) self.download_rate = download.get_down_rate(torrent) self.upload_rate = download.get_up_rate(torrent) self.state = download.get_state(torrent) self.image = util.get_mime_image(self.name) self.ratio = (self.uploaded / self.size)
def __init__(self, entry): self.name = entry.title self.link = entry.link self.time = datetime.datetime.fromtimestamp(time.mktime(entry.updated_parsed)) self.image = util.get_mime_image(self.name)