mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Adjusted artist page for album artists
This commit is contained in:
parent
5eec25963b
commit
deb96c9ce7
@ -398,14 +398,18 @@ def artist_info(dbconn=None,**keys):
|
||||
artist_id = sqldb.get_artist_id(artist,dbconn=dbconn)
|
||||
artist = sqldb.get_artist(artist_id,dbconn=dbconn)
|
||||
alltimecharts = get_charts_artists(timerange=alltime(),dbconn=dbconn)
|
||||
scrobbles = get_scrobbles_num(artist=artist,timerange=alltime(),dbconn=dbconn)
|
||||
#we cant take the scrobble number from the charts because that includes all countas scrobbles
|
||||
scrobbles = get_scrobbles_num(artist=artist,timerange=alltime(),dbconn=dbconn)
|
||||
albums = sqldb.get_albums_of_artists(set([artist_id]),dbconn=dbconn)
|
||||
isalbumartist = len(albums.get(artist_id,[]))>0
|
||||
|
||||
|
||||
# base info for everyone
|
||||
result = {
|
||||
"artist":artist,
|
||||
"scrobbles":scrobbles,
|
||||
"id":artist_id
|
||||
"id":artist_id,
|
||||
"isalbumartist":isalbumartist
|
||||
}
|
||||
|
||||
# check if credited to someone else
|
||||
|
@ -1055,6 +1055,19 @@ def get_artists_of_albums(album_ids,dbconn=None):
|
||||
artists.setdefault(row.album_id,[]).append(artist_db_to_dict(row,dbconn=dbconn))
|
||||
return artists
|
||||
|
||||
@cached_wrapper_individual
|
||||
@connection_provider
|
||||
def get_albums_of_artists(artist_ids,dbconn=None):
|
||||
op = sql.join(DB['albumartists'],DB['albums']).select().where(
|
||||
DB['albumartists'].c.artist_id.in_(artist_ids)
|
||||
)
|
||||
result = dbconn.execute(op).all()
|
||||
|
||||
albums = {}
|
||||
for row in result:
|
||||
albums.setdefault(row.artist_id,[]).append(album_db_to_dict(row,dbconn=dbconn))
|
||||
return albums
|
||||
|
||||
|
||||
@cached_wrapper_individual
|
||||
@connection_provider
|
||||
|
@ -90,19 +90,22 @@
|
||||
</table>
|
||||
|
||||
|
||||
{% if info["isalbumartist"] %}
|
||||
<h2><a href='{{ mlj_uri.create_uri("/charts_albums",filterkeys) }}'>Top Albums</a></h2>
|
||||
|
||||
{% with amountkeys={"perpage":15,"page":0} %}
|
||||
{% include 'partials/charts_albums.jinja' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if info['scrobbles']>0 %}
|
||||
<h2><a href='{{ mlj_uri.create_uri("/charts_tracks",filterkeys) }}'>Top Tracks</a></h2>
|
||||
|
||||
{% with amountkeys={"perpage":15,"page":0} %}
|
||||
{% include 'partials/charts_tracks.jinja' %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
<table class="twopart">
|
||||
@ -180,5 +183,6 @@
|
||||
{% with amountkeys = {"perpage":15,"page":0} %}
|
||||
{% include 'partials/scrobbles.jinja' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user