Fix torrent creation encoding

This commit is contained in:
sqozz 2018-04-01 20:04:52 +02:00
parent df83e9124d
commit d9bd330129

View File

@ -295,13 +295,13 @@ class Metadata():
return return
self.fileid = fileid self.fileid = fileid
self.bcoded = bencoder.decode(torrent) self.bcoded = bencoder.decode(torrent)
self.created_by = self.bcoded.get(b'created by', b"").decode("utf-8", "ignore") self.created_by = self.bcoded.get(b'created by', b"")
self.creation_date = self.bcoded.get(b'creation date', 0) self.creation_date = self.bcoded.get(b'creation date', 0)
self.announce_url = self.bcoded.get(b'info', dict()).get(b'', "") self.announce_url = self.bcoded.get(b'info', dict()).get(b'', "")
self.source = self.bcoded.get(b'info', dict()).get(b'source', b"") self.source = self.bcoded.get(b'info', dict()).get(b'source', b"")
self.torrentsize = ((len(self.bcoded.get(b'info', dict()).get(b'pieces', "")) / 20) * self.bcoded.get(b'info', dict()).get(b'piece length')) self.torrentsize = ((len(self.bcoded.get(b'info', dict()).get(b'pieces', "")) / 20) * self.bcoded.get(b'info', dict()).get(b'piece length'))
self.torrentsize_human = size(self.torrentsize) self.torrentsize_human = size(self.torrentsize)
self.name = self.bcoded.get(b'info', dict()).get(b'name', b"").decode("utf-8", "ignore") self.name = self.bcoded.get(b'info', dict()).get(b'name', b"")
self.private = self.bcoded.get(b'info', dict()).get(b'private', b"") self.private = self.bcoded.get(b'info', dict()).get(b'private', b"")
def writeToDb(self, cursor): def writeToDb(self, cursor):