Initial commit

This commit is contained in:
pbsds committed 2014-01-26 05:30:04 +01:00
commit a73140ee37
36 files changed
+4081

No files matched your search

+1
View File
@@ -0,0 +1 @@
����������������������������������������������������������������ςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σςς�Σ�Σςς�Σ�Σ�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�ΣΟ‚�Σςςςς�ΣΟ‚�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�ΣΟ‚�Σςςςς�ΣΟ‚�Σ�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςςς�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σςς�Σ�Σ�Σ�Σ�Σ�Σςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σςςς�Σ�Σ�Σ�Σ�Σ�Σςςς�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σςςςς�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςς�Σ�Σςςςς�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σςςςςςςςςςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςςςςςςςς�Σςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςς�Σςςςςςςςςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςς�Σςςςςςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςςςςςςςς�Σςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςς����������������������������������������������������������������
@@ -0,0 +1 @@
���������������サ纎ロワ������������������������ン�モォョ完完完完完諌�5ササ゚������������������ン�ソョ完完完完完完完完完完完寄椢ロ���������������xマョ完完完完完諌儒�潁漬式完完完完岐「ワ������������5キョ完完完�5」垤�ヌ�ヒ�ヒ�ヒ�ヒ�ヒシソxッム聴完完官噛゚����������ッョ完完岐埆サ�ヒ�ヒ�ヒ�ヒ�ヒWォョ岸テ�ヒ�ヒ�ヒyウョ完完完噛゚��������Vテョ完完碍ァ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォョ寄繭キ�ヒ�ヒ�ヒシソミ聴完完款������壙ョ完完蓋ォ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォョ完完官�6ァンテ�ヒンテミ聴完貫������ミ粍完�4」�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォッ式完完完官孜ウ�ヒワソョ完完楽モ����燮ョ完諌釣ヌ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ�シソ5」ョ完完官爵テ�ヒ垤ョ完観�����ョ完噛キ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヌWォョ完棺サ�ヒ�ヒ�ョ完噛ラ��ワ�完諌�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒ�ヒ5」ョ岸テ�ヒ�ヒ垤ョ完�ォ��Wテョ完�5」�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒ�ヌミ�6ァ�ヒ�ヒ�ヒ�ヌョ完完��ウョ完噛キ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒンテ��ヒ�ヒ�ヒ�ヒ�ヒ�ョ完款��ョ完款ソ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ4洌完鎌ラ�ム坩完岸テ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ5」ョ完岳マ�ム坩完岸テ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ5」ョ完岳マ��ョ完棺サ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ洌完噛ラ�5サョ完岳ッ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォ��ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ョ完含�yモョ完�5」�ヒ�ヒ�ヒ�ヒ�ヒンテxッ漑�6ァササWォ��ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒンテョ完観��ン�完官岸テ�ヒ�ヒ�ヒ6ァョ完完完完完諌梯�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒWォョ完�5キ���4キョ完碍ァ�ヒ�ヒシソョ完完完完完完完岐�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒンテッ完完棺���サ羂完完款ソ�ヒササョ完完完完完完完岐�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒVァョ完岐ヲ�����ウョ完諌釣テ�ヒ�ョ完完完完完官湿ソ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ匍ョ完完棺�����シ�完完�巫テ�ヒyウWォ��6ァyウ�ヌ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒササョ完完�4ウ�������壤ョ完完寄吊ソ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒxッョ完完寄���������xマョ完完完学ォ�ヌ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒ�ヒササ洌完完諌吊����������壅ョ完完完諌�5」垤ンデテ�ヌ゙テササxッ岼完完完岐ヲ�������������シ�ォョ完完完完完完完完完完完完完完蓋ヌ����������������サ゚ッョ完完完完完完完完完官桟ソワ�������������������ワ�マッム墟佃漬梯「5ササ゚�������������������������������������������
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
RQBuAGcAbABpAHMAaAA= en
1 RQBuAGcAbABpAHMAaAA= en
@@ -0,0 +1,94 @@
from twisted.web import resource
from twisted.internet import reactor
import time
from hatena import Database, Log, NotFound
from Hatenatools import UGO
#makes a flipnote list of the most seen ones among the recently uploaded
class PyResource(resource.Resource):
isLeaf = True
def __init__(self):
resource.Resource.__init__(self)
self.pages = []#10 first pages
self.newestview = None
self.Update()
def render(self, request):
page = int(request.args["page"][0]) if "page" in request.args else 1
if len(self.pages) >= page:
path = "/".join(request.path.split("/")[3:])
Log(request, "%s page %i" % (path, page))
request.responseHeaders.setRawHeaders('content-type', ['text/plain'])
return self.pages[page-1]
else:
return NotFound.render(request)
#===
def Update(self):#called every 15 minutes
reactor.callLater(60*10, self.Update)
if self.newestview <> Database.Views:
self.newestview = Database.Views
reactor.callInThread(self.UpdateThreaded, Database.Newest)
def UpdateThreaded(self, flipnotes):#run in an another thread
#sort the flipnotes by viewcount, affected by amount of stars
def sort((i, (ID, flip))):
views, stars = Database.GetFlipnote(ID, flip)[1:3]
return int(views)*60 + int(stars)/4 - i
flipnotes = map(lambda x: x[1], sorted(enumerate(flipnotes), key=sort)[::-1])[:500]
#create pages:
pages = []
pagecount = (len(flipnotes)-1)/50 + 1
if pagecount > 10: pagecount = 10#temp?
flipcount = len(flipnotes) if len(flipnotes) < 500 else 500
for i in xrange(pagecount):
pages.append(self.MakePage(flipnotes[i*50:i*50+50], i+1, i<pagecount-1, flipcount))
if self.pages:#not on startup
print time.strftime("[%H:%M:%S] Updated hotmovies.ugo")
self.pages = pages
def MakePage(self, flipnotes, page, next, count):
ugo = UGO()
ugo.Loaded = True
ugo.Items = []
#meta
ugo.Items.append(("layout", (2, 1)))
ugo.Items.append(("topscreen text", ["Popular Flipnotes", "Flipnotes", str(count), "", "The most popular new Flipnotes."], 0))
#categories
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/hotmovies.uls", "Most Popular", True))
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/likedmovies.uls", "Most Liked", False))
#ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/recommended.uls", "Recommended", False))
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/newmovies.uls", "New Flipnotes", False))
#ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/following.uls", "New Favourites", False))
#the "post flipnote" button
ugo.Items.append(("unknown", ("3", "http://flipnote.hatena.com/ds/v2-xx/help/post_howto.htm", "UABvAHMAdAAgAEYAbABpAHAAbgBvAHQAZQA=")))
#previous page
if page > 1:
ugo.Items.append(("button", 115, "Previous", "http://flipnote.hatena.com/ds/v2-xx/frontpage/hotmovies.uls?page=%i" % (page-1), ("", ""), None))
#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()
#next page
if next:
ugo.Items.append(("button", 115, "Next", "http://flipnote.hatena.com/ds/v2-xx/frontpage/hotmovies.uls?page=%i" % (page+1), ("", ""), None))
return ugo.Pack()
@@ -0,0 +1,94 @@
from twisted.web import resource
from twisted.internet import reactor
import time
from hatena import Database, Log, NotFound
from Hatenatools import UGO
#makes a flipnote list of the most seen ones among the recently uploaded
class PyResource(resource.Resource):
isLeaf = True
def __init__(self):
resource.Resource.__init__(self)
self.pages = []#10 first pages
self.newestview = None
self.Update()
def render(self, request):
page = int(request.args["page"][0]) if "page" in request.args else 1
if len(self.pages) >= page:
path = "/".join(request.path.split("/")[3:])
Log(request, "%s page %i" % (path, page))
request.responseHeaders.setRawHeaders('content-type', ['text/plain'])
return self.pages[page-1]
else:
return NotFound.render(request)
#===
def Update(self):#called every 15 minutes
reactor.callLater(60*10, self.Update)
if self.newestview <> Database.Views:
self.newestview = Database.Views
reactor.callInThread(self.UpdateThreaded, Database.Newest)
def UpdateThreaded(self, flipnotes):#run in an another thread
#sort the flipnotes by viewcount, affected by amount of stars
def sort((i, (ID, flip))):
views, stars = Database.GetFlipnote(ID, flip)[1:3]
return int(stars)*110 + int(views)/10 - i
flipnotes = map(lambda x: x[1], sorted(enumerate(flipnotes), key=sort)[::-1])[:500]
#create pages:
pages = []
pagecount = (len(flipnotes)-1)/50 + 1
if pagecount > 10: pagecount = 10#temp?
flipcount = len(flipnotes) if len(flipnotes) < 500 else 500
for i in xrange(pagecount):
pages.append(self.MakePage(flipnotes[i*50:i*50+50], i+1, i<pagecount-1, flipcount))
if self.pages:#not on startup
print time.strftime("[%H:%M:%S] Updated hotmovies.ugo")
self.pages = pages
def MakePage(self, flipnotes, page, next, count):
ugo = UGO()
ugo.Loaded = True
ugo.Items = []
#meta
ugo.Items.append(("layout", (2, 1)))
ugo.Items.append(("topscreen text", ["Liked Flipnotes", "Flipnotes", str(count), "", "The most liked new Flipnotes."], 0))
#categories
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/hotmovies.uls", "Most Popular", False))
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/likedmovies.uls", "Most Liked", True))
#ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/recommended.uls", "Recommended", False))
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/newmovies.uls", "New Flipnotes", False))
#ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/following.uls", "New Favourites", False))
#the "post flipnote" button
ugo.Items.append(("unknown", ("3", "http://flipnote.hatena.com/ds/v2-xx/help/post_howto.htm", "UABvAHMAdAAgAEYAbABpAHAAbgBvAHQAZQA=")))
#previous page
if page > 1:
ugo.Items.append(("button", 115, "Previous", "http://flipnote.hatena.com/ds/v2-xx/frontpage/likedmovies.uls?page=%i" % (page-1), ("", ""), None))
#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()
#next page
if next:
ugo.Items.append(("button", 115, "Next", "http://flipnote.hatena.com/ds/v2-xx/frontpage/likedmovies.uls?page=%i" % (page+1), ("", ""), None))
return ugo.Pack()
@@ -0,0 +1,91 @@
from twisted.web import resource
from twisted.internet import reactor
import time
from hatena import Database, Log, NotFound
from Hatenatools import UGO
#makes a flipnote list of the newest flipnotes
class PyResource(resource.Resource):
isLeaf = True
def __init__(self):
resource.Resource.__init__(self)
self.pages = []#10 first pages
self.newestflip = None
self.Update()
def render(self, request):
page = int(request.args["page"][0]) if "page" in request.args else 1
if len(self.pages) >= page:
path = "/".join(request.path.split("/")[3:])
Log(request, "%s page %i" % (path, page))
request.responseHeaders.setRawHeaders('content-type', ['text/plain'])
return self.pages[page-1]
#elif (page-1)*50 < len(Database.Newest):
# pass
else:
return NotFound.render(request)
#===
def Update(self):#called every minute
reactor.callLater(60, self.Update)
if self.newestflip <> Database.Newest[0]:
self.newestflip = Database.Newest[0]
reactor.callInThread(self.UpdateThreaded, Database.Newest)
def UpdateThreaded(self, flipnotes):#run in an another thread
#create pages:
pages = []
pagecount = (len(flipnotes)-1)/50 + 1
if pagecount > 10: pagecount = 10#temp?
flipcount = len(flipnotes)
for i in xrange(min((pagecount, 10))):
pages.append(self.MakePage(flipnotes[i*50:i*50+50], i+1, i<pagecount-1, flipcount))
if self.pages:#not on startup
print time.strftime("[%H:%M:%S] Updated newmovies.ugo")
self.pages = pages
def MakePage(self, flipnotes, page, next, count):
ugo = UGO()
ugo.Loaded = True
ugo.Items = []
#meta
ugo.Items.append(("layout", (2, 1)))
ugo.Items.append(("topscreen text", ["New Flipnotes", "Flipnotes", str(count), "", "The newest Flipnotes submitted."], 0))
#categories
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/hotmovies.uls", "Most Popular", False))
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/likedmovies.uls", "Most Liked", False))
#ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/recommended.uls", "Recommended", False))
ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/newmovies.uls", "New Flipnotes", True))
#ugo.Items.append(("category", "http://flipnote.hatena.com/ds/v2-xx/frontpage/following.uls", "New Favourites", False))
#the "post flipnote" button
ugo.Items.append(("unknown", ("3", "http://flipnote.hatena.com/ds/v2-xx/help/post_howto.htm", "UABvAHMAdAAgAEYAbABpAHAAbgBvAHQAZQA=")))
#previous page
if page > 1:
ugo.Items.append(("button", 115, "Previous", "http://flipnote.hatena.com/ds/v2-xx/frontpage/newmovies.uls?page=%i" % (page-1), ("", ""), None))
#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()
#next page
if next:
ugo.Items.append(("button", 115, "Next", "http://flipnote.hatena.com/ds/v2-xx/frontpage/newmovies.uls?page=%i" % (page+1), ("", ""), None))
return ugo.Pack()
+1
View File
@@ -0,0 +1 @@
<html>␍ <head>␍ <title>Post Flipnote</title>␍ <meta name="uppertitle" content="Post Flipnote">␍ <meta name="postchannelbutton" content="http://flipnote.hatena.com/ds/v2-xx/post/flipnote.post">␍ <link rel="stylesheet" type="text/css" href="http://flipnote.hatena.com/css/ds/common.css">␍ </head>␍ <body>␍ <div class="container">␍ <div class="title" align="center">Posting a Flipnote</div>␍ <div class="news-body">␍ <p>Posting a flipnote is as easy as pressing the button down below and selecting the flipnote you want to upload!</p>␍ </div>␍ </div>␍ </body>␍</html>
Binary file not shown.
+72
View File
@@ -0,0 +1,72 @@
<?xml version='1.0' encoding='UTF-8'?>
<ugo_xml>
<layout>
<value>0</value>
</layout>
<title>
<label />
<label />
<label />
<label />
<label />
<num>0</num>
</title>
<button>
<label>All Flipnotes</label>
<address>http://flipnote.hatena.com/ds/v2-eu/frontpage/hotmovies.uls</address>
<trait>100</trait>
<value />
<value>0</value>
</button>
<button>
<label>Announcement</label>
<address>http://flipnote.hatena.com/ds/v2-eu/information.uls</address>
<trait>102</trait>
<value />
<value>0</value>
</button>
<button>
<label>Channels</label>
<address>http://flipnote.hatena.com/ds/v2-eu/channels.uls</address>
<trait>101</trait>
<value />
<value>0</value>
</button>
<button>
<label>News</label>
<address>http://flipnote.hatena.com/ds/v2-eu/help/news.htm?mode=archives</address>
<trait>0</trait>
<value />
<value>0</value>
<embedded_file>__ntfts\News.ntft</embedded_file>
</button>
<button>
<label>Creator's Room</label>
<address>http://flipnote.hatena.com/ds/v2-eu/96FAD88031C49DE1/profile.htm?pm=80&amp;t=260</address>
<trait>104</trait>
<value />
<value>0</value>
</button>
<button>
<label>Special Room</label>
<address>http://flipnote.hatena.com/ds/v2-eu/special_room.htm</address>
<trait>1</trait>
<value />
<value>0</value>
<embedded_file>__ntfts\Special Room.ntft</embedded_file>
</button>
<button>
<label>Help</label>
<address>http://flipnote.hatena.com/ds/v2-eu/help/index_ww.htm</address>
<trait>117</trait>
<value />
<value>0</value>
</button>
<button>
<label>Command Search</label>
<address>ugomemo://command</address>
<trait>103</trait>
<value />
<value>0</value>
</button>
</ugo_xml>
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
from twisted.web import resource
import os
from hatena import Database, Log, ServerLog, Silent, NotFound
detailsHMTL = """uguu"""
#The movie folder:
class PyResource(resource.Resource):
isLeaf = False
def __init__(self):
resource.Resource.__init__(self)
self.CreatorID = CreatorID()
def getChild(self, name, request):
if Database.CreatorExists(name):
return self.CreatorID
elif name == "":
return self
else:
return NotFound
def render(self, request):
request.setResponseCode(403)
return "403 - Denied access"
#The creator ID folder:
class CreatorID(resource.Resource):
isLeaf = False
def __init__(self):
resource.Resource.__init__(self)
self.CreatorIDFile = CreatorIDFile()
def getChild(self, name, request):
CreatorID = request.path.split("/")[-2]
filename = ".".join(name.split(".")[:-1])
if Database.FlipnoteExists(CreatorID, filename):#html, ppm and info
return self.CreatorIDFile
elif name == "":
return self
else:
return NotFound
def render(self, request):
request.setResponseCode(403)
return "403 - Denied access"
#Any public file inside creator ID folder:
class CreatorIDFile(resource.Resource):
isLeaf = True
def __init__(self):
resource.Resource.__init__(self)
def render(self, request):
creator, file = request.path.split("/")[-2:]
filetype = file.split(".")[-1].lower()
if filetype == "ppm":
#log it:
path = "/".join(request.path.split("/")[3:])
Log(request, path)
#add a view:
Database.AddView(creator, file[:-4])
#read ppm file:
f = open(Database.FlipnotePath(creator, file), "rb")
data = f.read()
f.close()
#send file to client:
request.responseHeaders.setRawHeaders('content-type', ['text/plain'])
return data
elif filetype == "info":
path = "/".join(request.path.split("/")[3:])
Log(request, path)
request.responseHeaders.setRawHeaders('content-type', ['text/plain'])
return "0\n0\n"#undocumented what it means
elif filetype == "htm":#not yet implemented
#ret = detailsHMTL[:]
#ret.replace("%%CreatorID%%", creator)
#ret.replace("%%Filename%%", file[:-4])#without the ext
#ret.replace("%%%%", )
#ret.replace("%%%%", )
return "Not yet implemented"
else:
path = "/".join(request.path.split("/")[3:])
ServerLog.write("%s got 403 when requesting " % (request.getClientIP(), path), Silent)
request.setResponseCode(403)
return "403 - Denied access"
Binary file not shown.
+32
View File
@@ -0,0 +1,32 @@
from twisted.web import resource
from twisted.internet import reactor
import time
from hatena import Database, ServerLog, Silent
from Hatenatools import TMB
#Handle flipnote uploads
class PyResource(resource.Resource):
isLeaf = True
def render_GET(self, request):
ServerLog.write("%s got 403 when requesting post/flipnote.post with GET" % (request.getClientIP()), Silent)
request.setResponseCode(405)
return "405 - Method Not Allowed"
def render_POST(self, request):#implement channels?
data = request.content.read()
channel = ""
if "channel" in request.args:
channel = request.args["channel"][0]
add = Database.AddFlipnote(data, channel)
if add:
ServerLog.write("%s successfully uploaded \"%s.ppm\"" % (request.getClientIP(), add[1]), Silent)
request.setResponseCode(200)
else:
ServerLog.write("%s tried to upload a flipnote, but failed..." % request.getClientIP(), Silent)
request.setResponseCode(500)#only causes an error, need to fix
return ""
#===