superbrain-server 1.0.39 → 1.0.41

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.39",
3
+ "version": "1.0.41",
4
4
  "description": "1-Line Auto-Installer and Server Execution wrapper for SuperBrain",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -141,22 +141,21 @@ async def _shazam_multi_segment(audio_path: str) -> dict | None:
141
141
  label = f"@{int(start)}s" if start > 0 else "start"
142
142
  print(f" [Shazam] {i}/{total} {label}...", end=" ", flush=True)
143
143
 
144
- # NEVER pass the raw original file to Shazam on AWS t2.micro, because
145
- # shazamio does a pure-Python FFT over the ENTIRE file length before sending!
146
- # A 60 second file's FFT will easily hit a 60-second timeout on a micro vCPU.
147
- # We MUST slice it to a tiny segment first using ffmpeg.
148
- seg = _extract_segment(audio_path, start, duration=12)
149
- if not seg:
150
- print("(extract failed)")
151
- continue
152
-
153
- try:
154
- result = await _shazam_recognize_file(shazam, seg)
155
- finally:
144
+ if False: # Prevent using full file which causes 100% CPU lock on EC2 t2.micro
145
+ # Try the original file first (no re-encoding overhead)
146
+ result = await _shazam_recognize_file(shazam, audio_path)
147
+ else:
148
+ seg = _extract_segment(audio_path, start, duration=12)
149
+ if not seg:
150
+ print("(extract failed)")
151
+ continue
156
152
  try:
157
- os.remove(seg)
158
- except Exception:
159
- pass
153
+ result = await _shazam_recognize_file(shazam, seg)
154
+ finally:
155
+ try:
156
+ os.remove(seg)
157
+ except Exception:
158
+ pass
160
159
 
161
160
  if result:
162
161
  print("match!")
@@ -3,8 +3,8 @@
3
3
  "key": "groq_gpt_oss_20b",
4
4
  "avg_response_s": 1.6824798610496439,
5
5
  "success_count": 67,
6
- "fail_count": 6,
7
- "down_until": "2026-04-09T11:17:32.912600",
6
+ "fail_count": 5,
7
+ "down_until": "2026-04-09T08:35:19.373545",
8
8
  "last_used": "2026-04-08T07:38:04.817302",
9
9
  "last_error": "No module named 'groq'",
10
10
  "base_priority": 0.5
@@ -13,8 +13,8 @@
13
13
  "key": "groq_llama33_70b",
14
14
  "avg_response_s": 1.423364281654358,
15
15
  "success_count": 2,
16
- "fail_count": 5,
17
- "down_until": "2026-04-09T11:17:32.914114",
16
+ "fail_count": 4,
17
+ "down_until": "2026-04-09T08:35:19.375545",
18
18
  "last_used": "2026-02-24T07:53:30.927446",
19
19
  "last_error": "No module named 'groq'",
20
20
  "base_priority": 1
@@ -23,8 +23,8 @@
23
23
  "key": "groq_llama4_scout",
24
24
  "avg_response_s": null,
25
25
  "success_count": 0,
26
- "fail_count": 5,
27
- "down_until": "2026-04-09T11:17:32.915617",
26
+ "fail_count": 4,
27
+ "down_until": "2026-04-09T08:35:19.375545",
28
28
  "last_used": null,
29
29
  "last_error": "No module named 'groq'",
30
30
  "base_priority": 1.5
@@ -33,8 +33,8 @@
33
33
  "key": "groq_llama31_8b",
34
34
  "avg_response_s": null,
35
35
  "success_count": 0,
36
- "fail_count": 5,
37
- "down_until": "2026-04-09T11:17:32.917639",
36
+ "fail_count": 4,
37
+ "down_until": "2026-04-09T08:35:19.375545",
38
38
  "last_used": null,
39
39
  "last_error": "No module named 'groq'",
40
40
  "base_priority": 2
@@ -43,8 +43,8 @@
43
43
  "key": "groq_qwen3_32b",
44
44
  "avg_response_s": null,
45
45
  "success_count": 0,
46
- "fail_count": 5,
47
- "down_until": "2026-04-09T11:17:32.918622",
46
+ "fail_count": 4,
47
+ "down_until": "2026-04-09T08:35:19.379702",
48
48
  "last_used": null,
49
49
  "last_error": "No module named 'groq'",
50
50
  "base_priority": 2.5
@@ -53,8 +53,8 @@
53
53
  "key": "groq_gpt_oss_120b",
54
54
  "avg_response_s": null,
55
55
  "success_count": 0,
56
- "fail_count": 5,
57
- "down_until": "2026-04-09T11:17:32.919638",
56
+ "fail_count": 4,
57
+ "down_until": "2026-04-09T08:35:19.381811",
58
58
  "last_used": null,
59
59
  "last_error": "No module named 'groq'",
60
60
  "base_priority": 3
@@ -63,8 +63,8 @@
63
63
  "key": "groq_gemma2_9b",
64
64
  "avg_response_s": null,
65
65
  "success_count": 0,
66
- "fail_count": 5,
67
- "down_until": "2026-04-09T11:17:32.921624",
66
+ "fail_count": 4,
67
+ "down_until": "2026-04-09T08:35:19.381811",
68
68
  "last_used": null,
69
69
  "last_error": "No module named 'groq'",
70
70
  "base_priority": 3.5
@@ -73,8 +73,8 @@
73
73
  "key": "groq_deepseek_r1_32b",
74
74
  "avg_response_s": null,
75
75
  "success_count": 0,
76
- "fail_count": 5,
77
- "down_until": "2026-04-09T11:17:32.923129",
76
+ "fail_count": 4,
77
+ "down_until": "2026-04-09T08:35:19.381811",
78
78
  "last_used": null,
79
79
  "last_error": "No module named 'groq'",
80
80
  "base_priority": 3.8
@@ -83,8 +83,8 @@
83
83
  "key": "gemini_25_flash",
84
84
  "avg_response_s": null,
85
85
  "success_count": 0,
86
- "fail_count": 6,
87
- "down_until": "2026-04-09T11:17:32.924158",
86
+ "fail_count": 5,
87
+ "down_until": "2026-04-09T08:35:19.381811",
88
88
  "last_used": null,
89
89
  "last_error": "No module named 'google'",
90
90
  "base_priority": 4
@@ -93,8 +93,8 @@
93
93
  "key": "gemini_25_flash_lite",
94
94
  "avg_response_s": null,
95
95
  "success_count": 0,
96
- "fail_count": 6,
97
- "down_until": "2026-04-09T11:17:32.925686",
96
+ "fail_count": 5,
97
+ "down_until": "2026-04-09T08:35:19.381811",
98
98
  "last_used": null,
99
99
  "last_error": "No module named 'google'",
100
100
  "base_priority": 4.5
@@ -103,8 +103,8 @@
103
103
  "key": "gemini_25_pro",
104
104
  "avg_response_s": null,
105
105
  "success_count": 0,
106
- "fail_count": 6,
107
- "down_until": "2026-04-09T11:17:32.926717",
106
+ "fail_count": 5,
107
+ "down_until": "2026-04-09T08:35:19.388868",
108
108
  "last_used": null,
109
109
  "last_error": "No module named 'google'",
110
110
  "base_priority": 5
@@ -113,8 +113,8 @@
113
113
  "key": "gemini_3_flash",
114
114
  "avg_response_s": null,
115
115
  "success_count": 0,
116
- "fail_count": 6,
117
- "down_until": "2026-04-09T11:17:32.928793",
116
+ "fail_count": 5,
117
+ "down_until": "2026-04-09T08:35:19.390162",
118
118
  "last_used": null,
119
119
  "last_error": "No module named 'google'",
120
120
  "base_priority": 5.5
@@ -123,8 +123,8 @@
123
123
  "key": "gemini_3_pro",
124
124
  "avg_response_s": null,
125
125
  "success_count": 0,
126
- "fail_count": 6,
127
- "down_until": "2026-04-09T11:17:32.929795",
126
+ "fail_count": 5,
127
+ "down_until": "2026-04-09T08:35:19.392674",
128
128
  "last_used": null,
129
129
  "last_error": "No module named 'google'",
130
130
  "base_priority": 6
@@ -133,8 +133,8 @@
133
133
  "key": "gemini_31_pro",
134
134
  "avg_response_s": null,
135
135
  "success_count": 0,
136
- "fail_count": 6,
137
- "down_until": "2026-04-09T11:17:32.931795",
136
+ "fail_count": 5,
137
+ "down_until": "2026-04-09T08:35:19.392674",
138
138
  "last_used": null,
139
139
  "last_error": "No module named 'google'",
140
140
  "base_priority": 6.5
@@ -143,8 +143,8 @@
143
143
  "key": "gemini_20_flash",
144
144
  "avg_response_s": null,
145
145
  "success_count": 0,
146
- "fail_count": 6,
147
- "down_until": "2026-04-09T11:17:32.932793",
146
+ "fail_count": 5,
147
+ "down_until": "2026-04-09T08:35:19.394687",
148
148
  "last_used": null,
149
149
  "last_error": "No module named 'google'",
150
150
  "base_priority": 7
@@ -153,8 +153,8 @@
153
153
  "key": "gemini_20_flash_lite",
154
154
  "avg_response_s": null,
155
155
  "success_count": 0,
156
- "fail_count": 6,
157
- "down_until": "2026-04-09T11:17:32.934870",
156
+ "fail_count": 5,
157
+ "down_until": "2026-04-09T08:35:19.395770",
158
158
  "last_used": null,
159
159
  "last_error": "No module named 'google'",
160
160
  "base_priority": 7.5
@@ -163,8 +163,8 @@
163
163
  "key": "gemini_15_flash",
164
164
  "avg_response_s": null,
165
165
  "success_count": 0,
166
- "fail_count": 6,
167
- "down_until": "2026-04-09T11:17:32.936351",
166
+ "fail_count": 5,
167
+ "down_until": "2026-04-09T08:35:19.395770",
168
168
  "last_used": null,
169
169
  "last_error": "No module named 'google'",
170
170
  "base_priority": 8
@@ -303,8 +303,8 @@
303
303
  "key": "local_qwen3",
304
304
  "avg_response_s": null,
305
305
  "success_count": 0,
306
- "fail_count": 6,
307
- "down_until": "2026-04-09T11:17:32.937926",
306
+ "fail_count": 5,
307
+ "down_until": "2026-04-09T08:35:19.395770",
308
308
  "last_used": null,
309
309
  "last_error": "No module named 'ollama'",
310
310
  "base_priority": 100
@@ -313,8 +313,8 @@
313
313
  "key": "gemini_25_flash_vision",
314
314
  "avg_response_s": 15.284299373626709,
315
315
  "success_count": 1,
316
- "fail_count": 6,
317
- "down_until": "2026-04-09T11:17:32.574791",
316
+ "fail_count": 5,
317
+ "down_until": "2026-04-09T08:35:19.045473",
318
318
  "last_used": "2026-02-24T06:25:56.490384",
319
319
  "last_error": "No module named 'google'",
320
320
  "base_priority": 1
@@ -323,8 +323,8 @@
323
323
  "key": "gemini_25_flash_lite_vision",
324
324
  "avg_response_s": 6.709401964075168,
325
325
  "success_count": 14,
326
- "fail_count": 19,
327
- "down_until": "2026-04-09T11:17:32.565280",
326
+ "fail_count": 18,
327
+ "down_until": "2026-04-09T08:35:19.038662",
328
328
  "last_used": "2026-02-24T09:45:09.831171",
329
329
  "last_error": "No module named 'google'",
330
330
  "base_priority": 1.5
@@ -333,8 +333,8 @@
333
333
  "key": "gemini_25_pro_vision",
334
334
  "avg_response_s": null,
335
335
  "success_count": 0,
336
- "fail_count": 22,
337
- "down_until": "2026-04-09T11:17:32.563061",
336
+ "fail_count": 21,
337
+ "down_until": "2026-04-09T08:35:19.035677",
338
338
  "last_used": null,
339
339
  "last_error": "No module named 'google'",
340
340
  "base_priority": 2
@@ -343,8 +343,8 @@
343
343
  "key": "gemini_3_flash_vision",
344
344
  "avg_response_s": 22.28640604019165,
345
345
  "success_count": 1,
346
- "fail_count": 6,
347
- "down_until": "2026-04-09T11:17:32.578790",
346
+ "fail_count": 5,
347
+ "down_until": "2026-04-09T08:35:19.051420",
348
348
  "last_used": "2026-02-24T07:50:22.906246",
349
349
  "last_error": "No module named 'google'",
350
350
  "base_priority": 2.5
@@ -353,8 +353,8 @@
353
353
  "key": "gemini_3_pro_vision",
354
354
  "avg_response_s": null,
355
355
  "success_count": 0,
