Skip to content

Commit

Permalink
Not crashing whole process when found error in one of the assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Axadiw committed Mar 7, 2016
1 parent 8dc4f03 commit a068fc7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions basset/helpers/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,19 @@ def convert(self):
selected_destination_templates.append(template)

if len(selected_destination_templates) > 0:
original_size, transparent_color = Converter.get_image_metadata(original_full_path)

for template in selected_destination_templates:
converted_files_count += 1
new_image_size = (original_size[0] * template[0], original_size[1] * template[0])
destination_path = os.path.join(new_base_path, basename + template[1])

self.convert_single_file(original_full_path, destination_path, new_image_size,
template[0], transparent_color)
logging.info("Converted {0} to {1}".format(original_full_path, destination_path))
try:
original_size, transparent_color = Converter.get_image_metadata(original_full_path)

for template in selected_destination_templates:
new_image_size = (original_size[0] * template[0], original_size[1] * template[0])
destination_path = os.path.join(new_base_path, basename + template[1])

self.convert_single_file(original_full_path, destination_path, new_image_size,
template[0], transparent_color)
converted_files_count += 1
logging.info("Converted {0} to {1}".format(original_full_path, destination_path))
except subprocess.CalledProcessError as error:
logging.error("Error while processing {0}: {1}".format(original_full_path, error))

if converted_files_count > 0:
with open(temp_file, "w+") as data_file:
Expand Down

0 comments on commit a068fc7

Please sign in to comment.