mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
Made featured selection a bit more interesting
This commit is contained in:
parent
8acf142745
commit
e328ae48f3
@ -15,7 +15,7 @@ def no_aux_mode(func):
|
|||||||
# rest of the project
|
# rest of the project
|
||||||
from ..cleanup import CleanerAgent
|
from ..cleanup import CleanerAgent
|
||||||
from .. import images
|
from .. import images
|
||||||
from ..malojatime import register_scrobbletime, time_stamps, ranges, alltime
|
from ..malojatime import register_scrobbletime, time_stamps, ranges, alltime, today, thisweek, MTRangeComposite
|
||||||
from ..malojauri import uri_to_internal, internal_to_uri, compose_querystring
|
from ..malojauri import uri_to_internal, internal_to_uri, compose_querystring
|
||||||
from ..thirdparty import proxy_scrobble_all
|
from ..thirdparty import proxy_scrobble_all
|
||||||
from ..pkg_global.conf import data_dir, malojaconfig
|
from ..pkg_global.conf import data_dir, malojaconfig
|
||||||
@ -619,11 +619,25 @@ def album_info(dbconn=None,**keys):
|
|||||||
@waitfordb
|
@waitfordb
|
||||||
def get_featured(dbconn=None):
|
def get_featured(dbconn=None):
|
||||||
# temporary stand-in
|
# temporary stand-in
|
||||||
result = {
|
ranges = [
|
||||||
"artist": get_charts_artists(timerange=alltime())[0]['artist'],
|
MTRangeComposite(since=today().next(-14),to=today()),
|
||||||
"album": get_charts_albums(timerange=alltime())[0]['album'],
|
MTRangeComposite(since=thisweek().next(-12),to=thisweek()),
|
||||||
"track": get_charts_tracks(timerange=alltime())[0]['track']
|
MTRangeComposite(since=thisweek().next(-52),to=thisweek()),
|
||||||
|
alltime()
|
||||||
|
]
|
||||||
|
funcs = {
|
||||||
|
"artist": get_charts_artists,
|
||||||
|
"album": get_charts_albums,
|
||||||
|
"track": get_charts_tracks
|
||||||
}
|
}
|
||||||
|
result = {t:None for t in funcs}
|
||||||
|
|
||||||
|
for entity_type in funcs:
|
||||||
|
for r in ranges:
|
||||||
|
chart = funcs[entity_type](timerange=r)
|
||||||
|
if chart:
|
||||||
|
result[entity_type] = chart[0][entity_type]
|
||||||
|
break
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_predefined_rulesets(dbconn=None):
|
def get_predefined_rulesets(dbconn=None):
|
||||||
|
@ -25,8 +25,9 @@
|
|||||||
<section class="stat_module_featured featured_{{ t.identifier }}" style="display:none;">
|
<section class="stat_module_featured featured_{{ t.identifier }}" style="display:none;">
|
||||||
{%- with filterkeys = t.filterkeys -%}
|
{%- with filterkeys = t.filterkeys -%}
|
||||||
{%- with condensed = true -%}
|
{%- with condensed = true -%}
|
||||||
|
{% if filterkeys[t.identifier] %}
|
||||||
{% include 'partials/' + t.template %}
|
{% include 'partials/' + t.template %}
|
||||||
|
{% endif %}
|
||||||
{%- endwith -%}
|
{%- endwith -%}
|
||||||
{%- endwith -%}
|
{%- endwith -%}
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user