mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Bugfixing
This commit is contained in:
parent
27e7083281
commit
7795863bf2
|
@ -827,7 +827,7 @@ def build_db():
|
||||||
STAMPS.sort()
|
STAMPS.sort()
|
||||||
|
|
||||||
# inform malojatime module about earliest scrobble
|
# 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
|
# NOT NEEDED BECAUSE WE DO THAT ON ADDING EVERY ARTIST ANYWAY
|
||||||
# get extra artists with no real scrobbles from countas rules
|
# get extra artists with no real scrobbles from countas rules
|
||||||
|
|
|
@ -471,10 +471,10 @@ def timestamp_desc(t,short=False):
|
||||||
timeobject = datetime.datetime.utcfromtimestamp(t)
|
timeobject = datetime.datetime.utcfromtimestamp(t)
|
||||||
if difference < 5: return timeobject.strftime("%A")
|
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 < 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")
|
#if difference < 300: return tim.strftime("%B %Y")
|
||||||
|
|
||||||
return timeobject.strftime("%d. %B %Y")
|
return timeobject.strftime("%Y")
|
||||||
else:
|
else:
|
||||||
timeobject = datetime.datetime.utcfromtimestamp(t)
|
timeobject = datetime.datetime.utcfromtimestamp(t)
|
||||||
return timeobject.strftime("%d. %b %Y %I:%M %p")
|
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 = from_timestamp(firstincluded,step)
|
||||||
d_start = d_start.next(stepn-1) #last part of first included range
|
d_start = d_start.next(stepn-1) #last part of first included range
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
current_end = d_start
|
current_end = d_start
|
||||||
|
#ranges = []
|
||||||
while current_end.first_stamp() <= lastincluded and (max_ is None or i < max_):
|
while current_end.first_stamp() <= lastincluded and (max_ is None or i < max_):
|
||||||
|
|
||||||
current_start = current_end.next((stepn*trail-1)*-1)
|
current_start = current_end.next((stepn*trail-1)*-1)
|
||||||
if current_start == current_end:
|
if current_start == current_end:
|
||||||
yield current_start
|
yield current_start
|
||||||
|
#ranges.append(current_start)
|
||||||
else:
|
else:
|
||||||
yield MRange(current_start,current_end)
|
yield MRange(current_start,current_end)
|
||||||
|
#ranges.append(MRange(current_start,current_end))
|
||||||
current_end = current_end.next(stepn)
|
current_end = current_end.next(stepn)
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
#return ranges
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ def mainpage():
|
||||||
@webserver.error(505)
|
@webserver.error(505)
|
||||||
def customerror(error):
|
def customerror(error):
|
||||||
code = int(str(error).split(",")[0][1:])
|
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"):
|
if os.path.exists("website/errors/" + str(code) + ".html"):
|
||||||
return static_file("website/errors/" + str(code) + ".html",root="")
|
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 a python file exists, it provides the replacement dict for the html file
|
||||||
if os.path.exists("website/" + name + ".py"):
|
if os.path.exists("website/" + name + ".py"):
|
||||||
#txt_keys = SourceFileLoader(name,"website/" + name + ".py").load_module().replacedict(keys,DATABASE_PORT)
|
#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)
|
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
|
# add headers for server push
|
||||||
for resource in resources:
|
for resource in resources:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user