mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
Added ability to show artist charts without combining artists
This commit is contained in:
parent
a3831f9b7c
commit
a12c52af1f
@ -384,8 +384,8 @@ def get_tracks_without_album(dbconn=None,resolve_ids=True):
|
|||||||
@waitfordb
|
@waitfordb
|
||||||
def get_charts_artists(dbconn=None,resolve_ids=True,**keys):
|
def get_charts_artists(dbconn=None,resolve_ids=True,**keys):
|
||||||
(since,to) = keys.get('timerange').timestamps()
|
(since,to) = keys.get('timerange').timestamps()
|
||||||
associated = keys.get('associated',True)
|
separate = keys.get('separate',False)
|
||||||
result = sqldb.count_scrobbles_by_artist(since=since,to=to,resolve_ids=resolve_ids,associated=associated,dbconn=dbconn)
|
result = sqldb.count_scrobbles_by_artist(since=since,to=to,resolve_ids=resolve_ids,associated=(not separate),dbconn=dbconn)
|
||||||
for entry in result:
|
for entry in result:
|
||||||
if "artist" in entry:
|
if "artist" in entry:
|
||||||
entry['associated_artists'] = sqldb.get_associated_artists(entry['artist'])
|
entry['associated_artists'] = sqldb.get_associated_artists(entry['artist'])
|
||||||
|
@ -78,6 +78,7 @@ def uri_to_internal(keys,forceTrack=False,forceArtist=False,forceAlbum=False,api
|
|||||||
#5
|
#5
|
||||||
specialkeys = {}
|
specialkeys = {}
|
||||||
if "remote" in keys: specialkeys["remote"] = keys["remote"]
|
if "remote" in keys: specialkeys["remote"] = keys["remote"]
|
||||||
|
specialkeys["separate"] = (keys.get('separate','no').lower() == 'yes')
|
||||||
|
|
||||||
|
|
||||||
return filterkeys, limitkeys, delimitkeys, amountkeys, specialkeys
|
return filterkeys, limitkeys, delimitkeys, amountkeys, specialkeys
|
||||||
@ -144,6 +145,9 @@ def internal_to_uri(keys):
|
|||||||
if "perpage" in keys:
|
if "perpage" in keys:
|
||||||
urikeys.append("perpage",str(keys["perpage"]))
|
urikeys.append("perpage",str(keys["perpage"]))
|
||||||
|
|
||||||
|
if keys.get("separate",False):
|
||||||
|
urikeys.append("separate","yes")
|
||||||
|
|
||||||
|
|
||||||
return urikeys
|
return urikeys
|
||||||
|
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
<script src="/datechange.js" async></script>
|
<script src="/datechange.js" async></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% set charts = dbc.get_charts_artists(filterkeys,limitkeys) %}
|
{% set charts = dbc.get_charts_artists(filterkeys,limitkeys,specialkeys) %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% set pages = math.ceil(charts.__len__() / amountkeys.perpage) %}
|
{% set pages = math.ceil(charts.__len__() / amountkeys.perpage) %}
|
||||||
{% if charts[0] is defined %}
|
{% if charts[0] is defined %}
|
||||||
{% set topartist = charts[0].artist %}
|
{% set topartist = charts[0].artist %}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{% import 'snippets/entityrow.jinja' as entityrow %}
|
{% import 'snippets/entityrow.jinja' as entityrow %}
|
||||||
|
|
||||||
{% if charts is undefined %}
|
{% if charts is undefined %}
|
||||||
{% set charts = dbc.get_charts_artists(limitkeys) %}
|
{% set charts = dbc.get_charts_artists(limitkeys,specialkeys) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if compare %}
|
{% if compare %}
|
||||||
@ -11,7 +11,7 @@
|
|||||||
{% if compare is none %}{% set compare = False %}{% endif %}
|
{% if compare is none %}{% set compare = False %}{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if compare %}
|
{% if compare %}
|
||||||
{% set prevartists = dbc.get_charts_artists({'timerange':compare}) %}
|
{% set prevartists = dbc.get_charts_artists({'timerange':compare},specialkeys) %}
|
||||||
|
|
||||||
{% set lastranks = {} %}
|
{% set lastranks = {} %}
|
||||||
{% for a in prevartists %}
|
{% for a in prevartists %}
|
||||||
@ -49,11 +49,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- artist -->
|
<!-- artist -->
|
||||||
{{ entityrow.row(e['artist'],adminmode=adminmode,counting=e.associated_artists) }}
|
{{ entityrow.row(e['artist'],adminmode=adminmode,counting=([] if specialkeys.separate else e.associated_artists)) }}
|
||||||
|
|
||||||
<!-- scrobbles -->
|
<!-- scrobbles -->
|
||||||
<td class="amount">{{ links.link_scrobbles([{'artist':e['artist'],'associated':True,'timerange':limitkeys.timerange}],amount=e['scrobbles']) }}</td>
|
<td class="amount">{{ links.link_scrobbles([{'artist':e['artist'],'associated':(not specialkeys.separate),'timerange':limitkeys.timerange}],amount=e['scrobbles']) }}</td>
|
||||||
<td class="bar">{{ links.link_scrobbles([{'artist':e['artist'],'associated':True,'timerange':limitkeys.timerange}],percent=e['scrobbles']*100/maxbar) }}</td>
|
<td class="bar">{{ links.link_scrobbles([{'artist':e['artist'],'associated':(not specialkeys.separate),'timerange':limitkeys.timerange}],percent=e['scrobbles']*100/maxbar) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% set allkeys = [filterkeys,limitkeys,delimitkeys,amountkeys] | combine_dicts %}
|
{% set allkeys = [filterkeys,limitkeys,delimitkeys,amountkeys,specialkeys] | combine_dicts %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
{% set nextrange = thisrange.next(1) %}
|
{% set nextrange = thisrange.next(1) %}
|
||||||
|
|
||||||
{% if prevrange is not none %}
|
{% if prevrange is not none %}
|
||||||
<a href='{{ mlj_uri.create_uri("",filterkeys,limitkeys,delimitkeys,{'timerange':prevrange}) }}'><span class='stat_selector'>{{ prevrange.desc() }}</span></a>
|
<a href='{{ mlj_uri.create_uri("",filterkeys,limitkeys,delimitkeys,specialkeys,{'timerange':prevrange}) }}'><span class='stat_selector'>{{ prevrange.desc() }}</span></a>
|
||||||
«
|
«
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if prevrange is not none or nextrange is not none %}
|
{% if prevrange is not none or nextrange is not none %}
|
||||||
@ -21,7 +21,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if nextrange is not none %}
|
{% if nextrange is not none %}
|
||||||
»
|
»
|
||||||
<a href='{{ mlj_uri.create_uri("",filterkeys,limitkeys,delimitkeys,{'timerange':nextrange}) }}'><span class='stat_selector'>{{ nextrange.desc() }}</span></a>
|
<a href='{{ mlj_uri.create_uri("",filterkeys,limitkeys,delimitkeys,specialkeys,{'timerange':nextrange}) }}'><span class='stat_selector'>{{ nextrange.desc() }}</span></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user