mirror of
https://github.com/searxng/searxng.git
synced 2026-08-10 09:11:23 +00:00
Compare commits
2 Commits
5492de15bb
...
8baefcc21e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8baefcc21e | ||
|
|
fc7d8b8be2 |
@@ -55,15 +55,18 @@ def response(resp):
|
|||||||
if result['type'] == 'story':
|
if result['type'] == 'story':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
main_image = result['images']['orig']
|
||||||
results.append(
|
results.append(
|
||||||
{
|
{
|
||||||
'template': 'images.html',
|
'template': 'images.html',
|
||||||
'url': result['link'] or f"{base_url}/pin/{result['id']}/",
|
'url': result.get('link') or f"{base_url}/pin/{result['id']}/",
|
||||||
'title': result.get('title') or result.get('grid_title'),
|
'title': result.get('title') or result.get('grid_title'),
|
||||||
'content': (result.get('rich_summary') or {}).get('display_description') or "",
|
'content': (result.get('rich_summary') or {}).get('display_description') or "",
|
||||||
'img_src': result['images']['orig']['url'],
|
'img_src': main_image['url'],
|
||||||
'thumbnail_src': result['images']['236x']['url'],
|
'thumbnail_src': result['images']['236x']['url'],
|
||||||
'source': (result.get('rich_summary') or {}).get('site_name'),
|
'source': (result.get('rich_summary') or {}).get('site_name'),
|
||||||
|
'resolution': f"{main_image['width']}x{main_image['height']}",
|
||||||
|
'author': f"{result['pinner'].get('full_name')} ({result['pinner']['username']})",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -506,15 +506,14 @@ class Compass(msgspec.Struct):
|
|||||||
return self.val
|
return self.val
|
||||||
raise ValueError(f"unknown unit: {unit}")
|
raise ValueError(f"unknown unit: {unit}")
|
||||||
|
|
||||||
@classmethod
|
def point(self, azimuth: float | int) -> CompassPoint:
|
||||||
def point(cls, azimuth: float | int) -> CompassPoint:
|
|
||||||
"""Returns the compass point to an azimuth value."""
|
"""Returns the compass point to an azimuth value."""
|
||||||
azimuth = azimuth % cls.TURN
|
azimuth = azimuth % self.TURN
|
||||||
# The angle sector of a compass point starts 1/2 sector range before
|
# The angle sector of a compass point starts 1/2 sector range before
|
||||||
# and after compass point (example: "N" goes from -11.25° to +11.25°)
|
# and after compass point (example: "N" goes from -11.25° to +11.25°)
|
||||||
azimuth = azimuth - cls.RANGE / 2
|
azimuth = azimuth - self.RANGE / 2
|
||||||
idx = int(azimuth // cls.RANGE)
|
idx = int(azimuth // self.RANGE)
|
||||||
return cls.POINTS[idx]
|
return self.POINTS[idx]
|
||||||
|
|
||||||
def l10n(
|
def l10n(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user