diff --git a/fanficfare/chromagnon/cacheBlock.py b/fanficfare/chromagnon/cacheBlock.py index a330e7a6..51355ea8 100644 --- a/fanficfare/chromagnon/cacheBlock.py +++ b/fanficfare/chromagnon/cacheBlock.py @@ -55,7 +55,10 @@ class CacheBlock(): # Read Magic Number magic = struct.unpack('I', header.read(4))[0] +<<<<<<< HEAD # print("magic number:%s"%hex(magic)) +======= +>>>>>>> e94a36a7 (Rebasing onto master) if magic == CacheBlock.BLOCK_MAGIC: self.type = CacheBlock.BLOCK header.seek(2, 1) diff --git a/fanficfare/chromagnon/cacheData.py b/fanficfare/chromagnon/cacheData.py index 07eced3d..ebb7e6ff 100644 --- a/fanficfare/chromagnon/cacheData.py +++ b/fanficfare/chromagnon/cacheData.py @@ -113,7 +113,11 @@ class CacheData(): else: block = open(os.path.join(self.address.path,self.address.fileSelector), 'rb') block.seek(8192 + self.address.blockNumber*self.address.entrySize) +<<<<<<< HEAD data = block.read(self.size) +======= + data = block.read(self.size).decode('utf-8') +>>>>>>> e94a36a7 (Rebasing onto master) block.close() return data diff --git a/fanficfare/chromagnon/cacheParse.py b/fanficfare/chromagnon/cacheParse.py index f80b7956..58ef77dc 100644 --- a/fanficfare/chromagnon/cacheParse.py +++ b/fanficfare/chromagnon/cacheParse.py @@ -39,6 +39,7 @@ import os import struct import sys import re +<<<<<<< HEAD import time def do_cprofile(func): @@ -67,6 +68,9 @@ except: # wants the output, too, but returns it return brotlidec(inbuf,[]) import time +======= +import brotli +>>>>>>> e94a36a7 (Rebasing onto master) from . import csvOutput from . import SuperFastHash @@ -139,16 +143,24 @@ class ChromeCache(object): def __init__(self,path): self.cache = parse(path) self.hash_cache = {} +<<<<<<< HEAD # t = time.time() for entry in self.cache: key = entry.keyToStr() if 'fanfiction.net' not in key: continue +======= + for entry in self.cache: + key = entry.keyToStr() +>>>>>>> e94a36a7 (Rebasing onto master) self.hash_cache[key] = entry normkey = re.sub(r'^(https://www.fanfiction.net/s/\d+/\d+/).+$',r'\1',key) ## either overwrites (no harm), or adds new. self.hash_cache[normkey] = entry +<<<<<<< HEAD # print("======:%s"%(time.time()-t)) +======= +>>>>>>> e94a36a7 (Rebasing onto master) def get_cached_file(self,url): if url in self.hash_cache: @@ -164,7 +176,11 @@ class ChromeCache(object): if entry.httpHeader.headers[b'content-encoding'] == b"gzip": data = gzip.decompress(data) elif entry.httpHeader.headers[b'content-encoding'] == b"br": +<<<<<<< HEAD data = brotli_decompress(data) +======= + data = brotli.decompress(data) +>>>>>>> e94a36a7 (Rebasing onto master) return data return None @@ -243,6 +259,10 @@ def exportToHTML(cache, outpath): # print("unbrotli'ed:%s"%name) except IOError: page.write("Something wrong happened while unzipping") +<<<<<<< HEAD +======= + brotli +>>>>>>> e94a36a7 (Rebasing onto master) else: page.write('%s'%(name , entry.keyToStr().split('/')[-1]))