Example #1
0
def handleImages(imagePaths):
    """Delete or rename images based on quantity.
    
    If there is one image, it will be renamed to cover.[ext].
    If there is more than one image, they will all be deleted."""
    
    if len(imagePaths) == 1:
        makeImageCover(imagePaths[0])
    else:
        # Look for "front" in image name. If there is only one "front",
        # that is the cover. Otherwise we can't decide.
        nonfronts = [ip for ip in imagePaths 
                     if not "front" in os.path.basename(ip).lower()]        
        functions.deleteItems(nonfronts)
        
        fronts = [ip for ip in imagePaths 
                  if "front" in os.path.basename(ip).lower()]
        if len(fronts) == 1:
            makeImageCover(fronts[0])
        else:
            functions.deleteItems(fronts)
Example #2
0
def cleanDir(filePaths):
    """Delete miscellaneous files."""
    
    functions.deleteItems(filePaths)