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

Bugfixing

This commit is contained in:
Krateng 2019-04-11 17:44:33 +02:00
parent 27e7083281
commit 7795863bf2
3 changed files with 15 additions and 6 deletions

View File

@ -827,7 +827,7 @@ def build_db():
STAMPS.sort()
# inform malojatime module about earliest scrobble
register_scrobbletime(STAMPS[0])
if len(STAMPS) > 0: register_scrobbletime(STAMPS[0])
# NOT NEEDED BECAUSE WE DO THAT ON ADDING EVERY ARTIST ANYWAY
# get extra artists with no real scrobbles from countas rules

View File

@ -471,10 +471,10 @@ def timestamp_desc(t,short=False):
timeobject = datetime.datetime.utcfromtimestamp(t)
if difference < 5: return timeobject.strftime("%A")
if difference < 31: return str(difference) + " days ago" if difference>1 else str(difference) + " day ago"
#if difference < 300 and tim.year == now.year: return tim.strftime("%B")
if difference < 300 or timeobject.year == now.year: return timeobject.strftime("%B")
#if difference < 300: return tim.strftime("%B %Y")
return timeobject.strftime("%d. %B %Y")
return timeobject.strftime("%Y")
else:
timeobject = datetime.datetime.utcfromtimestamp(t)
return timeobject.strftime("%d. %b %Y %I:%M %p")
@ -560,18 +560,23 @@ def ranges(since=None,to=None,within=None,timerange=None,step="month",stepn=1,tr
d_start = from_timestamp(firstincluded,step)
d_start = d_start.next(stepn-1) #last part of first included range
i = 0
current_end = d_start
#ranges = []
while current_end.first_stamp() <= lastincluded and (max_ is None or i < max_):
current_start = current_end.next((stepn*trail-1)*-1)
if current_start == current_end:
yield current_start
#ranges.append(current_start)
else:
yield MRange(current_start,current_end)
#ranges.append(MRange(current_start,current_end))
current_end = current_end.next(stepn)
i += 1
#return ranges

View File

@ -47,7 +47,7 @@ def mainpage():
@webserver.error(505)
def customerror(error):
code = int(str(error).split(",")[0][1:])
log("Error: " + str(code),module="error")
log("HTTP Error: " + str(code),module="error")
if os.path.exists("website/errors/" + str(code) + ".html"):
return static_file("website/errors/" + str(code) + ".html",root="")
@ -177,7 +177,11 @@ def static_html(name):
# If a python file exists, it provides the replacement dict for the html file
if os.path.exists("website/" + name + ".py"):
#txt_keys = SourceFileLoader(name,"website/" + name + ".py").load_module().replacedict(keys,DATABASE_PORT)
try:
txt_keys,resources = SourceFileLoader(name,"website/" + name + ".py").load_module().instructions(keys)
except Exception as e:
log("Error in website generation: " + str(sys.exc_info()),module="error")
raise
# add headers for server push
for resource in resources: