|
@@ -1,12 +1,8 @@
|
|
import logging
|
|
import logging
|
|
|
|
|
|
from celery import shared_task
|
|
from celery import shared_task
|
|
|
|
+from django.apps import apps
|
|
from django.contrib.auth import get_user_model
|
|
from django.contrib.auth import get_user_model
|
|
-from scrobbles.models import (
|
|
|
|
- AudioScrobblerTSVImport,
|
|
|
|
- KoReaderImport,
|
|
|
|
- LastFmImport,
|
|
|
|
-)
|
|
|
|
from scrobbles.stats import build_yesterdays_charts_for_user
|
|
from scrobbles.stats import build_yesterdays_charts_for_user
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
logger = logging.getLogger(__name__)
|
|
@@ -15,6 +11,7 @@ User = get_user_model()
|
|
|
|
|
|
@shared_task
|
|
@shared_task
|
|
def process_lastfm_import(import_id):
|
|
def process_lastfm_import(import_id):
|
|
|
|
+ LastFmImport = apps.get_model("scrobbles", "LastFMImport")
|
|
lastfm_import = LastFmImport.objects.filter(id=import_id).first()
|
|
lastfm_import = LastFmImport.objects.filter(id=import_id).first()
|
|
if not lastfm_import:
|
|
if not lastfm_import:
|
|
logger.warn(f"LastFmImport not found with id {import_id}")
|
|
logger.warn(f"LastFmImport not found with id {import_id}")
|
|
@@ -24,6 +21,9 @@ def process_lastfm_import(import_id):
|
|
|
|
|
|
@shared_task
|
|
@shared_task
|
|
def process_tsv_import(import_id):
|
|
def process_tsv_import(import_id):
|
|
|
|
+ AudioScrobblerTSVImport = apps.get_model(
|
|
|
|
+ "scrobbles", "AudioscrobblerTSVImport"
|
|
|
|
+ )
|
|
tsv_import = AudioScrobblerTSVImport.objects.filter(id=import_id).first()
|
|
tsv_import = AudioScrobblerTSVImport.objects.filter(id=import_id).first()
|
|
if not tsv_import:
|
|
if not tsv_import:
|
|
logger.warn(f"AudioScrobblerTSVImport not found with id {import_id}")
|
|
logger.warn(f"AudioScrobblerTSVImport not found with id {import_id}")
|
|
@@ -33,6 +33,7 @@ def process_tsv_import(import_id):
|
|
|
|
|
|
@shared_task
|
|
@shared_task
|
|
def process_koreader_import(import_id):
|
|
def process_koreader_import(import_id):
|
|
|
|
+ KoReaderImport = apps.get_model("scrobbles", "KoReaderImport")
|
|
koreader_import = KoReaderImport.objects.filter(id=import_id).first()
|
|
koreader_import = KoReaderImport.objects.filter(id=import_id).first()
|
|
if not koreader_import:
|
|
if not koreader_import:
|
|
logger.warn(f"KOReaderImport not found with id {import_id}")
|
|
logger.warn(f"KOReaderImport not found with id {import_id}")
|