Revert "Let's also thumbnail the now playing widget"

This reverts commit 76cc1f7b1c.
This commit is contained in:
2023-03-28 15:33:37 -04:00
parent 76cc1f7b1c
commit c4ddb4b51c
8 changed files with 29 additions and 36 deletions

View File

@ -1,6 +1,5 @@
import logging
from datetime import timedelta
from typing import Optional
from uuid import uuid4
import requests
@ -85,11 +84,11 @@ class Book(LongPlayScrobblableMixin):
return f" by {self.author}"
@property
def primary_image(self) -> Optional["ImageField"]:
img = None
def primary_image_url(self) -> str:
url = ""
if self.cover:
img = self.cover
return img
url = self.cover.url
return url
def get_start_url(self):
return reverse("scrobbles:start", kwargs={"uuid": self.uuid})

View File

@ -389,13 +389,13 @@ class Track(ScrobblableMixin):
return self.mb_link
@property
def primary_image(self) -> Optional["ImageField"]:
img = None
def primary_image_url(self) -> str:
url = ""
if self.artist.thumbnail:
img = self.artist.thumbnail
url = self.artist.thumbnail.url
if self.album and self.album.cover_image:
img = self.album.cover_image
return img
url = self.album.cover_image.url
return url
@classmethod
def find_or_create(

View File

@ -96,11 +96,11 @@ class Episode(ScrobblableMixin):
return ""
@property
def primary_image(self) -> Optional["ImageField"]:
img = None
def primary_image_url(self) -> str:
url = ""
if self.podcast.cover_image:
img = self.podcast.cover_image
return img
url = self.podcast.cover_image.url
return url
@classmethod
def find_or_create(

View File

@ -44,7 +44,7 @@ class ScrobblableMixin(TimeStampedModel):
abstract = True
@property
def primary_image(self) -> Optional["ImageField"]:
def primary_image_url(self) -> str:
logger.warn(f"Not implemented yet")
return ""

View File

@ -1,5 +1,5 @@
import logging
from typing import Dict, Optional
from typing import Dict
from uuid import uuid4
from django.conf import settings
@ -142,11 +142,11 @@ class SportEvent(ScrobblableMixin):
return self.sportsdb_link
@property
def primary_image(self) -> Optional["ImageField"]:
img = None
def primary_image_url(self) -> str:
url = ""
if self.round.season.league.logo:
img = self.round.season.league.logo
return img
url = self.round.season.league.logo.url
return url
@classmethod
def find_or_create(cls, data_dict: Dict) -> "Event":

View File

@ -1,5 +1,4 @@
import logging
from typing import Optional
from uuid import uuid4
from django.conf import settings
@ -94,13 +93,13 @@ class VideoGame(LongPlayScrobblableMixin):
return f" On {self.platforms.first()}"
@property
def primary_image(self) -> Optional["ImageField"]:
img = None
def primary_image_url(self) -> str:
url = ""
if self.cover:
img = self.cover
url = self.cover.url
if self.hltb_cover:
img = self.hltb_cover
return img
url = self.hltb_cover.url
return url
def get_absolute_url(self):
return reverse(

View File

@ -155,11 +155,11 @@ class Video(ScrobblableMixin):
return self.imdb_link
@property
def primary_image(self) -> Optional["ImageField"]:
img = None
def primary_image_url(self) -> str:
url = ""
if self.cover_image:
img = self.cover_image
return img
url = self.cover_image.url
return url
def fix_metadata(self, force_update=False):
imdb_dict = lookup_video_from_imdb(self.imdb_id)

View File

@ -1,6 +1,5 @@
{% load static %}
{% load humanize %}
{% load thumbnail %}
<!doctype html>
<html class="no-js" lang="">
<head>
@ -246,11 +245,7 @@
<b>Now playing</b>
{% for scrobble in now_playing_list %}
<div class="now-playing">
{% if scrobble.media_obj.primary_image %}
{% thumbnail scrobble.media_obj.primary_image 75x75 as im %}
<div style="float:left;padding-right:10px;padding-bottom:10px;"><img src="{{im.url}}" width={{im.width}} height={{im.height}} /></div>
{% endthumbnail %}
{% endif %}
{% if scrobble.media_obj.primary_image_url %}<div style="float:left;padding-right:10px;padding-bottom:10px;"><img src="{{scrobble.media_obj.primary_image_url}}" /></div>{% endif %}
<p><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj.title}}</a></p>
{% if scrobble.media_obj.subtitle %}<p><em><a href="{{scrobble.media_obj.subtitle.get_absolute_url}}">{{scrobble.media_obj.subtitle}}</a></em></p>{% endif %}
<p><small>{{scrobble.timestamp|naturaltime}} from {{scrobble.source}}</small></p>