[tasks] Allow scrobbling tasks from URLs

This commit is contained in:
2024-10-05 15:08:38 -04:00
parent 342e86d7fb
commit c251c5f413
4 changed files with 74 additions and 24 deletions

View File

@ -44,7 +44,7 @@ from scrobbles.models import (
RetroarchImport,
Scrobble,
)
from scrobbles.scrobblers import *
from scrobbles.scrobblers import manual_scrobble_from_url
from scrobbles.tasks import (
process_koreader_import,
process_lastfm_import,
@ -97,16 +97,8 @@ class RecentScrobbleList(ListView):
def get(self, *args, **kwargs):
user = self.request.user
if user.is_authenticated:
if scrobble_url := self.request.GET.get("scrobble_url"):
for content_url in SCROBBLE_CONTENT_URLS.values():
if content_url in scrobble_url:
scrobble = manual_scrobble_from_url(
scrobble_url, self.request.user.id
)
return HttpResponseRedirect(
scrobble.redirect_url(user.id)
)
scrobble = manual_scrobble_webpage(
if scrobble_url := self.request.GET.get("scrobble_url", ""):
scrobble = manual_scrobble_from_url(
scrobble_url, self.request.user.id
)
return HttpResponseRedirect(scrobble.redirect_url(user.id))