esentity 0.2.293__tar.gz → 0.2.295__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: esentity
3
- Version: 0.2.293
3
+ Version: 0.2.295
4
4
  Summary: Elasticsearch Entity Tools
5
5
  Home-page: https://slotmarks.com
6
6
  Author: Slotmarks
@@ -0,0 +1 @@
1
+ __version__ = '0.2.295'
@@ -1788,17 +1788,33 @@ class ApiContentSlots(Resource):
1788
1788
  _sort=_sort,
1789
1789
  )
1790
1790
 
1791
- def process_page(item, process_content=False):
1791
+ def process_page(item, process_content=False, process_media=False):
1792
1792
  _doc = item['_source']
1793
1793
  _doc['id'] = item['_id']
1794
1794
  _doc['full_path'] = get_page_url(_doc, True)
1795
+
1796
+ if process_media:
1797
+ if _doc['cover']:
1798
+ path = current_app.images.path(_doc['cover'])
1799
+ if os.path.isfile(path):
1800
+ image = Image.open(path)
1801
+ w, h = image.size
1802
+ _doc['cover_info'] = f'{w}x{h}'
1803
+
1804
+ if _doc['screen']:
1805
+ path = current_app.images.path(_doc['screen'])
1806
+ if os.path.isfile(path):
1807
+ image = Image.open(path)
1808
+ w, h = image.size
1809
+ _doc['screen_info'] = f'{w}x{h}'
1810
+
1795
1811
  if process_content:
1796
1812
  _doc.update(process_content_stats(_doc.get('content')))
1797
1813
  return _doc
1798
1814
 
1799
1815
  return {
1800
1816
  'ok': True,
1801
- 'items': [process_page(item, process_content='columns' in data and 'content' in data['columns']) for item in pages],
1817
+ 'items': [process_page(item, process_content='columns' in data and 'content' in data['columns'], process_media='columns' in data and 'media' in data['columns']) for item in pages],
1802
1818
  'total': total,
1803
1819
  }
1804
1820
 
@@ -520,7 +520,7 @@ class TopSlotsExtension(Extension):
520
520
  logger.info('Top Slots IN Args: {0}'.format(args))
521
521
 
522
522
  default = [[], 8, 4, False, True, [{'rating': {'order': 'desc'}}], 'slots_list']
523
- args = args[:4] + default[len(args):] + args[4:]
523
+ args = args[:6] + default[len(args):] + args[6:]
524
524
 
525
525
  logger.info('Top Slots OUT Args: {0}'.format(args))
526
526
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "esentity"
3
- version = "0.2.293"
3
+ version = "0.2.295"
4
4
  description = "Elasticsearch Entity Tools"
5
5
  authors = ["Slotmarks <info@slotmarks.com>"]
6
6
  homepage = "https://slotmarks.com"
@@ -9,7 +9,7 @@ package_data = \
9
9
 
10
10
  setup_kwargs = {
11
11
  'name': 'esentity',
12
- 'version': '0.2.293',
12
+ 'version': '0.2.295',
13
13
  'description': 'Elasticsearch Entity Tools',
14
14
  'long_description': None,
15
15
  'author': 'Slotmarks',
@@ -1 +0,0 @@
1
- __version__ = '0.2.293'
File without changes