main file black format

This commit is contained in:
Xevion
2019-11-01 21:28:10 -05:00
parent 40d200dd74
commit ade2f7c018
3 changed files with 17 additions and 15 deletions

View File

@@ -1,7 +1,9 @@
import sys, os
import sys
import os
from package import app
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]=os.path.join(sys.path[0], 'package', 'key', 'photo_tagging_service.json')
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.join(
sys.path[0], 'package', 'key', 'photo_tagging_service.json')
if __name__ == "__main__":
sys.exit(app.run())
sys.exit(app.run())

View File

@@ -51,7 +51,7 @@ def run():
# Alert the user that there are duplicates in the directory and ask whether or not to continue
if len(identicals) > 0:
print('Identical files were found in the directory, continue?')
print('Identical files were the directory, continue?')
print(',\n\t'.join(identicals))
xmps = [possible for possible in files

View File

@@ -28,22 +28,22 @@ class FileProcessor(object):
def rawOptimize(self):
rgb = rawpy.imread(os.path.join(INPUT_PATH, self.file_name))
imageio.imsave(temp_file_path, rgb.postprocess())
imageio.imsave(self.temp_file_path, rgb.postprocess())
rgb.close()
# Information on file sizes
print("Raw Size: {} {}".format(*_size(os.path.join(INPUT_PATH, self.file_name))), end=' | ')
print("Resave Size: {} {}".format(*_size(temp_file_path)), end=' | ')
pre = os.path.getsize(temp_file_path)
self._optimize(temp_file_path)
post = os.path.getsize(temp_file_path)
print("Optimized Size: {} {} ({}% savings)".format(*_size(temp_file_path), round((1.0 - (post / pre)) * 100), 2) )
print("Raw Size: {} {}".format(*self._size(os.path.join(INPUT_PATH, self.file_name))), end=' | ')
print("Resave Size: {} {}".format(*self._size(self.temp_file_path)), end=' | ')
pre = os.path.getsize(self.temp_file_path)
self._optimize(self.temp_file_path)
post = os.path.getsize(self.temp_file_path)
print("Optimized Size: {} {} ({}% savings)".format(*self._size(self.temp_file_path), round((1.0 - (post / pre)) * 100), 2) )
def basicOptimize(self):
pre = os.path.getsize(os.path.join(INPUT_PATH, self.file_name))
self._optimize(os.path.join(INPUT_PATH, self.file_name), copy=temp_file_path)
post = os.path.getsize(temp_file_path)
print("Optimized Size: {} {} ({}% savings)".format(*_size(temp_file_path), round((1.0 - (post / pre)) * 100), 2) )
self._optimize(os.path.join(INPUT_PATH, self.file_name), copy=self.temp_file_path)
post = os.path.getsize(self.temp_file_path)
print("Optimized Size: {} {} ({}% savings)".format(*self._size(self.temp_file_path), round((1.0 - (post / pre)) * 100), 2) )
def run(self, client):
@@ -55,7 +55,7 @@ class FileProcessor(object):
self.basicOptimize()
# Open the image, read as bytes, convert to types Image
image = Image.open(temp_file_path)
image = Image.open(self.temp_file_path)
bytesIO = io.BytesIO()
image.save(bytesIO, format='jpeg')
image.close()