Use zlib instead of gzip

The reason to make this change is that I had problems with some URL's and I saw that the problem whas the Gunzip.

I saw that the "gzip" http content is the same that we can found in this stackoverflow post: http://stackoverflow.com/a/3947241/1344260

And it fails too, here you  have my test/problem: http://pastebin.com/3rvmCEkU

It do a IOError: CRC check failed 0xac557afc != 0x2338b236L
and torrenter fails.

After that, I read this message and test the solution: http://stackoverflow.com/a/13692010/1344260

And its working. So I changed the code.
pull/1/head
Palatosino 2016-03-11 21:36:18 +01:00
parent 0d398c9feb
commit 0def096fb1
2 changed files with 1307 additions and 1307 deletions

View File

@ -22,7 +22,7 @@ import urllib2
import hashlib
import re
from StringIO import StringIO
import gzip
import zlib
import xbmc
import xbmcgui
@ -205,8 +205,8 @@ class AnteoLoader:
result = urllib2.urlopen(request)
if result.info().get('Content-Encoding') == 'gzip':
buf = StringIO(result.read())
f = gzip.GzipFile(fileobj=buf)
content = f.read()
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
content = decomp.decompress(buf.getvalue())
else:
content = result.read()

View File

@ -24,7 +24,7 @@ import urllib2
import hashlib
import re
from StringIO import StringIO
import gzip
import zlib
import sys
import xbmc
@ -108,8 +108,8 @@ class Libtorrent:
result = urllib2.urlopen(request)
if result.info().get('Content-Encoding') == 'gzip':
buf = StringIO(result.read())
f = gzip.GzipFile(fileobj=buf)
content = f.read()
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
content = decomp.decompress(buf.getvalue())
else:
content = result.read()
@ -428,7 +428,7 @@ class Libtorrent:
#'storage_mode': self.lt.storage_mode_t(1),
'paused': False,
#'auto_managed': False,
'duplicate_is_error': False
#'duplicate_is_error': True
}
if self.save_resume_data:
log('loading resume data')