356
- "fail_count": 21,
357
- "down_until": "2026-04-09T11:17:32.564279",
356
+ "fail_count": 20,
357
+ "down_until": "2026-04-09T08:35:19.035677",
358
358
  "last_used": null,
359
359
  "last_error": "No module named 'google'",
360
360
  "base_priority": 3
@@ -363,8 +363,8 @@
363
363
  "key": "gemini_31_pro_vision",
364
364
  "avg_response_s": null,
365
365
  "success_count": 0,
366
- "fail_count": 20,
367
- "down_until": "2026-04-09T11:17:32.567280",
366
+ "fail_count": 19,
367
+ "down_until": "2026-04-09T08:35:19.038662",
368
368
  "last_used": null,
369
369
  "last_error": "No module named 'google'",
370
370
  "base_priority": 3.5
@@ -373,8 +373,8 @@
373
373
  "key": "gemini_20_flash_vision",
374
374
  "avg_response_s": null,
375
375
  "success_count": 0,
376
- "fail_count": 19,
377
- "down_until": "2026-04-09T11:17:32.568280",
376
+ "fail_count": 18,
377
+ "down_until": "2026-04-09T08:35:19.041637",
378
378
  "last_used": null,
379
379
  "last_error": "No module named 'google'",
380
380
  "base_priority": 4
@@ -383,8 +383,8 @@
383
383
  "key": "gemini_20_flash_lite_vision",
384
384
  "avg_response_s": null,
385
385
  "success_count": 0,
386
- "fail_count": 19,
387
- "down_until": "2026-04-09T11:17:32.570280",
386
+ "fail_count": 18,
387
+ "down_until": "2026-04-09T08:35:19.041637",
388
388
  "last_used": null,
389
389
  "last_error": "No module named 'google'",
390
390
  "base_priority": 4.5
@@ -393,8 +393,8 @@
393
393
  "key": "gemini_15_flash_vision",
394
394
  "avg_response_s": null,
395
395
  "success_count": 0,
396
- "fail_count": 19,
397
- "down_until": "2026-04-09T11:17:32.571280",
396
+ "fail_count": 18,
397
+ "down_until": "2026-04-09T08:35:19.041637",
398
398
  "last_used": null,
399
399
  "last_error": "No module named 'google'",
400
400
  "base_priority": 4.8
@@ -403,8 +403,8 @@
403
403
  "key": "groq_llama4_scout_vision",
404
404
  "avg_response_s": 1.2924692601270893,
405
405
  "success_count": 42,
406
- "fail_count": 5,
407
- "down_until": "2026-04-09T11:17:32.573280",
406
+ "fail_count": 4,
407
+ "down_until": "2026-04-09T08:35:19.045473",
408
408
  "last_used": "2026-04-08T07:37:59.761209",
409
409
  "last_error": "No module named 'groq'",
410
410
  "base_priority": 5
@@ -413,8 +413,8 @@
413
413
  "key": "groq_vision_11b",
414
414
  "avg_response_s": null,
415
415
  "success_count": 0,
416
- "fail_count": 5,
417
- "down_until": "2026-04-09T11:17:32.575820",
416
+ "fail_count": 4,
417
+ "down_until": "2026-04-09T08:35:19.048609",
418
418
  "last_used": null,
419
419
  "last_error": "No module named 'groq'",
420
420
  "base_priority": 5.5
@@ -423,8 +423,8 @@
423
423
  "key": "groq_vision_90b",
424
424
  "avg_response_s": null,
425
425
  "success_count": 0,
426
- "fail_count": 5,
427
- "down_until": "2026-04-09T11:17:32.577791",
426
+ "fail_count": 4,
427
+ "down_until": "2026-04-09T08:35:19.048609",
428
428
  "last_used": null,
429
429
  "last_error": "No module named 'groq'",
430
430
  "base_priority": 6
@@ -483,8 +483,8 @@
483
483
  "key": "local_qwen3_vl",
484
484
  "avg_response_s": null,
485
485
  "success_count": 0,
486
- "fail_count": 6,
487
- "down_until": "2026-04-09T11:17:32.579790",
486
+ "fail_count": 5,
487
+ "down_until": "2026-04-09T08:35:19.052215",
488
488
  "last_used": null,
489
489
  "last_error": "No module named 'ollama'",
490
490
  "base_priority": 100
