update_roms.py 699 B

12345678910111213141516171819202122
  1. from django.core.management.base import BaseCommand, CommandError
  2. from django.conf import settings
  3. from games.tasks import update_roms
  4. class Command(BaseCommand):
  5. help = "Scrape + import all games for all systems"
  6. def add_arguments(self, parser):
  7. parser.add_argument(
  8. "--full-scan",
  9. action="store_true",
  10. help="Update all files, even ones we already know about",
  11. )
  12. def handle(self, *args, **options):
  13. all_slugs = settings.GAME_SYSTEM_DEFAULTS.keys()
  14. update_roms(all_slugs, full_scan=options["full_scan"])
  15. self.stdout.write(
  16. self.style.SUCCESS("Successfully scraped and imported roms")
  17. )