prthm11 commited on
Commit
94e116d
·
verified ·
1 Parent(s): 591a36f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -0
app.py CHANGED
@@ -2227,6 +2227,56 @@ def similarity_matching(sprites_data: str, project_folder: str) -> str:
2227
  "textToSpeechLanguage": None
2228
  }
2229
  final_project["targets"].insert(0, stage_obj)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2230
 
2231
  with open(project_json_path, 'w') as f:
2232
  json.dump(final_project, f, indent=2)
 
2227
  "textToSpeechLanguage": None
2228
  }
2229
  final_project["targets"].insert(0, stage_obj)
2230
+ else:
2231
+ logger.warning("⚠️ No backdrop matched. Using default static backdrop.")
2232
+ default_backdrop_path = BACKDROP_DIR / "plain_white.svg"
2233
+ default_backdrop_name = "plain_white.svg"
2234
+
2235
+ try:
2236
+ shutil.copy2(default_backdrop_path, os.path.join(project_folder, default_backdrop_name))
2237
+ logger.info(f"✅ Default backdrop copied to project: {default_backdrop_name}")
2238
+ except Exception as e:
2239
+ logger.error(f"❌ Failed to copy default backdrop: {e}")
2240
+
2241
+ stage_obj={
2242
+ "isStage": True,
2243
+ "name": "Stage",
2244
+ "objName": "Stage",
2245
+ "variables": {},
2246
+ "lists": {},
2247
+ "broadcasts": {},
2248
+ "blocks": {},
2249
+ "comments": {},
2250
+ "currentCostume": 0,
2251
+ "costumes": [
2252
+ {
2253
+ "assetId": default_backdrop_name.split(".")[0],
2254
+ "name": "defaultBackdrop",
2255
+ "md5ext": default_backdrop_name,
2256
+ "dataFormat": "png",
2257
+ "rotationCenterX": 240,
2258
+ "rotationCenterY": 180
2259
+ }
2260
+ ],
2261
+ "sounds": [
2262
+ {
2263
+ "name": "pop",
2264
+ "assetId": "83a9787d4cb6f3b7632b4ddfebf74367",
2265
+ "dataFormat": "wav",
2266
+ "format": "",
2267
+ "rate": 48000,
2268
+ "sampleCount": 1123,
2269
+ "md5ext": "83a9787d4cb6f3b7632b4ddfebf74367.wav"
2270
+ }
2271
+ ],
2272
+ "volume": 100,
2273
+ "layerOrder": 0,
2274
+ "tempo": 60,
2275
+ "videoTransparency": 50,
2276
+ "videoState": "on",
2277
+ "textToSpeechLanguage": None
2278
+ }
2279
+ final_project["targets"].insert(0, stage_obj)
2280
 
2281
  with open(project_json_path, 'w') as f:
2282
  json.dump(final_project, f, indent=2)