diora-web/feeds/management/commands/refresh_newsfeeds.py
mrwnslz 69442f4a4d Smarte Transkription B: Datenmodell, Einstellungen und Test-Endpunkt
TranscriptionSettings (Token Fernet-verschluesselt wie SiteLogin), TranscriptionJob und EpisodeArticle in podcasts; Source.synthetic in feeds, das Refresh, Aufraeumen, OPML-Export, Kommando und Umstellen auf Nachrichten ueberspringt bzw. verweigert. GET/POST /podcasts/transcription/settings/ und POST /podcasts/transcription/test/ (SSRF-Pruefung ueber chapters._open, jetzt auch fuer POST; eingebaute Instanz aus DIORA_WHISPER_URL ausgenommen).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 09:27:01 +01:00

25 lines
980 B
Python

from django.core.management.base import BaseCommand
from django.utils import timezone
from feeds.models import Source
from feeds.refresh import refresh
from podcasts.views import _in_backoff_q
class Command(BaseCommand):
help = 'Refresh the feed reader\'s sources (news and blogs)'
def add_arguments(self, parser):
parser.add_argument('--source-id', type=int, help='Refresh only this source (even when backing off)')
def handle(self, *args, **options):
qs = Source.objects.filter(synthetic=False).select_related('user').order_by('last_refreshed_at')
if options['source_id']:
qs = qs.filter(pk=options['source_id'])
else:
qs = qs.exclude(_in_backoff_q(timezone.now()))
if not qs.exists():
self.stdout.write('No sources to refresh.')
return
refreshed, failed, new = refresh(qs)
self.stdout.write(f'{refreshed} sources refreshed, {failed} failed, +{new} items')