35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from django.core.management.base import BaseCommand
|
|
from vrobbler.apps.scrobbles.importers import webdav
|
|
|
|
|
|
class Command(BaseCommand):
|
|
def add_arguments(self, parser):
|
|
parser.add_argument(
|
|
"--restart",
|
|
action="store_true",
|
|
help="Restart failed imports",
|
|
)
|
|
parser.add_argument(
|
|
"--update-retroarch-hash",
|
|
action="store_true",
|
|
help="Update retroarch files_hash to new ETag-based scheme "
|
|
"without re-importing (migration helper)",
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
restart = False
|
|
if options["restart"]:
|
|
restart = True
|
|
update_hash = options.get("update_retroarch_hash", False)
|
|
ko_count, gpx_count, retro_count, bgstats_count, ebird_count, scale_count = (
|
|
webdav.import_from_webdav_for_all_users(
|
|
restart=restart,
|
|
update_retroarch_hash=update_hash,
|
|
)
|
|
)
|
|
print(
|
|
f"Started {ko_count} KOReader, {gpx_count} Trail GPX, "
|
|
f"{retro_count} Retroarch, {bgstats_count} BGStats, "
|
|
f"{ebird_count} eBird, {scale_count} Scale WebDAV imports"
|
|
)
|