diff --git a/tools/uncompressedsize.py b/tools/uncompressedsize.py index 732db7167..32ba0957c 100644 --- a/tools/uncompressedsize.py +++ b/tools/uncompressedsize.py @@ -1,12 +1,15 @@ +import json +import logging + from data import model from data.database import ImageStorage from app import app, storage as store from data.database import db -import logging logger = logging.getLogger(__name__) + def backfill_sizes(): query = (ImageStorage .select() @@ -31,7 +34,8 @@ def backfill_sizes(): uuid = image_storage.uuid with_locations = model.get_storage_by_uuid(uuid) - json_data = store.get_content(with_locations.locations, store.image_json_path(uuid)) + json_string = store.get_content(with_locations.locations, store.image_json_path(uuid)) + json_data = json.loads(json_string) size = json_data.get('Size', json_data.get('size', -1)) if size == -1: