예제 #1
0
def __get_local_hash(book):
    ''' 
   Gets the image hash for the cover of the give ComicBook object.  Returns
   None if the cover image was empty or couldn't be hashed for any reason.
   '''
    hash = None  # matches nothing
    try:
        image = book.create_image_of_page(0) if book else None
        if image:
            image = utils.strip_back_cover(image)
            hash = imagehash.hash(image)
    finally:
        if "image" in locals() and image: image.Dispose()
    return hash
예제 #2
0
def __get_local_hash(book):
   ''' 
   Gets the image hash for the cover of the give ComicBook object.  Returns
   None if the cover image was empty or couldn't be hashed for any reason.
   '''   
   hash = None # matches nothing
   try:
      image = book.create_image_of_page(0) if book else None;
      if image:
         image = utils.strip_back_cover(image)
         hash = imagehash.hash(image)
   finally:
      if "image" in locals() and image: image.Dispose()
   return hash 
예제 #3
0
def __get_remote_hash(ref):
    ''' 
   Gets the image hash for a remote comic book resource.  This resource
   can be a SeriesRef (hashes series art), an IssueRef (hashes the 
   first issue cover) or a URL to an image on the web.
   
   Returns None if the ref led to an image that was empty or 
   couldn't be hashed for any reason.
   '''
    hash = None  # matches nothing
    try:
        image = db.query_image(ref) if ref else None
        if image:
            image = utils.strip_back_cover(image)
            hash = imagehash.hash(image)
    finally:
        if "image" in locals() and image: image.Dispose()
    return hash
예제 #4
0
def __get_remote_hash(ref):
   ''' 
   Gets the image hash for a remote comic book resource.  This resource
   can be a SeriesRef (hashes series art), an IssueRef (hashes the 
   first issue cover) or a URL to an image on the web.
   
   Returns None if the ref led to an image that was empty or 
   couldn't be hashed for any reason.
   '''  
   hash = None # matches nothing
   try:
      image = db.query_image(ref) if ref else None
      if image:
         image = utils.strip_back_cover(image)
         hash = imagehash.hash(image)
   finally:
      if "image" in locals() and image: image.Dispose()
   return hash