Files
vrobbler/vrobbler/apps/scrobbles/management/commands/import_from_webdav.py
Colin Powell 62d8ffd794
All checks were successful
build & deploy / test (push) Successful in 2m1s
build & deploy / build-and-deploy (push) Successful in 29s
[importers] Add flag to reimport already processed files
2026-05-28 17:19:08 -04:00

45 lines
1.6 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)",
)
parser.add_argument(
"--update-koreader-etag",
action="store_true",
help="Store current WebDAV ETag on last KoReader import "
"without re-importing (migration helper)",
)
parser.add_argument(
"--include-processed",
action="store_true",
help="Also import files already moved to processed/ subdirectories "
"(may produce duplicate scrobbles; use with care on production)",
)
def handle(self, *args, **options):
restart = False
if options["restart"]:
restart = True
update_hash = options.get("update_retroarch_hash", False)
update_etag = options.get("update_koreader_etag", False)
include_processed = options.get("include_processed", False)
webdav.import_from_webdav_for_all_users(
restart=restart,
update_retroarch_hash=update_hash,
update_koreader_etag=update_etag,
include_processed=include_processed,
)