コード例 #1
0
ファイル: previewcache.py プロジェクト: jtoledo1974/raw2jpeg
 def __init__(self):
     self.bl = {}
     filename = join(get_thumbdir(), "blacklist.txt")
     try:
         self.blfile = open(filename, "r+")
         self.bl = json.loads(self.blfile.read())
     except:
         try:
             self.blfile = open(filename, "w")
         except:
             logging.warning(
                 "Error loading preview blacklist file %s" % filename)
コード例 #2
0
ファイル: previewcache.py プロジェクト: jtoledo1974/raw2jpeg
 def __init__(self):
     self.o = {}
     filename = join(get_thumbdir(), "orientations.txt")
     try:
         self.o_file = open(filename, "r+")
         self.o = json.loads(self.o_file.read())
     except:
         try:
             self.o_file = open(filename, "w")
         except:
             logging.warning(
                 "Error trying to open orientation file %s for writing"
                 % filename)
コード例 #3
0
ファイル: bgallery.py プロジェクト: jtoledo1974/bgallery
def get_thumb(path):
    path = unquote(path)
    logging.debug("get_thumb %s" % path)
    path = join(root, path)
    try:
        # TODO Might be worth avoiding this isdir check
        if isdir(path):
            return get_dir_thumb(path) + (DIR,)
        elif isfile(path):
            return get_file_thumb(path) + (FILE,)
        else:
            return ('', 0, None)
    except Exception as e:
        logging.warning(
            "Failed to retrieve a thumbnail for %s: %s" % (path, e))
        return ("", 0, None)
コード例 #4
0
ファイル: previewcache.py プロジェクト: jtoledo1974/raw2jpeg
 def get(self, path):
     try:
         return self.o[path]
     except:
         logging.warning("Orientation not found for %s" % path)
         return 1