from django.core.management.base import BaseCommand
from vrobbler.apps.scrobbles.importers.imap import import_scrobbles_from_imap


class Command(BaseCommand):
    def add_arguments(self, parser):
        parser.add_argument(
            "--restart",
            action="store_true",
            help="Restart failed imports",
        )

    def handle(self, *args, **options):
        count = len(import_scrobbles_from_imap())
        print(f"Started {count} IMAP imports")
