Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pls adapt the NINJS outputformatter to provide better references for all renditions [SDCP-723] #2489

Merged
merged 10 commits into from
Nov 16, 2023
144 changes: 93 additions & 51 deletions features/ingest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,29 @@ Feature: Fetch From Ingest
"type":"picture",
"state":"ingested",
"renditions":{
"baseImage":{
"width":1400
},
"thumbnail":{

},
"original":{

"original": {
"poi": {
"y": 1193,
"x": 2128
},
"href": "http://content.reuters.com/auth-server/content/tag_reuters.com_2014_newsml_LYNXMPEA6F0MT_2/tag_reuters.com_2014_binary_LYNXMPEA6F0MT-BASEIMAGE?auth_token=fake_token",
"mimetype": "image/jpeg",
"media": "599e31ec1d41c833e0b8a830",
"width": 3489,
"height": 2296
},
"viewImage":{
"baseImage": {
"poi": {
"y": 478,
"x": 854
},
"href": "http://content.reuters.com/auth-server/content/tag_reuters.com_2014_newsml_LYNXMPEA6F0MT_2/tag_reuters.com_2014_binary_LYNXMPEA6F0MT-BASEIMAGE?auth_token=fake_token",
"mimetype": "image/jpeg",
"media": "599e31ed1d41c833e0b8a840",
"width": 1400,
"height": 921
}
}
}
},
{
"type":"text",
Expand All @@ -497,11 +508,28 @@ Feature: Fetch From Ingest
"featuremedia":{
"state": "ingested",
"renditions":{
"baseImage":{
"width":1400
},
"original":{
}
"original": {
"poi": {
"y": 1193,
"x": 2128
},
"href": "http://content.reuters.com/auth-server/content/tag_reuters.com_2014_newsml_LYNXMPEA6F0MT_2/tag_reuters.com_2014_binary_LYNXMPEA6F0MT-BASEIMAGE?auth_token=fake_token",
"mimetype": "image/jpeg",
"media": "599e31ec1d41c833e0b8a830",
"width": 3489,
"height": 2296
},
"baseImage": {
"poi": {
"y": 478,
"x": 854
},
"href": "http://content.reuters.com/auth-server/content/tag_reuters.com_2014_newsml_LYNXMPEA6F0MT_2/tag_reuters.com_2014_binary_LYNXMPEA6F0MT-BASEIMAGE?auth_token=fake_token",
"mimetype": "image/jpeg",
"media": "599e31ed1d41c833e0b8a840",
"width": 1400,
"height": 921
}
}
}
}
Expand All @@ -524,19 +552,22 @@ Feature: Fetch From Ingest
"type":"picture",
"state":"ingested",
"headline": "Polizeihunde sollen effizienter trainiert werden – Klone sollen die Lösung sein.",
"renditions":{
"baseImage":{
"width":1400
"renditions": {
"original": {
"media": "Polizeihund-China-2.jpg",
"href": "https://img.futurezone.de/img/science/origs216742511/239706555-w1280-h960-q85/Polizeihund-China-2.jpg",
"mimetype": "image\/jpeg",
"height": 853,
"width": 1280
},
"thumbnail":{

},
"original":{

},
"viewImage":{
"baseImage": {
"media": "Polizeihund-China-2.jpg",
"href": "https://img.futurezone.de/img/science/origs216742511/239706555-w1280-h960-q85/Polizeihund-China-2.jpg",
"mimetype": "image\/jpeg",
"height": 853,
"width": 1280
}
}
}
},
{
"type":"picture",
Expand All @@ -549,13 +580,22 @@ Feature: Fetch From Ingest
"associations":{
"featuremedia":{
"state": "ingested",
"renditions":{
"baseImage":{
"width":1400
},
"original":{
}
}
"renditions": {
"original": {
"media": "Polizeihund-China-2.jpg",
"href": "https://img.futurezone.de/img/science/origs216742511/239706555-w1280-h960-q85/Polizeihund-China-2.jpg",
"mimetype": "image\/jpeg",
"height": 853,
"width": 1280
},
"baseImage": {
"media": "Polizeihund-China-2.jpg",
"href": "https://img.futurezone.de/img/science/origs216742511/239706555-w1280-h960-q85/Polizeihund-China-2.jpg",
"mimetype": "image\/jpeg",
"height": 853,
"width": 1280
}
}
}
}
}
Expand Down Expand Up @@ -591,25 +631,27 @@ Feature: Fetch From Ingest
"headline":"German Air Force Museum",
"state":"ingested",
"renditions":{
"baseImage" : {
"width" : 1400,
"height" : 1074,
"mimetype" : "image/jpeg"
},
"thumbnail" : {
"width":156,
"height":120,
"mimetype" : "image/jpeg"
},
"original" : {
"width" : 800,
"height" : 614,
"mimetype" : "image/jpeg"
"baseImage": {
"poi": {
"y": 382,
"x": 784
},
"media": "599faa351d41c8fdc696d904",
"width": 1400,
"height": 934,
"mimetype": "image/jpeg",
"href": "http://localhost:5000/api/upload-raw/599faa351d41c8fdc696d904?_schema=http"
},
"viewImage":{
"width" : 640,
"height" : 491,
"mimetype" : "image/jpeg"
"original": {
"poi": {
"y": 1646,
"x": 3368
},
"media": "599faa331d41c8fdc696d8b4",
"width": 6016,
"height": 4016,
"mimetype": "image/jpeg",
"href": "http://content.reuters.com/auth-server/content/tag_reuters.com_2014_newsml_LYNXMPEA6F0MT_2/tag_reuters.com_2014_binary_LYNXMPEA6F0MT-BASEIMAGE?auth_token=fake_token"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions superdesk/io/feed_parsers/ninjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def parse_renditions(self, renditions):
# Parse width and height
width = rendition_data.get("width")
height = rendition_data.get("height")
if isinstance(width, int) and isinstance(height, int):
devketanpro marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(width, int):
parsed_rendition["width"] = width
if isinstance(height, int):
parsed_rendition["height"] = height

# Parse mimetype
Expand All @@ -179,7 +180,7 @@ def parse_renditions(self, renditions):
parsed_rendition["media"] = media

if parsed_rendition:
rend.update({rendition_name: parsed_rendition})
rend[rendition_name] = parsed_rendition
return rend

def _format_qcodes(self, items):
Expand Down
Loading