Parse the json data from the storage server.
This commit is contained in:
parent
98d8e0fe37
commit
f8c5214e3e
1 changed files with 6 additions and 2 deletions
|
@ -1,12 +1,15 @@
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
|
||||||
from data import model
|
from data import model
|
||||||
from data.database import ImageStorage
|
from data.database import ImageStorage
|
||||||
from app import app, storage as store
|
from app import app, storage as store
|
||||||
from data.database import db
|
from data.database import db
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def backfill_sizes():
|
def backfill_sizes():
|
||||||
query = (ImageStorage
|
query = (ImageStorage
|
||||||
.select()
|
.select()
|
||||||
|
@ -31,7 +34,8 @@ def backfill_sizes():
|
||||||
uuid = image_storage.uuid
|
uuid = image_storage.uuid
|
||||||
with_locations = model.get_storage_by_uuid(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))
|
size = json_data.get('Size', json_data.get('size', -1))
|
||||||
|
|
||||||
if size == -1:
|
if size == -1:
|
||||||
|
|
Reference in a new issue