mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added basic filter selection for top artists and top tracks web view
This commit is contained in:
parent
b4f3f17f9d
commit
6c646f5aac
@ -274,3 +274,43 @@ def module_trackcharts_tiles(**kwargs):
|
||||
html += """</tr></table>"""
|
||||
|
||||
return html
|
||||
|
||||
|
||||
|
||||
def module_filterselection(**keys):
|
||||
# all other keys that will not be changed by clicking another filter
|
||||
retainkeys = {k:keys[k] for k in keys if k not in ["since","to","in"]}
|
||||
keystr = "?" + urllib.parse.urlencode(retainkeys)
|
||||
html = "<div>"
|
||||
if keys.get("since") == "today" or keys.get("in") == "today":
|
||||
html += "<span class='stat_selector' style='opacity:0.5;'>Today</span>"
|
||||
else:
|
||||
html += "<a href='" + keystr + "&since=today'><span class='stat_selector'>Today</span></a>"
|
||||
html += " | "
|
||||
|
||||
if keys.get("since") == "sunday":
|
||||
html += "<span class='stat_selector' style='opacity:0.5;'>This Week</span>"
|
||||
else:
|
||||
html += "<a href='" + keystr + "&since=sunday'><span class='stat_selector'>This Week</span></a>"
|
||||
html += " | "
|
||||
|
||||
if keys.get("since") == "month" or keys.get("in") == "month":
|
||||
html += "<span class='stat_selector' style='opacity:0.5;'>This Month</span>"
|
||||
else:
|
||||
html += "<a href='" + keystr + "&since=month'><span class='stat_selector'>This Month</span></a>"
|
||||
html += " | "
|
||||
|
||||
if keys.get("since") == "year" or keys.get("in") == "year":
|
||||
html += "<span class='stat_selector' style='opacity:0.5;'>This Year</span>"
|
||||
else:
|
||||
html += "<a href='" + keystr + "&since=year'><span class='stat_selector'>This Year</span></a>"
|
||||
html += " | "
|
||||
|
||||
if keys.get("since") is None and keys.get("in") is None:
|
||||
html += "<span class='stat_selector' style='opacity:0.5;'>All Time</span>"
|
||||
else:
|
||||
html += "<a href='" + keystr + "'><span class='stat_selector'>All Time</span></a>"
|
||||
|
||||
html += "</div>"
|
||||
|
||||
return html
|
||||
|
1
images/.gitignore
vendored
1
images/.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
cache
|
||||
cached/
|
||||
*.jpg
|
||||
*.jpeg
|
||||
*.png
|
||||
|
3
maloja
3
maloja
@ -161,7 +161,8 @@ def install():
|
||||
|
||||
if fail: return False
|
||||
print("All modules successfully installed!")
|
||||
return True
|
||||
print("Run the script again (without root) to start Maloja.")
|
||||
return False
|
||||
|
||||
else:
|
||||
print("All necessary modules seem to be installed.")
|
||||
|
@ -16,6 +16,8 @@
|
||||
<h1>Top Artists</h1><br/>
|
||||
<span>KEY_RANGE</span>
|
||||
<!--<p class="stats">KEY_SCROBBLES Scrobbles</p>-->
|
||||
<br/><br/>
|
||||
KEY_FILTERSELECTOR
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -4,7 +4,7 @@ import urllib
|
||||
def instructions(keys):
|
||||
from utilities import getArtistImage
|
||||
from htmlgenerators import KeySplit
|
||||
from htmlmodules import module_artistcharts
|
||||
from htmlmodules import module_artistcharts, module_filterselection
|
||||
from malojatime import range_desc
|
||||
|
||||
|
||||
@ -12,6 +12,8 @@ def instructions(keys):
|
||||
|
||||
limitstring = range_desc(**timekeys)
|
||||
|
||||
html_filterselector = module_filterselection(**keys)
|
||||
|
||||
|
||||
|
||||
html_charts, rep = module_artistcharts(**amountkeys,**timekeys)
|
||||
@ -24,6 +26,6 @@ def instructions(keys):
|
||||
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
|
||||
|
||||
|
||||
replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_ARTISTLIST":html_charts,"KEY_RANGE":limitstring}
|
||||
replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_ARTISTLIST":html_charts,"KEY_RANGE":limitstring,"KEY_FILTERSELECTOR":html_filterselector}
|
||||
|
||||
return (replace,pushresources)
|
||||
|
@ -16,7 +16,8 @@
|
||||
<h1>Top Tracks</h1><br/>
|
||||
<span>KEY_LIMITS</span>
|
||||
<!--<p class="stats">KEY_SCROBBLES Scrobbles</p>-->
|
||||
|
||||
<br/><br/>
|
||||
KEY_FILTERSELECTOR
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -4,7 +4,7 @@ import urllib
|
||||
def instructions(keys):
|
||||
from utilities import getArtistImage, getTrackImage
|
||||
from htmlgenerators import artistLink, KeySplit
|
||||
from htmlmodules import module_trackcharts
|
||||
from htmlmodules import module_trackcharts, module_filterselection
|
||||
from malojatime import range_desc
|
||||
|
||||
filterkeys, timekeys, _, amountkeys = KeySplit(keys)
|
||||
@ -12,6 +12,7 @@ def instructions(keys):
|
||||
|
||||
limitstring = ""
|
||||
|
||||
html_filterselector = module_filterselection(**keys)
|
||||
|
||||
html_charts, rep = module_trackcharts(**amountkeys,**timekeys,**filterkeys)
|
||||
|
||||
@ -30,6 +31,6 @@ def instructions(keys):
|
||||
|
||||
|
||||
|
||||
replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_TRACKLIST":html_charts,"KEY_LIMITS":limitstring}
|
||||
replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_TRACKLIST":html_charts,"KEY_LIMITS":limitstring,"KEY_FILTERSELECTOR":html_filterselector}
|
||||
|
||||
return (replace,pushresources)
|
||||
|
Loading…
Reference in New Issue
Block a user