From b8d3ad28ac0c6e2ca15cfb1542f0d922c145bc9a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 27 Jul 2021 23:06:35 +0100 Subject: [PATCH] non-food representation --- shares.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shares.py b/shares.py index 8ee419ad0..20f390071 100644 --- a/shares.py +++ b/shares.py @@ -1291,8 +1291,14 @@ def _dfcToSharesFormat(catalogJson: {}, # has expired continue - hasType = item['DFC:hasType'].split(':')[1] - itemType = _getshareTypeFromDfcId(hasType, dfcIds) + if item['DFC:hasType'].startswith('epicyon:'): + itemType = item['DFC:hasType'].split(':')[1] + itemType = itemType.replace('_', ' ') + itemCategory = 'non-food' + else: + hasType = item['DFC:hasType'].split(':')[1] + itemType = _getshareTypeFromDfcId(hasType, dfcIds) + itemCategory = 'food' if not itemType: continue dfcId = dfcIds[itemType] @@ -1305,7 +1311,7 @@ def _dfcToSharesFormat(catalogJson: {}, "itemQty": item['DFC:quantity'], "dfcId": dfcId, "itemType": itemType, - "category": "food", + "category": itemCategory, "location": "", "published": item['DFC:startDate'], "expire": durationSec,