Fix decoding of empty values
This commit is contained in:
parent
6c66eeb86c
commit
51c9a55968
1 changed files with 3 additions and 3 deletions
|
@ -210,13 +210,13 @@ class Metadata():
|
|||
return
|
||||
self.fileid = fileid
|
||||
self.bcoded = bencoder.decode(torrent)
|
||||
self.created_by = self.bcoded.get(b'created by', b"")
|
||||
self.creation_date = self.bcoded.get(b'creation date', b"")
|
||||
self.created_by = self.bcoded.get(b'created by', b"").decode("utf-8", "ignore")
|
||||
self.creation_date = self.bcoded.get(b'creation date', b"").decode("utf-8", "ignore")
|
||||
self.announce_url = self.bcoded.get(b'info', dict()).get(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_human = size(self.torrentsize)
|
||||
self.name = self.bcoded.get(b'info', dict()).get(b'name', b"")
|
||||
self.name = self.bcoded.get(b'info', dict()).get(b'name', b"").decode("utf-8", "ignore")
|
||||
self.private = self.bcoded.get(b'info', dict()).get(b'private', b"")
|
||||
|
||||
def writeToDb(self, cursor):
|
||||
|
|
Loading…
Reference in a new issue