package/payload/fix.py ADDED
@@ -0,0 +1,25 @@
1
+ import re
2
+
3
+ with open(r'd:\superbrain\backend\main.py', 'r', encoding='utf-8') as f:
4
+ code = f.read()
5
+
6
+ # Fix 1: _parse_field for TAGS was reading 📸 and no variable existed for tags init correctly in old code, wait, let's look at what was there.
7
+ code = code.replace(
8
+ 'summary = _parse_field(summary_text, "📸", "TAGS")',
9
+ 'summary = _parse_field(summary_text, "📸", "SUMMARY")\n raw_tags = _parse_field(summary_text, "🏷️", "TAGS")'
10
+ )
11
+
12
+ # Fix 2: inject music extraction
13
+ code = code.replace(
14
+ '# Category: grab first word/phrase',
15
+ '''music = _parse_field(summary_text, "🎵", "MUSIC")
16
+ if not music:
17
+ _mm = re.search(r'(?:^|\\n)\\s*\\*{0,2}MUSIC\\*{0,2}:?\\s*([^\\n]+)', summary_text, re.IGNORECASE)
18
+ if _mm:
19
+ music = _mm.group(1).strip()
20
+
21
+ # Category: grab first word/phrase'''
22
+ )
23
+
24
+ with open(r'd:\superbrain\backend\main.py', 'w', encoding='utf-8') as f:
25
+ f.write(code)
package/payload/main.py CHANGED
@@ -83,7 +83,6 @@ def generate_final_summary(results, instagram_url):
83
83
  music_info = "MUSIC:\n"
84
84
  for item in results['music_identification']:
85
85
  output = item['output']
86
- # Accommodate potential emoji stripping in basic linux terminals
87
86
  if 'Song:' in output:
88
87
  song_line = [line for line in output.split('\n') if 'Song:' in line][0]
89
88
  artist_line = [line for line in output.split('\n') if 'Artist:' in line]
@@ -232,14 +231,14 @@ def parse_summary(summary_text):
232
231
  _tm = re.search(r'(?:^|\n)\s*\*{0,2}TAGS\*{0,2}:?\s*([^\n]+)', summary_text, re.IGNORECASE)
233
232
  if _tm:
234
233
  raw_tags = _tm.group(1).strip()
235
- music = _parse_field(summary_text, "🎶", "MUSIC")
236
- if not music:
237
- music = _parse_field(summary_text, "🎵", "MUSIC")
238
-
234
+ if raw_tags:
235
+ tags = [t.strip() for t in re.split(r'[\s,]+', raw_tags) if t.strip()]
236
+
237
+ music = _parse_field(summary_text, "🎵", "MUSIC")
239
238
  if not music:
240
- _tm = re.search(r'(?:^|\n)\s*\*{0,2}MUSIC\*{0,2}:?\s*([^\n]+)', summary_text, re.IGNORECASE)
241
- if _tm:
242
- music = _tm.group(1).strip()
239
+ _mm = re.search(r'(?:^|\n)\s*\*{0,2}MUSIC\*{0,2}:?\s*([^\n]+)', summary_text, re.IGNORECASE)
240
+ if _mm:
241
+ music = _mm.group(1).strip()
243
242
 
244
243
  # Category: grab first word/phrase that matches a known category
245
244
  raw_cat = _parse_field(summary_text, "📂", "CATEGORY").lower()
@@ -0,0 +1,28 @@
1
+ import asyncio
2
+ import os
3
+ from instagram.instagram_downloader import download_instagram_content
4
+ from analyzers.music_identifier import identify_music
5
+
6
+ async def test():
7
+ print('Downloading...')
8
+ try:
9
+ url = 'https://www.instagram.com/reel/DWGy0xKk0DV/?igsh=bDJ5ZHozOHh6dHFr'
10
+ folder = download_instagram_content(url)
11
+ print('Downloaded to:', folder)
12
+ # Find the .mp3 file in the folder
13
+ audio_path = None
14
+ for root, dirs, files in os.walk(folder):
15
+ for file in files:
16
+ if file.endswith('.mp3'):
17
+ audio_path = os.path.join(root, file)
18
+ break
19
+ print('Identifying music on:', audio_path)
20
+ music_res = await identify_music(audio_path)
21
+ print('Music Result:', music_res)
22
+ except Exception as e:
23
+ print('Error:', e)
24
+ import traceback
25
+ traceback.print_exc()
26
+
27
+ if __name__ == '__main__':
28
+ asyncio.run(test())