diff --git a/htmlmodules.py b/htmlmodules.py index bdcb61c..6df7eab 100644 --- a/htmlmodules.py +++ b/htmlmodules.py @@ -2,8 +2,9 @@ from htmlgenerators import * import database from utilities import getArtistImage, getTrackImage from malojatime import * -from urihandler import compose_querystring, internal_to_uri +from urihandler import compose_querystring, internal_to_uri, uri_to_internal import urllib +import datetime #def getpictures(ls,result,tracks=False): @@ -445,11 +446,15 @@ def module_trackcharts_tiles(**kwargs): # THIS FUNCTION USES THE ORIGINAL URI KEYS!!! def module_filterselection(keys,time=True,delimit=False): + filterkeys, timekeys, delimitkeys, extrakeys = uri_to_internal(keys) + + html = "" if time: # all other keys that will not be changed by clicking another filter - keystr = "?" + compose_querystring(keys,exclude=["since","to","in"]) + #keystr = "?" + compose_querystring(keys,exclude=["since","to","in"]) + unchangedkeys = internal_to_uri({**filterkeys,**delimitkeys,**extrakeys}) # wonky selector for precise date range @@ -471,84 +476,92 @@ def module_filterselection(keys,time=True,delimit=False): # html += "" + now = datetime.datetime.utcnow() + today = [now.year,now.month,now.day] + thismonth = today[:2] + thisyear = thismonth[:1] html += "
" - if keys.get("since") == "today" or keys.get("in") == "today": + if timekeys.get("since") == today or timekeys.get("within") == today: html += "Today" else: - html += "Today" + html += "Today" html += " | " if keys.get("since") == "sunday": html += "This Week" else: - html += "This Week" + html += "This Week" html += " | " - if keys.get("since") == "month" or keys.get("in") == "month": + if timekeys.get("since") == thismonth or timekeys.get("within") == thismonth: html += "This Month" else: - html += "This Month" + html += "This Month" html += " | " - if keys.get("since") == "year" or keys.get("in") == "year": + if timekeys.get("since") == thisyear or timekeys.get("within") == thisyear: html += "This Year" else: - html += "This Year" + html += "This Year" html += " | " - if keys.get("since") is None and keys.get("in") is None: + if timekeys.get("since") is None and timekeys.get("within") is None: html += "All Time" else: - html += "All Time" + html += "All Time" html += "
" if delimit: - keystr = "?" + compose_querystring(keys,exclude=["step","stepn"]) + #keystr = "?" + compose_querystring(keys,exclude=["step","stepn"]) + unchangedkeys = internal_to_uri({**filterkeys,**timekeys,**extrakeys}) + + # only for this element (delimit selector consists of more than one) + unchangedkeys_sub = internal_to_uri({k:delimitkeys[k] for k in delimitkeys if k not in ["step","stepn"]}) html += "
" - if keys.get("step") == "day": + if delimitkeys.get("step") == "day" and delimitkeys.get("stepn") == 1: html += "Daily" else: - html += "Daily" + html += "Daily" html += " | " - if keys.get("step") == "month" or keys.get("step") is None: + if (delimitkeys.get("step") == "month" or delimitkeys.get("step") is None) and delimitkeys.get("stepn") == 1: html += "Monthly" else: - html += "Monthly" + html += "Monthly" html += " | " - if keys.get("step") == "year": + if delimitkeys.get("step") == "year" and delimitkeys.get("stepn") == 1: html += "Yearly" else: - html += "Yearly" + html += "Yearly" html += "
" - keystr = "?" + compose_querystring(keys,exclude=["trail"]) + unchangedkeys_sub = internal_to_uri({k:delimitkeys[k] for k in delimitkeys if k != "trail"}) html += "
" - if keys.get("trail") == "1" or keys.get("trail") is None: + if delimitkeys.get("trail") == 1 or delimitkeys.get("trail") is None: html += "Standard" else: - html += "Standard" + html += "Standard" html += " | " - if keys.get("trail") == "2": + if delimitkeys.get("trail") == 2: html += "Trailing" else: - html += "Trailing" + html += "Trailing" html += " | " - if keys.get("trail") == "3": + if delimitkeys.get("trail") == 3: html += "Long Trailing" else: - html += "Long Trailing" + html += "Long Trailing" html += "
" diff --git a/rules/predefined/krateng_kpopgirlgroups.tsv b/rules/predefined/krateng_kpopgirlgroups.tsv index f91eea5..3cd8be2 100644 --- a/rules/predefined/krateng_kpopgirlgroups.tsv +++ b/rules/predefined/krateng_kpopgirlgroups.tsv @@ -1,5 +1,5 @@ # NAME: K-Pop Girl Groups -# DESC: Fixes various different spellings and romanizes artist names and track titles for some K-Pop Girl Groups +# DESC: Fixes various different spellings, romanizes artist names and track titles and includes subgroups for some K-Pop Girl Groups # HyunA replaceartist Kim Hyun-a HyunA @@ -14,6 +14,7 @@ replaceartist HyunA(현아) HyunA replacetitle Cause I'm God Girl Roll Deep # 4Minute +countas 2Yoon 4Minute replaceartist 4minute 4Minute replacetitle 미쳐 Crazy @@ -60,6 +61,7 @@ replacetitle 봐 Look Look replacetitle RBB (Really Bad Boy) Really Bad Boy # EXID +countas Dasoni EXID replacetitle HOT PINK Hot Pink replacetitle AH YEAH Ah Yeah replacetitle WHOZ THAT GIRL Whoz that girl @@ -71,12 +73,14 @@ replacetitle OOH-AHH Like Ooh-Ahh replacetitle LIKEY Likey # AOA +countas AOA Black AOA +countas AOA White AOA +countas AOA Cream AOA replaceartist Ace of Angels AOA replacetitle 사뿐사뿐 (Like a Cat) Like a Cat replacetitle Like A Cat (Japanese Version) Like a Cat (Japanese Version) replacetitle MOYA (inst) Moya replacetitle MOYA (instrumental) Moya (instrumental) -countas AOA Black AOA # Girl's Day replaceartist Girl's Day(걸스데이) Girl's Day