1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Consistency fixes

This commit is contained in:
krateng 2022-02-27 00:33:55 +01:00
parent 86c4261a96
commit fe0d06af7e
5 changed files with 13 additions and 9 deletions

View File

@ -141,11 +141,11 @@ def get_scrobbles_num(dbconn=None,**keys):
return len(get_scrobbles(dbconn=dbconn,**keys)) return len(get_scrobbles(dbconn=dbconn,**keys))
@waitfordb @waitfordb
def get_tracks(dbconn=None,artist=None): def get_tracks(dbconn=None,**keys):
if artist is None: if keys.get('artist') is None:
result = sqldb.get_tracks(dbconn=dbconn) result = sqldb.get_tracks(dbconn=dbconn)
else: else:
result = sqldb.get_tracks_of_artist(artist,dbconn=dbconn) result = sqldb.get_tracks_of_artist(keys.get('artist'),dbconn=dbconn)
return result return result
@waitfordb @waitfordb
@ -240,7 +240,9 @@ def get_top_tracks(dbconn=None,**keys):
return results return results
@waitfordb @waitfordb
def artist_info(artist,dbconn=None): def artist_info(dbconn=None,**keys):
artist = keys.get('artist')
artist = sqldb.get_artist(sqldb.get_artist_id(artist,dbconn=dbconn),dbconn=dbconn) artist = sqldb.get_artist(sqldb.get_artist_id(artist,dbconn=dbconn),dbconn=dbconn)
alltimecharts = get_charts_artists(timerange=alltime(),dbconn=dbconn) alltimecharts = get_charts_artists(timerange=alltime(),dbconn=dbconn)
@ -274,7 +276,9 @@ def artist_info(artist,dbconn=None):
@waitfordb @waitfordb
def track_info(track,dbconn=None): def track_info(dbconn=None,**keys):
track = keys.get('track')
track = sqldb.get_track(sqldb.get_track_id(track,dbconn=dbconn),dbconn=dbconn) track = sqldb.get_track(sqldb.get_track_id(track,dbconn=dbconn),dbconn=dbconn)
alltimecharts = get_charts_tracks(timerange=alltime(),dbconn=dbconn) alltimecharts = get_charts_tracks(timerange=alltime(),dbconn=dbconn)

View File

@ -9,7 +9,7 @@
{% endblock %} {% endblock %}
{% set artist = filterkeys.artist %} {% set artist = filterkeys.artist %}
{% set info = db.artist_info(artist) %} {% set info = db.artist_info(artist=artist) %}
{% set credited = info.get('replace') %} {% set credited = info.get('replace') %}
{% set included = info.get('associated') %} {% set included = info.get('associated') %}

View File

@ -53,7 +53,7 @@
<!-- CERTS --> <!-- CERTS -->
{% set info = db.track_info(track) %} {% set info = db.track_info(track=track) %}
{% if info.certification is not none %} {% if info.certification is not none %}
<img class="certrecord" <img class="certrecord"
src="/media/record_{{ info.certification }}.png" src="/media/record_{{ info.certification }}.png"

View File

@ -68,7 +68,7 @@
{% for range in xcurrent %} {% for range in xcurrent %}
<span class="stats">{{ range.localisation }}</span> <span class="stats">{{ range.localisation }}</span>
<a href='/scrobbles?in={{ range.identifier }}'>{{ db.get_scrobbles_num(timerange=range.range) }}</a> <a href='/scrobbles?in={{ range.identifier }}'>{{ dbc.get_scrobbles_num({'timerange':range.range}) }}</a>
{% endfor %} {% endfor %}
<br/><br/> <br/><br/>

View File

@ -13,7 +13,7 @@
{% endblock %} {% endblock %}
{% set track = filterkeys.track %} {% set track = filterkeys.track %}
{% set info = db.track_info(track) %} {% set info = dbc.track_info({'track':track}) %}
{% set initialrange ='month' %} {% set initialrange ='month' %}