Add subtitle field to media objects
This commit is contained in:
@ -181,10 +181,18 @@ class Track(ScrobblableMixin):
|
||||
def get_absolute_url(self):
|
||||
return reverse('music:track_detail', kwargs={'slug': self.uuid})
|
||||
|
||||
@property
|
||||
def subtitle(self):
|
||||
return self.artist
|
||||
|
||||
@property
|
||||
def mb_link(self):
|
||||
return f"https://musicbrainz.org/recording/{self.musicbrainz_id}"
|
||||
|
||||
@property
|
||||
def info_link(self):
|
||||
return self.mb_link
|
||||
|
||||
@classmethod
|
||||
def find_or_create(
|
||||
cls, artist_dict: Dict, album_dict: Dict, track_dict: Dict
|
||||
|
||||
@ -45,6 +45,14 @@ class Episode(ScrobblableMixin):
|
||||
def __str__(self):
|
||||
return f"{self.title}"
|
||||
|
||||
@property
|
||||
def subtitle(self):
|
||||
return self.podcast
|
||||
|
||||
@property
|
||||
def info_link(self):
|
||||
return ""
|
||||
|
||||
@classmethod
|
||||
def find_or_create(
|
||||
cls, podcast_dict: Dict, producer_dict: Dict, episode_dict: Dict
|
||||
|
||||
@ -89,6 +89,7 @@ class Round(TheSportsDbMixin):
|
||||
class SportEvent(ScrobblableMixin):
|
||||
COMPLETION_PERCENT = getattr(settings, 'SPORT_COMPLETION_PERCENT', 90)
|
||||
|
||||
thesportsdb_id = models.CharField(max_length=255, **BNULL)
|
||||
event_type = models.CharField(
|
||||
max_length=2,
|
||||
choices=SportEventType.choices,
|
||||
@ -127,6 +128,18 @@ class SportEvent(ScrobblableMixin):
|
||||
def get_absolute_url(self):
|
||||
return reverse("sports:event_detail", kwargs={'slug': self.uuid})
|
||||
|
||||
@property
|
||||
def subtitle(self):
|
||||
return self.round.season.league
|
||||
|
||||
@property
|
||||
def sportsdb_link(self):
|
||||
return f"https://thesportsdb.com/event/{self.thesportsdb_id}"
|
||||
|
||||
@property
|
||||
def info_link(self):
|
||||
return self.sportsdb_link
|
||||
|
||||
@classmethod
|
||||
def find_or_create(cls, data_dict: Dict) -> "Event":
|
||||
"""Given a data dict from Jellyfin, does the heavy lifting of looking up
|
||||
|
||||
@ -69,10 +69,24 @@ class Video(ScrobblableMixin):
|
||||
def get_absolute_url(self):
|
||||
return reverse("videos:video_detail", kwargs={'slug': self.uuid})
|
||||
|
||||
@property
|
||||
def subtitle(self):
|
||||
if self.tv_series:
|
||||
return self.tv_series
|
||||
return ""
|
||||
|
||||
@property
|
||||
def imdb_link(self):
|
||||
return f"https://www.imdb.com/title/{self.imdb_id}"
|
||||
|
||||
@property
|
||||
def info_link(self):
|
||||
return self.imdb_link
|
||||
|
||||
@property
|
||||
def link(self):
|
||||
return self.imdb_link
|
||||
|
||||
@classmethod
|
||||
def find_or_create(cls, data_dict: Dict) -> "Video":
|
||||
"""Given a data dict from Jellyfin, does the heavy lifting of looking up
|
||||
|
||||
@ -210,10 +210,7 @@
|
||||
{% for scrobble in now_playing_list %}
|
||||
<div>
|
||||
{{scrobble.media_obj.title}}<br/>
|
||||
{% if scrobble.track %}<em>{{scrobble.track.artist}}</em><br/>{% endif %}
|
||||
{% if scrobble.podcast_episode%}<em>{{scrobble.podcast_episode.podcast}}</em><br/>{% endif %}
|
||||
{% if scrobble.video.tv_series %}<em>{{scrobble.video.tv_series }}</em><br/>{% endif %}
|
||||
{% if scrobble.sport_event %}<em>{{scrobble.sport_event.round.season.league}}</em><br/>{% endif %}
|
||||
{% if scrobble.media_obj.subtitle %}<em>{{scrobble.media_obj.subtitle}}</em><br/>{% endif %}
|
||||
<small>{{scrobble.timestamp|naturaltime}}<br/>
|
||||
from {{scrobble.source}}</small>
|
||||
<div class="progress-bar" style="margin-right:5px;">
|
||||
|
||||
Reference in New Issue
Block a user