Moved the database to a separate file, getting ready for mondoDB support. Added a more welcoming flipnote

This commit is contained in:
pbsds committed 2014-01-30 19:39:59 +01:00
1 parent a5d5a82ef3
commit 7d0b413961
14 files changed
+218 -161

No files matched your search

@@ -2,7 +2,8 @@ from twisted.web import resource
from twisted.internet import reactor
import time
from hatena import Database, Log, NotFound
from hatena import Log, NotFound
from DB import Database
from Hatenatools import UGO
#makes a flipnote list of the most seen ones among the recently uploaded
@@ -14,7 +15,7 @@ class PyResource(resource.Resource):
self.pages = []#10 first pages
self.neweststar = None
self.newestflip = None
reactor.callLater(2, self.Update)#or it'll clash with hotmovies.ugo
reactor.callLater(2, self.Update)#or it'll clash with the others in the terminal
def render(self, request):
page = int(request.args["page"][0]) if "page" in request.args else 1
@@ -79,10 +80,7 @@ class PyResource(resource.Resource):
#Flipnotes
for creatorid, filename in flipnotes:#[i*50 : i*50+50]:
stars = str(Database.GetFlipnote(creatorid, filename)[2])
f = open(Database.FlipnotePath(creatorid, filename+".ppm"), "rb")
ugo.Items.append(("button", 3, "", "http://flipnote.hatena.com/ds/v2-xx/movie/%s/%s.ppm" % (creatorid, filename), (stars, "765", "573", "0"), ("bleh", f.read(0x6a0))))
f.close()
ugo.Items.append(("button", 3, "", "http://flipnote.hatena.com/ds/v2-xx/movie/%s/%s.ppm" % (creatorid, filename), (stars, "765", "573", "0"), (filename+".ppm", Database.GetFlipnoteTMB(creatorid, filename))))
#next page
if next: