Romlister Direct

I'll help you develop a feature — a tool that scans a directory of ROM files (for emulators) and outputs a filtered, searchable list based on various criteria (e.g., genre, region, file size, or custom tags).

class RomLister: def (self, root_path, recursive=True): self.root_path = Path(root_path) self.recursive = recursive self.roms = [] romlister

def clean_name(self, name): """Remove common tags like (USA), [Rev A], etc.""" # Remove parentheses content name = re.sub(r'\([^)]*\)', '', name) # Remove brackets content name = re.sub(r'\[[^]]*\]', '', name) # Remove extra spaces and underscores name = re.sub(r'[_]+', ' ', name) name = re.sub(r'\s+', ' ', name).strip() return name I'll help you develop a feature — a

def export_csv(self, filepath, clean_names=False): with open(filepath, 'w', newline='', encoding='utf-8') as f: writer = csv.writer(f) writer.writerow(['filename' if not clean_names else 'clean_name']) for item in self.get_list(clean_names): writer.writerow([item]) name): """Remove common tags like (USA)

def export_json(self, filepath, clean_names=False): with open(filepath, 'w', encoding='utf-8') as f: json.dump(self.get_list(clean_names), f, indent=2) CLI Interface ------------------------------ def main(): parser = argparse.ArgumentParser(description="RomLister - Scan and filter ROM collections") parser.add_argument("directory", help="Root directory to scan for ROMs") parser.add_argument("-r", "--recursive", action="store_true", help="Scan subfolders recursively") parser.add_argument("-e", "--extensions", nargs="+", help="File extensions to include (e.g., nes sfc iso)") parser.add_argument("--min-size", type=int, help="Minimum file size in bytes") parser.add_argument("--max-size", type=int, help="Maximum file size in bytes") parser.add_argument("-p", "--pattern", help="Regex pattern to filter by filename") parser.add_argument("-c", "--clean-names", action="store_true", help="Remove region/version tags") parser.add_argument("-o", "--output", help="Output file path") parser.add_argument("-f", "--format", choices=["txt", "csv", "json"], default="txt", help="Output format") parser.add_argument("--list-only", action="store_true", help="Print list to console")

def export_txt(self, filepath, clean_names=False): with open(filepath, 'w', encoding='utf-8') as f: for item in self.get_list(clean_names): f.write(item + '\n')