Add task to sync with last.fm

This commit is contained in:
2023-02-16 02:27:39 -05:00
parent cc82504262
commit 21df4e0a77
7 changed files with 275 additions and 201 deletions

View File

@ -0,0 +1,15 @@
import logging
from celery import shared_task
from scrobbles.models import LastFmImport
logger = logging.getLogger(__name__)
@shared_task
def process_lastfm_import(import_id):
lastfm_import = LastFmImport.objects.filter(id=import_id).first()
if not lastfm_import:
logger.warn(f"LastFmImport not found with id {import_id}")
lastfm_import.process()

View File

@ -12,6 +12,7 @@ urlpatterns = [
views.AudioScrobblerImportCreateView.as_view(),
name='audioscrobbler-file-upload',
),
path('lastfm-import/', views.lastfm_import, name='lastfm-import'),
path('jellyfin/', views.jellyfin_websocket, name='jellyfin-websocket'),
path('mopidy/', views.mopidy_websocket, name='mopidy-websocket'),
path('export/', views.export, name='export'),