Files
Subscribarr/arr_api/management/commands/check_new_media.py
2025-08-11 12:27:30 +02:00

15 lines
633 B
Python

from django.core.management.base import BaseCommand
from django.utils import timezone
from arr_api.notifications import check_and_notify_users
class Command(BaseCommand):
help = 'Checks for new media and sends notifications'
def handle(self, *args, **kwargs):
self.stdout.write(f'[{timezone.now()}] Starting media check...')
try:
check_and_notify_users()
self.stdout.write(self.style.SUCCESS(f'[{timezone.now()}] Media check finished successfully'))
except Exception as e:
self.stdout.write(self.style.ERROR(f'[{timezone.now()}] Error during media check: {str(e)}'))