mirror of
https://github.com/Huluti/Curtail.git
synced 2024-10-05 18:17:08 +03:00
Compare commits
2 Commits
e3149d39bd
...
92c5dbf4f2
Author | SHA1 | Date | |
---|---|---|---|
|
92c5dbf4f2 | ||
|
3e0944d778 |
@ -80,9 +80,8 @@ class Compressor():
|
||||
if not self.do_new_file:
|
||||
# Creates a copy of the input file
|
||||
# This is done in case the output file is larger than the input file
|
||||
result_item_path = Path(result_item.filename)
|
||||
original_filename = Path(result_item.filename).with_stem(f"{result_item_path.stem}-og")
|
||||
shutil.copy2(result_item.filename, original_filename)
|
||||
temp_filename = result_item.filename + ".temp"
|
||||
shutil.copy2(result_item.filename, temp_filename)
|
||||
|
||||
error = False
|
||||
error_message = ''
|
||||
@ -112,9 +111,9 @@ class Compressor():
|
||||
if self.do_new_file:
|
||||
shutil.copy2(result_item.filename, result_item.new_filename)
|
||||
else:
|
||||
shutil.copy2(original_filename, result_item.new_filename)
|
||||
shutil.copy2(temp_filename, result_item.new_filename)
|
||||
result_item.new_size = new_file_data.stat().st_size
|
||||
original_filename.unlink(True)
|
||||
Path(temp_filename).unlink(True)
|
||||
|
||||
else:
|
||||
logging.error(str(output))
|
||||
|
Loading…
Reference in New Issue
Block a user