diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 7d0ad31..c5e594b 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -63,10 +63,13 @@ class RecentScrobbleList(ListView): ) data['video_scrobble_list'] = Scrobble.objects.filter( video__isnull=False, played_to_completion=True - ).order_by('-timestamp')[:10] + ).order_by('-timestamp')[:15] data['podcast_scrobble_list'] = Scrobble.objects.filter( podcast_episode__isnull=False, played_to_completion=True - ).order_by('-timestamp')[:10] + ).order_by('-timestamp')[:15] + data['sport_scrobble_list'] = Scrobble.objects.filter( + sport_event__isnull=False, played_to_completion=True + ).order_by('-timestamp')[:15] data['top_daily_tracks'] = top_tracks() data['top_weekly_tracks'] = top_tracks(filter='week') data['top_monthly_tracks'] = top_tracks(filter='month') @@ -86,16 +89,27 @@ class RecentScrobbleList(ListView): ).order_by('-timestamp')[:15] -class ManualImdbScrobbleView(FormView): - form_class = ImdbScrobbleForm +class ManualScrobbleView(FormView): + form_class = ScrobbleForm template_name = 'scrobbles/manual_form.html' def form_valid(self, form): - # look for video via IMDB id - data_dict = lookup_video_from_imdb(form.cleaned_data.get('imdb_id')) + item_id = form.cleaned_data.get('itme_id') + data_dict = None + if 'tt' in item_id: + data_dict = lookup_video_from_imdb( + form.cleaned_data.get('item_id') + ) + if data_dict: + manual_scrobble_video(data_dict, self.request.user.id) - manual_scrobble_video(data_dict, self.request.user.id) + # if not data_dict: + # data_dict = lookup_event_from_thesportsdb( + # form.cleaned_data.get('item_id') + # ) + # if data_dict: + # manual_scrobble_event(data_dict, self.request.user.id) return HttpResponseRedirect(reverse("home")) diff --git a/vrobbler/templates/base.html b/vrobbler/templates/base.html index f131d0e..61685c9 100644 --- a/vrobbler/templates/base.html +++ b/vrobbler/templates/base.html @@ -203,6 +203,7 @@ {% if scrobble.track %}{{scrobble.track.artist}}
{% endif %} {% if scrobble.podcast_episode%}{{scrobble.podcast_episode.podcast}}
{% endif %} {% if scrobble.video.tv_series %}{{scrobble.video.tv_series }}
{% endif %} + {% if scrobble.sport_event %}{{scrobble.sport_event.league.abbreviation}}
{% endif %} {{scrobble.timestamp|naturaltime}}
from {{scrobble.source}}
diff --git a/vrobbler/templates/scrobbles/scrobble_list.html b/vrobbler/templates/scrobbles/scrobble_list.html index 2df45fb..0cf66ed 100644 --- a/vrobbler/templates/scrobbles/scrobble_list.html +++ b/vrobbler/templates/scrobbles/scrobble_list.html @@ -32,6 +32,9 @@ + @@ -83,18 +86,44 @@
+ +
+

Top artists this month

+
+ + + + + + + + + {% for artist in top_monthly_artists %} + + + + + {% endfor %} + +
#Artist
{{artist.num_scrobbles}}{{artist.name}}
+
+
+
@@ -147,6 +176,30 @@
+
+

Latest Sports

+
+ + + + + + + + + + {% for scrobble in sport_scrobble_list %} + + + + + + {% endfor %} + +
DateTitleLeague
{{scrobble.timestamp|naturaltime}}{{scrobble.sport_event.title}}{{scrobble.sport_event.league.abbreviation}}
+
+
+

Latest Podcasted

@@ -170,6 +223,7 @@
+