WebashalarForML commited on
Commit
30f8c44
·
verified ·
1 Parent(s): 4e706fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1958,16 +1958,17 @@ def similarity_matching(input_json_path: str, project_folder:str) -> str:
1958
  for sprite_idx, matched_idx in enumerate(most_similar_indices):
1959
  matched_image_path = folder_image_paths[matched_idx]
1960
  matched_image_path = os.path.normpath(matched_image_path)
1961
-
1962
  matched_folder = os.path.dirname(matched_image_path)
1963
  #folder_name = os.path.basename(matched_folder)
1964
-
1965
  if matched_folder in copied_folders:
1966
  continue
1967
  copied_folders.add(matched_folder)
1968
  logger.info(f"Matched image path: {matched_image_path}")
1969
 
1970
  sprite_json_path = os.path.join(matched_folder, 'sprite.json')
 
1971
  if not os.path.exists(sprite_json_path):
1972
  logger.warning(f"sprite.json not found in: {matched_folder}")
1973
  continue
@@ -1982,6 +1983,7 @@ def similarity_matching(input_json_path: str, project_folder:str) -> str:
1982
  # shutil.copy2(fpath, os.path.join(project_folder, fname))
1983
  # # logger.info(f"Copied Sprite asset: {fname}")
1984
  project_data.append(sprite_data)
 
1985
  for fname in os.listdir(matched_folder):
1986
  fpath = os.path.join(matched_folder, fname)
1987
  dest_path = os.path.join(project_folder, fname)
@@ -1998,10 +2000,11 @@ def similarity_matching(input_json_path: str, project_folder:str) -> str:
1998
 
1999
  for backdrop_idx, matched_idx in enumerate(most_similar_indices):
2000
  matched_image_path = os.path.normpath(folder_image_paths[matched_idx])
2001
-
2002
  # Check if the match is from the Backdrops folder
2003
  if matched_image_path.startswith(os.path.normpath(backdrop_images_path)):
2004
  matched_folder = os.path.dirname(matched_image_path)
 
2005
  folder_name = os.path.basename(matched_folder)
2006
 
2007
  logger.info(f"Backdrop matched image: {matched_image_path}")
@@ -2022,6 +2025,7 @@ def similarity_matching(input_json_path: str, project_folder:str) -> str:
2022
 
2023
  # Append backdrop's project.json
2024
  backdrop_json_path = os.path.join(matched_folder, 'project.json')
 
2025
  if os.path.exists(backdrop_json_path):
2026
  with open(backdrop_json_path, 'r') as f:
2027
  backdrop_json_data = json.load(f)
 
1958
  for sprite_idx, matched_idx in enumerate(most_similar_indices):
1959
  matched_image_path = folder_image_paths[matched_idx]
1960
  matched_image_path = os.path.normpath(matched_image_path)
1961
+ print(" --------------------------------------1- matched_image_path ---------------------------------------",matched_image_path)
1962
  matched_folder = os.path.dirname(matched_image_path)
1963
  #folder_name = os.path.basename(matched_folder)
1964
+ print(" --------------------------------------1- matched_folder ---------------------------------------",matched_folder)
1965
  if matched_folder in copied_folders:
1966
  continue
1967
  copied_folders.add(matched_folder)
1968
  logger.info(f"Matched image path: {matched_image_path}")
1969
 
1970
  sprite_json_path = os.path.join(matched_folder, 'sprite.json')
1971
+ print(" --------------------------------------- sprite_json_path ---------------------------------------",sprite_json_path)
1972
  if not os.path.exists(sprite_json_path):
1973
  logger.warning(f"sprite.json not found in: {matched_folder}")
1974
  continue
 
1983
  # shutil.copy2(fpath, os.path.join(project_folder, fname))
1984
  # # logger.info(f"Copied Sprite asset: {fname}")
1985
  project_data.append(sprite_data)
1986
+ print(" --------------------------------------1- project_data ---------------------------------------",project_data)
1987
  for fname in os.listdir(matched_folder):
1988
  fpath = os.path.join(matched_folder, fname)
1989
  dest_path = os.path.join(project_folder, fname)
 
2000
 
2001
  for backdrop_idx, matched_idx in enumerate(most_similar_indices):
2002
  matched_image_path = os.path.normpath(folder_image_paths[matched_idx])
2003
+ print(" --------------------------------------2- matched_image_path ---------------------------------------",matched_image_path)
2004
  # Check if the match is from the Backdrops folder
2005
  if matched_image_path.startswith(os.path.normpath(backdrop_images_path)):
2006
  matched_folder = os.path.dirname(matched_image_path)
2007
+ print(" --------------------------------------2- matched_folder ---------------------------------------",matched_folder)
2008
  folder_name = os.path.basename(matched_folder)
2009
 
2010
  logger.info(f"Backdrop matched image: {matched_image_path}")
 
2025
 
2026
  # Append backdrop's project.json
2027
  backdrop_json_path = os.path.join(matched_folder, 'project.json')
2028
+ print(" --------------------------------------2- backdrop_json_path ---------------------------------------",backdrop_json_path)
2029
  if os.path.exists(backdrop_json_path):
2030
  with open(backdrop_json_path, 'r') as f:
2031
  backdrop_json_data = json.load(f)