commit b1bf214ef797395b29bf6db4978cd4c19e12a721
parent be76dfe76555ab3538c198c1d9b20af1b249527d
Author: rbckman <rob@tarina.org>
Date: Wed, 5 Aug 2026 01:02:35 +0300
yes
Diffstat:
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/html/heartranked.html b/html/heartranked.html
@@ -136,11 +136,11 @@ $else:
<div class="postmenu">
<small>by $g['creator'] $g['timeadded']</small><br>
$getcombines(g['postid'])
- $if 'combine' in g and g['combine'] != None:
+ $if 'combine' in g and g['combine'] != '':
$#combined = db.select('published', where="postid='"+g['combine']+"'")[0]
$ combined=loadjson('p/posts/'+g['combine']+'/meta')
<small>combo with <a href="/?show=$combined['postid']">$combined['soundname']</a></small><br>
- $if 'remix' in g and g['remix'] != None:
+ $if 'remix' in g and g['remix'] != '':
$#remixed = db.select('published', where="postid='"+g['remix']+"'")[0]
$ remixed=loadjson('p/posts/'+g['remix']+'/meta')
<small>remixed <a href="/?show=$remixed['postid']">$remixed['soundname']</a></small><br>
@@ -173,11 +173,11 @@ $else:
<div class="postmenu">
<small>by $c['creator'] $c['timeadded']</small><br>
$getcombines(c['postid'])
- $if c['combine']:
+ $if 'combine' in c and c['combine'] != '':
$#combined = db.select('published', where="postid='"+c['combine']+"'")[0]
$ combined=loadjson('p/posts/'+c['combine']+'/meta')
<small>combo with <a href="/?show=$combined['postid']">$combined['soundname']</a></small><br>
- $if c['remix']:
+ $if 'remix' in c and c['remix'] != '':
$#remixed = db.select('published', where="postid='"+c['remix']+"'")[0]
$ remixed=loadjson('p/posts/'+c['remix']+'/meta')
<small>remixed <a href="/?show=$remixed['postid']">$remixed['soundname']</a></small><br>
diff --git a/server.py b/server.py
@@ -121,14 +121,16 @@ def savejson(thename, thedict):
def loadjson(thename):
if os.path.exists(basedir+thename):
with open(basedir+thename, 'r') as f:
- settings = json.load(f)
+ s = json.load(f)
#for key, i in settings.items():
# createpost(key,i)
- print(settings)
- if settings != None:
- return settings
+ try:
+ if s != None:
+ return s
+ except:
+ return {}
else:
- return ''
+ return {}
def deletepost(thefile):
os.system('rm '+thefile)
@@ -1360,7 +1362,6 @@ class editor:
text2 = ''
if i.new == 'yes':
session.postid = ''
- print('WTFWTFWTF')
raise web.seeother('/editor')
if i.publish == 'yes' and text != '' and i.public == None and logged() and len(text) < 256:
description1 = text
@@ -1373,10 +1374,11 @@ class editor:
thedict={'postid':session.postid, 'soundname':soundname, 'timeadded':formattime(datetime.datetime.now()), 'creator':session.user}
savejson('p/posts/'+session.postid+'/meta',thedict)
savetext('p/posts/'+session.postid+'/intro', description1)
- savetext('p/posts/'+session.postid+'/post', description2)
+ savetext('p/posts/'+session.postid+'/post', description2)
raise web.seeother('/editor?public=yes')
else:
print('make a new post')
+ createpost=True
try:
#db.update('unpublished', where='postid="'+session.postid+'"', postid=session.postid, soundname=soundname, description=description1, description2=description2, timeadded=formattime(datetime.datetime.now()), creator=session.user)
thedict={'postid':session.postid, 'soundname':soundname, 'timeadded':formattime(datetime.datetime.now()), 'creator':session.user}
@@ -1404,6 +1406,7 @@ class editor:
if remix != '':
savetext('p/posts/'+remix+'/remixes/'+session.postid,session.user)
#db.insert('published', postid=session.postid, soundname=soundname, description=description1, description2=description2, timeadded=formattime(datetime.datetime.now()), creator=session.user, combine=combine, remix=remix)
+ print('update sahfajfhajfhahfHFLDHFODHFOHFDDOJFODUF')
thedict={'postid':session.postid,'soundname':soundname,'timeadded':formattime(datetime.datetime.now()),'creator':session.user,'combine':combine,'remix':remix}
savejson('p/posts/'+session.postid+'/meta',thedict)
savetext('p/posts/'+session.postid+'/intro', description1)