Added a cache_cleanup function

This commit is contained in:
Roberto Rosario
2011-02-10 01:39:01 -04:00
parent a1da232ee9
commit b1516acb4b

View File

@@ -38,6 +38,14 @@ def execute_convert(input_filepath, arguments, output_filepath):
return (proc.wait(), proc.stderr.read())
def cache_cleanup(input_filepath, size, page=0, format='jpg'):
filepath = create_image_cache_filename(input_filepath, size, page=0, format='jpg')
try:
os.remove(filepath)
except OSError:
pass
def create_image_cache_filename(input_filepath, size, page=0, format='jpg'):
temp_filename, separator = os.path.splitext(os.path.basename(input_filepath))
temp_path = os.path.join(TEMPORARY_DIRECTORY, temp_filename)