Loading opds_catalog/__pycache__/dl.cpython-35.pyc +29 B (3.29 KiB) File changed.No diff preview for this file type. View original file View changed file opds_catalog/dl.py +18 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,11 @@ def Download(request, book_id, zip = 0): else: transname=utils.translit(book.filename) if zip: dlfilename=transname+'.zip' content_type='application/zip' else: dlfilename=transname if book.format=="fb2": content_type='text/xml' elif book.format=="epub": Loading @@ -33,9 +38,11 @@ def Download(request, book_id, zip = 0): else: content_type='application/octet-stream' response = HttpResponse() response["Content-Type"]='%s; name="%s"'%(content_type,transname) response["Content-Disposition"] = 'attachment; filename="%s"'%(transname) response["Content-Type"]='%s; name="%s"'%(content_type,dlfilename) response["Content-Disposition"] = 'attachment; filename="%s"'%(dlfilename) response["Content-Transfer-Encoding"]='binary' z = None Loading @@ -45,11 +52,8 @@ def Download(request, book_id, zip = 0): if book.cat_type==opdsdb.CAT_NORMAL: file_path=os.path.join(full_path,book.filename) book_size=os.path.getsize(file_path) response["Content-Length"] = str(book_size) fo=codecs.open(file_path, "rb") s=fo.read() response.write(s) fo.close() elif book.cat_type==opdsdb.CAT_ZIP: fz=codecs.open(full_path, "rb") z = zipfile.ZipFile(fz, 'r', allowZip64=True) Loading Loading
opds_catalog/__pycache__/dl.cpython-35.pyc +29 B (3.29 KiB) File changed.No diff preview for this file type. View original file View changed file
opds_catalog/dl.py +18 −14 Original line number Diff line number Diff line Loading @@ -24,6 +24,11 @@ def Download(request, book_id, zip = 0): else: transname=utils.translit(book.filename) if zip: dlfilename=transname+'.zip' content_type='application/zip' else: dlfilename=transname if book.format=="fb2": content_type='text/xml' elif book.format=="epub": Loading @@ -33,9 +38,11 @@ def Download(request, book_id, zip = 0): else: content_type='application/octet-stream' response = HttpResponse() response["Content-Type"]='%s; name="%s"'%(content_type,transname) response["Content-Disposition"] = 'attachment; filename="%s"'%(transname) response["Content-Type"]='%s; name="%s"'%(content_type,dlfilename) response["Content-Disposition"] = 'attachment; filename="%s"'%(dlfilename) response["Content-Transfer-Encoding"]='binary' z = None Loading @@ -45,11 +52,8 @@ def Download(request, book_id, zip = 0): if book.cat_type==opdsdb.CAT_NORMAL: file_path=os.path.join(full_path,book.filename) book_size=os.path.getsize(file_path) response["Content-Length"] = str(book_size) fo=codecs.open(file_path, "rb") s=fo.read() response.write(s) fo.close() elif book.cat_type==opdsdb.CAT_ZIP: fz=codecs.open(full_path, "rb") z = zipfile.ZipFile(fz, 'r', allowZip64=True) Loading