Romlister Link ๐ข
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])
if args.list_only or not args.output: for rom in lister.get_list(clean_names=args.clean_names): print(rom) else: if args.format == "txt": lister.export_txt(args.output, clean_names=args.clean_names) elif args.format == "csv": lister.export_csv(args.output, clean_names=args.clean_names) elif args.format == "json": lister.export_json(args.output, clean_names=args.clean_names) print(f"Exported to args.output") if == " main ": main() ๐งช Usage Examples # List all NES ROMs in folder python romlister.py ~/roms/nes -e nes -r List SNES ROMs larger than 1 MB, output as JSON python romlister.py ~/roms/snes -e sfc -r --min-size 1048576 -f json -o snes_large.json Find ROMs with "Mario" in name, clean tags, print to console python romlister.py ~/roms -r -p "Mario" --clean-names --list-only Export all .iso/.bin files recursively to CSV python romlister.py ~/roms/psx -e iso bin -r -f csv -o psx_roms.csv ๐ง Possible Extensions (if you want to expand) | Feature | Description | |--------|-------------| | ROM metadata | Read headers (e.g., iNES for NES) to show game title, mapper, etc. | | CRC/SHA verification | Compare against No-Intro/Redump DAT files | | Duplicate finder | Group by size/hash to find duplicates | | Web UI | Expose as a Flask app with live filtering | | Launch integration | Launch selected ROM with emulator | โ Sample Output Super Mario Bros Legend of Zelda Metroid Contra or as JSON: romlister
if args.extensions: lister.filter_by_extension(args.extensions) if args.min_size is not None or args.max_size is not None: lister.filter_by_size(args.min_size, args.max_size) if args.pattern: lister.filter_by_name_pattern(args.pattern) clean_names=False): with open(filepath
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') name): """Remove common tags like (USA)
lister = RomLister(args.directory, recursive=args.recursive) lister.scan()
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 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).