Add task to sync with last.fm
This commit is contained in:
15
vrobbler/apps/scrobbles/tasks.py
Normal file
15
vrobbler/apps/scrobbles/tasks.py
Normal 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()
|
||||
@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user