Add manual scrobble to main page
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
|
|
||||||
class ScrobbleForm(forms.Form):
|
class ImdbScrobbleForm(forms.Form):
|
||||||
imdb_id = forms.CharField(label="IMDB", max_length=30)
|
imdb_id = forms.CharField(label="IMDB", max_length=30)
|
||||||
|
|||||||
@ -16,7 +16,6 @@ from scrobbles.constants import (
|
|||||||
JELLYFIN_AUDIO_ITEM_TYPES,
|
JELLYFIN_AUDIO_ITEM_TYPES,
|
||||||
JELLYFIN_VIDEO_ITEM_TYPES,
|
JELLYFIN_VIDEO_ITEM_TYPES,
|
||||||
)
|
)
|
||||||
from scrobbles.forms import ScrobbleForm
|
|
||||||
from scrobbles.imdb import lookup_video_from_imdb
|
from scrobbles.imdb import lookup_video_from_imdb
|
||||||
from scrobbles.models import Scrobble
|
from scrobbles.models import Scrobble
|
||||||
from scrobbles.scrobblers import (
|
from scrobbles.scrobblers import (
|
||||||
@ -34,6 +33,7 @@ from vrobbler.apps.music.aggregators import (
|
|||||||
top_tracks,
|
top_tracks,
|
||||||
week_of_scrobbles,
|
week_of_scrobbles,
|
||||||
)
|
)
|
||||||
|
from scrobbles.forms import ImdbScrobbleForm
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -77,6 +77,7 @@ class RecentScrobbleList(ListView):
|
|||||||
|
|
||||||
data["weekly_data"] = week_of_scrobbles()
|
data["weekly_data"] = week_of_scrobbles()
|
||||||
data['counts'] = scrobble_counts()
|
data['counts'] = scrobble_counts()
|
||||||
|
data['imdb_form'] = ImdbScrobbleForm
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
@ -86,7 +87,7 @@ class RecentScrobbleList(ListView):
|
|||||||
|
|
||||||
|
|
||||||
class ManualImdbScrobbleView(FormView):
|
class ManualImdbScrobbleView(FormView):
|
||||||
form_class = ScrobbleForm
|
form_class = ImdbScrobbleForm
|
||||||
template_name = 'scrobbles/manual_form.html'
|
template_name = 'scrobbles/manual_form.html'
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
|||||||
@ -7,7 +7,13 @@
|
|||||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||||
<h1 class="h2">Dashboard</h1>
|
<h1 class="h2">Dashboard</h1>
|
||||||
<div class="btn-toolbar mb-2 mb-md-0">
|
<div class="btn-toolbar mb-2 mb-md-0">
|
||||||
|
|
||||||
<div class="btn-group me-2">
|
<div class="btn-group me-2">
|
||||||
|
<form action="{% url 'imdb-manual-scrobble' %}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ imdb_form }}
|
||||||
|
<button type="submit" class="btn btn-sm btn-outline-secondary">Scrobble</button>
|
||||||
|
</form>
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary">Share</button>
|
<button type="button" class="btn btn-sm btn-outline-secondary">Share</button>
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
|
<button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -18,7 +18,7 @@ urlpatterns = [
|
|||||||
path(
|
path(
|
||||||
'manual/imdb/',
|
'manual/imdb/',
|
||||||
scrobbles_views.ManualImdbScrobbleView.as_view(),
|
scrobbles_views.ManualImdbScrobbleView.as_view(),
|
||||||
name='manual-scrobble',
|
name='imdb-manual-scrobble',
|
||||||
),
|
),
|
||||||
path("", include(video_urls, namespace="videos")),
|
path("", include(video_urls, namespace="videos")),
|
||||||
path("", scrobbles_views.RecentScrobbleList.as_view(), name="home"),
|
path("", scrobbles_views.RecentScrobbleList.as_view(), name="home"),
|
||||||
|
|||||||
Reference in New Issue
Block a user