superbrain-server 1.0.35 → 1.0.36

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superbrain-server",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "1-Line Auto-Installer and Server Execution wrapper for SuperBrain",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -108,7 +108,8 @@ def _segment_positions(duration: float) -> list[float]:
108
108
 
109
109
  async def _shazam_recognize_file(shazam, path: str) -> dict | None:
110
110
  try:
111
- result = await asyncio.wait_for(shazam.recognize(path), timeout=25.0)
111
+ # t2.micro instances easily take 30+ seconds to generate audio fingerprints
112
+ result = await asyncio.wait_for(shazam.recognize(path), timeout=60.0)
112
113
  if result and "track" in result:
113
114
  return result
114
115
  except asyncio.TimeoutError:
package/payload/api.py CHANGED
@@ -1346,6 +1346,9 @@ async def export_data(
1346
1346
  if not url:
1347
1347
  return None
1348
1348
 
1349
+ shortcode = post_dict.get('shortcode')
1350
+ if not shortcode: return None
1351
+
1349
1352
  if url.startswith("/static/"):
1350
1353
  local_path = url.replace("/static/", "", 1)
1351
1354
  full_path = _STATIC_DIR / local_path
@@ -1356,10 +1359,24 @@ async def export_data(
1356
1359
  except Exception as e:
1357
1360
  logger.error(f"Failed bundling local image {url}: {e}")
1358
1361
  return None
1359
-
1360
- shortcode = post_dict.get('shortcode')
1361
- if not shortcode: return None
1362
-
1362
+
1363
+ # Handle base64 encoded data URIs commonly saved by main.py
1364
+ if url.startswith("data:image/"):
1365
+ try:
1366
+ import base64
1367
+ header, encoded = url.split(',', 1)
1368
+ ext = "jpg"
1369
+ if "png" in header.lower(): ext = "png"
1370
+ elif "webp" in header.lower(): ext = "webp"
1371
+
1372
+ img_data = base64.b64decode(encoded)
1373
+ path_in_zip = f"thumbnails/{shortcode}.{ext}"
1374
+ post_dict['thumbnail'] = f"/static/{path_in_zip}"
1375
+ return (path_in_zip, img_data)
1376
+ except Exception as e:
1377
+ logger.error(f"Failed decoding base64 image for {shortcode}: {e}")
1378
+ return None
1379
+
1363
1380
  ext = "jpg"
1364
1381
  if ".png" in url.lower(): ext = "png"
1365
1382
  elif ".webp" in url.lower(): ext = "webp"