Add ability to restart lastfm imports

This commit is contained in:
2023-04-06 14:00:48 -04:00
parent e487f50683
commit be6b3c5e2e
2 changed files with 20 additions and 5 deletions

View File

@ -1,7 +1,18 @@
from django.core.management.base import BaseCommand, no_translations
from django.core.management.base import BaseCommand
from vrobbler.apps.scrobbles.utils import import_lastfm_for_all_users
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
"--restart",
action="store_true",
help="Restart failed imports",
)
def handle(self, *args, **options):
import_lastfm_for_all_users()
restart = False
if options["restart"]:
restart = True
count = import_lastfm_for_all_users(restart=restart)
print(f"Started {count} LastFM imports")