From f8c5214e3ef6908b9b4b240189e76de626300ead Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Tue, 23 Sep 2014 16:09:33 -0400 Subject: [PATCH] Parse the json data from the storage server. --- tools/uncompressedsize.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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: