@@ -152,8 +152,16 @@ def take_screenshot(driver, url, screenshot_file):
152152if __name__ == "__main__" :
153153 base_dir = get_base_dir ()
154154
155- # Get the latest added file from git
156- latest_file = get_latest_git_added_file ("tools" , base_dir ) or get_latest_git_added_file ("games" , base_dir )
155+ # Ask the user what type of entry they're adding
156+ entry_type = ""
157+ while entry_type not in ["tool" , "game" ]:
158+ entry_type = input ("Are you adding a tool or a game? (tool/game): " ).lower ()
159+ if entry_type not in ["tool" , "game" ]:
160+ print ("Please enter either 'tool' or 'game'." )
161+
162+ # Get the latest added file from git based on the entry type
163+ directory = "tools" if entry_type == "tool" else "games"
164+ latest_file = get_latest_git_added_file (directory , base_dir )
157165
158166 if latest_file :
159167 file_path = latest_file
@@ -174,7 +182,8 @@ def take_screenshot(driver, url, screenshot_file):
174182 if confirm != "yes" :
175183 entry_name = input ("Enter the tool/game name: " )
176184 else :
177- file_path = input ("Enter the file path: " )
185+ print (f"No recently added file found in the { directory } directory." )
186+ file_path = input (f"Enter the { entry_type } file path: " )
178187 full_path = base_dir / file_path
179188
180189 # Try to extract name from HTML title
@@ -184,15 +193,12 @@ def take_screenshot(driver, url, screenshot_file):
184193 print (f"Found title in HTML: { entry_name } " )
185194 confirm = input (f"Use '{ entry_name } ' as the name? (yes/no): " ).lower ()
186195 if confirm != "yes" :
187- entry_name = input ("Enter the tool/game name: " )
196+ entry_name = input (f "Enter the { entry_type } name: " )
188197 else :
189- entry_name = input ("Enter the tool/game name: " )
198+ entry_name = input (f "Enter the { entry_type } name: " )
190199
191200 description = input ("Enter the description: " )
192201
193- # Determine if it's a tool or game based on the file path
194- entry_type = "tool" if "tools" in file_path .lower () else "game"
195-
196202 # Ask for additional JSON fields
197203 ai_powered = input ("Is this AI powered? (yes/no): " ).lower () == "yes"
198204 featured = input ("Should this be featured? (yes/no): " ).lower () == "yes"
0 commit comments