fix preview 500

This commit is contained in:
Your Name 2021-12-16 23:21:23 -05:00
parent a00e6622db
commit 6dd7f9886f
2 changed files with 2 additions and 2 deletions

View file

@ -51,7 +51,7 @@ class Album(Entity):
def get_embed_link(self):
if self.source_site == SourceSiteEnum.SPOTIFY.value:
return self.source_url.replace("open.spotify.com/", "open.spotify.com/embed/")
elif self.source_site == SourceSiteEnum.BANDCAMP.value:
elif self.source_site == SourceSiteEnum.BANDCAMP.value and self.other_info and 'bandcamp_album_id' in self.other_info:
return f"https://bandcamp.com/EmbeddedPlayer/album={self.other_info['bandcamp_album_id']}/size=large/bgcol=ffffff/linkcol=19A2CA/artwork=small/transparent=true/"
else:
return None

View file

@ -351,7 +351,7 @@
{% endif %}
</div>
{% if album.source_site == "spotify" or album.source_site == "bandcamp" %}
{% if album.get_embed_link %}
<iframe src="{{ album.get_embed_link }}" height="320" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>
{% endif %}
</div>