Delete hatenadir directory
This commit is contained in:
1 parent
3de81e01af
commit
4bd2cc874f
41 files changed
-3019
No files matched your search
@@ -1 +0,0 @@
|
||||
����������������������������������������������������������������ςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σςς�Σ�Σςς�Σ�Σ�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�ΣΟ‚�Σςςςς�ΣΟ‚�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�ΣΟ‚�Σςςςς�ΣΟ‚�Σ�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςςς�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σςς�Σ�Σ�Σ�Σ�Σ�Σςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σςςς�Σ�Σ�Σ�Σ�Σ�Σςςς�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σςςςς�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςς�Σ�Σςςςς�Σ�Σ�Σ�Σςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σςςςςςςςςςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςςςςςςςς�Σςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςς�Σςςςςςςςςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςς�Σςςςςςςςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σςςςςςςςςςςςςςςς�Σςςςςςς�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςς�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σ�Σςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςςς����������������������������������������������������������������
|
||||
@@ -1 +0,0 @@
|
||||
���������������サ纎ロワ������������������������ン�モォョ完完完完完諌�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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
RQBuAGcAbABpAHMAaAA= en
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,73 +0,0 @@
|
||||
from twisted.web import resource
|
||||
from twisted.internet import reactor
|
||||
import time
|
||||
|
||||
from hatena import Log, NotFound, request_args, request_path
|
||||
from DB import Database
|
||||
from Hatenatools import UGO
|
||||
|
||||
|
||||
class PyResource(resource.Resource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.pages = []
|
||||
self.newestflip = None
|
||||
self.newestview = None
|
||||
self.Update()
|
||||
|
||||
def render(self, request):
|
||||
try:
|
||||
page = int(request_args(request).get("page", ["1"])[0])
|
||||
except ValueError:
|
||||
page = 1
|
||||
if 1 <= page <= len(self.pages):
|
||||
path = "/".join(request_path(request).split("/")[3:])
|
||||
Log(request, "%s page %i" % (path, page))
|
||||
request.setHeader(b"content-type", b"text/plain")
|
||||
return self.pages[page - 1]
|
||||
return NotFound.render(request)
|
||||
|
||||
def Update(self):
|
||||
reactor.callLater(600, self.Update)
|
||||
current = Database.Newest[0] if Database.Newest else None
|
||||
if current != self.newestflip or self.newestview != Database.Views:
|
||||
self.newestflip = current
|
||||
self.newestview = Database.Views
|
||||
reactor.callInThread(self.UpdateThreaded, list(Database.Newest))
|
||||
|
||||
def UpdateThreaded(self, flipnotes):
|
||||
def score(item):
|
||||
i, (creator_id, flip) = item
|
||||
views, stars = Database.GetFlipnote(creator_id, flip)[1:3]
|
||||
return int(views) * 60 + int(stars) // 4 - i
|
||||
flipnotes = [x[1] for x in sorted(enumerate(flipnotes), key=score, reverse=True)[:500]]
|
||||
pages = []
|
||||
pagecount = (len(flipnotes) + 49) // 50
|
||||
pagecount = min(pagecount, 10)
|
||||
flipcount = min(len(flipnotes), 500)
|
||||
for i in range(pagecount):
|
||||
pages.append(self.MakePage(flipnotes[i * 50 : i * 50 + 50], i + 1, i < pagecount - 1, flipcount))
|
||||
if self.pages:
|
||||
print(time.strftime("[%H:%M:%S] Updated hotmovies.ugo"))
|
||||
self.pages = pages
|
||||
|
||||
def MakePage(self, flipnotes, page, has_next, count):
|
||||
ugo = UGO()
|
||||
ugo.Loaded = True
|
||||
ugo.Items = []
|
||||
ugo.Items.append(("layout", (2, 1)))
|
||||
ugo.Items.append(("topscreen text", ["Popular Flipnotes", "Flipnotes", str(count), "", "The most popular new Flipnotes."], 0))
|
||||
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/newmovies.uls", "New Flipnotes", False))
|
||||
ugo.Items.append(("unknown", ("3", "http://flipnote.hatena.com/ds/v2-xx/help/post_howto.htm", "UABvAHMAdAAgAEYAbABpAHAAbgBvAHQAZQA=")))
|
||||
if page > 1:
|
||||
ugo.Items.append(("button", 115, "Previous", "http://flipnote.hatena.com/ds/v2-xx/frontpage/hotmovies.uls?page=%i" % (page - 1), ("", ""), None))
|
||||
for creatorid, filename in flipnotes:
|
||||
stars = str(Database.GetFlipnote(creatorid, filename)[2])
|
||||
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))))
|
||||
if has_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()
|
||||
@@ -1,73 +0,0 @@
|
||||
from twisted.web import resource
|
||||
from twisted.internet import reactor
|
||||
import time
|
||||
|
||||
from hatena import Log, NotFound, request_args, request_path
|
||||
from DB import Database
|
||||
from Hatenatools import UGO
|
||||
|
||||
|
||||
class PyResource(resource.Resource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.pages = []
|
||||
self.newestflip = None
|
||||
self.neweststar = None
|
||||
reactor.callLater(2, self.Update)
|
||||
|
||||
def render(self, request):
|
||||
try:
|
||||
page = int(request_args(request).get("page", ["1"])[0])
|
||||
except ValueError:
|
||||
page = 1
|
||||
if 1 <= page <= len(self.pages):
|
||||
path = "/".join(request_path(request).split("/")[3:])
|
||||
Log(request, "%s page %i" % (path, page))
|
||||
request.setHeader(b"content-type", b"text/plain")
|
||||
return self.pages[page - 1]
|
||||
return NotFound.render(request)
|
||||
|
||||
def Update(self):
|
||||
reactor.callLater(600, self.Update)
|
||||
current = Database.Newest[0] if Database.Newest else None
|
||||
if current != self.newestflip or self.neweststar != Database.Stars:
|
||||
self.newestflip = current
|
||||
self.neweststar = Database.Stars
|
||||
reactor.callInThread(self.UpdateThreaded, list(Database.Newest))
|
||||
|
||||
def UpdateThreaded(self, flipnotes):
|
||||
def score(item):
|
||||
i, (creator_id, flip) = item
|
||||
views, stars = Database.GetFlipnote(creator_id, flip)[1:3]
|
||||
return int(stars) * 110 + int(views) // 10 - i
|
||||
flipnotes = [x[1] for x in sorted(enumerate(flipnotes), key=score, reverse=True)[:500]]
|
||||
pages = []
|
||||
pagecount = (len(flipnotes) + 49) // 50
|
||||
pagecount = min(pagecount, 10)
|
||||
flipcount = min(len(flipnotes), 500)
|
||||
for i in range(pagecount):
|
||||
pages.append(self.MakePage(flipnotes[i * 50 : i * 50 + 50], i + 1, i < pagecount - 1, flipcount))
|
||||
if self.pages:
|
||||
print(time.strftime("[%H:%M:%S] Updated likedmovies.ugo"))
|
||||
self.pages = pages
|
||||
|
||||
def MakePage(self, flipnotes, page, has_next, count):
|
||||
ugo = UGO()
|
||||
ugo.Loaded = True
|
||||
ugo.Items = []
|
||||
ugo.Items.append(("layout", (2, 1)))
|
||||
ugo.Items.append(("topscreen text", ["Liked Flipnotes", "Flipnotes", str(count), "", "The most liked new Flipnotes."], 0))
|
||||
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/newmovies.uls", "New Flipnotes", False))
|
||||
ugo.Items.append(("unknown", ("3", "http://flipnote.hatena.com/ds/v2-xx/help/post_howto.htm", "UABvAHMAdAAgAEYAbABpAHAAbgBvAHQAZQA=")))
|
||||
if page > 1:
|
||||
ugo.Items.append(("button", 115, "Previous", "http://flipnote.hatena.com/ds/v2-xx/frontpage/likedmovies.uls?page=%i" % (page - 1), ("", ""), None))
|
||||
for creatorid, filename in flipnotes:
|
||||
stars = str(Database.GetFlipnote(creatorid, filename)[2])
|
||||
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))))
|
||||
if has_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()
|
||||
@@ -1,67 +0,0 @@
|
||||
from twisted.web import resource
|
||||
from twisted.internet import reactor
|
||||
import time
|
||||
|
||||
from hatena import Log, NotFound, request_args, request_path
|
||||
from DB import Database
|
||||
from Hatenatools import UGO
|
||||
|
||||
|
||||
class PyResource(resource.Resource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.pages = []
|
||||
self.newestflip = None
|
||||
reactor.callLater(4, self.Update)
|
||||
|
||||
def render(self, request):
|
||||
try:
|
||||
page = int(request_args(request).get("page", ["1"])[0])
|
||||
except ValueError:
|
||||
page = 1
|
||||
if 1 <= page <= len(self.pages):
|
||||
path = "/".join(request_path(request).split("/")[3:])
|
||||
Log(request, "%s page %i" % (path, page))
|
||||
request.setHeader(b"content-type", b"text/plain")
|
||||
return self.pages[page - 1]
|
||||
return NotFound.render(request)
|
||||
|
||||
def Update(self):
|
||||
reactor.callLater(60, self.Update)
|
||||
current = Database.Newest[0] if Database.Newest else None
|
||||
if current != self.newestflip:
|
||||
self.newestflip = current
|
||||
reactor.callInThread(self.UpdateThreaded, list(Database.Newest))
|
||||
|
||||
def UpdateThreaded(self, flipnotes):
|
||||
flipnotes = list(flipnotes)
|
||||
pages = []
|
||||
pagecount = (len(flipnotes) + 49) // 50
|
||||
pagecount = min(pagecount, 10)
|
||||
flipcount = len(flipnotes)
|
||||
for i in range(pagecount):
|
||||
pages.append(self.MakePage(flipnotes[i * 50 : i * 50 + 50], i + 1, i < pagecount - 1, flipcount))
|
||||
if self.pages:
|
||||
print(time.strftime("[%H:%M:%S] Updated newmovies.ugo"))
|
||||
self.pages = pages
|
||||
|
||||
def MakePage(self, flipnotes, page, has_next, count):
|
||||
ugo = UGO()
|
||||
ugo.Loaded = True
|
||||
ugo.Items = []
|
||||
ugo.Items.append(("layout", (2, 1)))
|
||||
ugo.Items.append(("topscreen text", ["New Flipnotes", "Flipnotes", str(count), "", "The newest Flipnotes submitted."], 0))
|
||||
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/newmovies.uls", "New Flipnotes", True))
|
||||
ugo.Items.append(("unknown", ("3", "http://flipnote.hatena.com/ds/v2-xx/help/post_howto.htm", "UABvAHMAdAAgAEYAbABpAHAAbgBvAHQAZQA=")))
|
||||
if page > 1:
|
||||
ugo.Items.append(("button", 115, "Previous", "http://flipnote.hatena.com/ds/v2-xx/frontpage/newmovies.uls?page=%i" % (page - 1), ("", ""), None))
|
||||
for creatorid, filename in flipnotes:
|
||||
stars = str(Database.GetFlipnote(creatorid, filename)[2])
|
||||
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))))
|
||||
if has_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 +0,0 @@
|
||||
<html>␍ <head>␍ <title>Info</title>␍ <meta name="uppertitle" content="Info">␍ <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">pbsds's Hatena Server</div>␍ <div class="news-body">␍ <p>This server is a proof of concept server. There's not much functionality yet because it's in early stages. Please enjoy your stay.</p>␍ </div>␍ </div>␍ </body>␍</html>
|
||||
@@ -1 +0,0 @@
|
||||
<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>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<ugo_xml>
|
||||
<layout>
|
||||
<value>2</value>
|
||||
<value>1</value>
|
||||
</layout>
|
||||
<title>
|
||||
<label>Inbox</label>
|
||||
<label />
|
||||
<label />
|
||||
<label />
|
||||
<label />
|
||||
<num>0</num>
|
||||
</title>
|
||||
<button>
|
||||
<label>Info</label>
|
||||
<address>http://flipnote.hatena.com/ds/v2-xx/help/info.htm</address>
|
||||
<trait>3</trait>
|
||||
</button>
|
||||
</ugo_xml>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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>Browse Flipnotes</label>
|
||||
<address>http://flipnote.hatena.com/ds/v2-xx/frontpage/hotmovies.uls</address>
|
||||
<trait>100</trait>
|
||||
<value />
|
||||
<value>0</value>
|
||||
</button>
|
||||
<button>
|
||||
<label>Info</label>
|
||||
<address>http://flipnote.hatena.com/ds/v2-xx/help/info.htm</address>
|
||||
<trait>0</trait>
|
||||
<value />
|
||||
<value>0</value>
|
||||
<embedded_file>__ntfts/News.ntft</embedded_file>
|
||||
</button>
|
||||
</ugo_xml>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,221 +0,0 @@
|
||||
from twisted.web import resource
|
||||
|
||||
from hatena import Log, ServerLog, Silent, NotFound, as_text, request_path, request_args, request_headers, client_ip
|
||||
from DB import Database
|
||||
from Hatenatools import TMB
|
||||
|
||||
|
||||
class PyResource(resource.Resource):
|
||||
isLeaf = False
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.CreatorID = CreatorIDResource()
|
||||
|
||||
def getChild(self, name, request):
|
||||
name = as_text(name)
|
||||
if Database.CreatorExists(name):
|
||||
return self.CreatorID
|
||||
if name == "":
|
||||
return self
|
||||
return NotFound
|
||||
|
||||
def render(self, request):
|
||||
request.setResponseCode(403)
|
||||
return b"403 - Denied access"
|
||||
|
||||
|
||||
class CreatorIDResource(resource.Resource):
|
||||
isLeaf = False
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.CreatorIDFile = CreatorIDFileResource()
|
||||
|
||||
def getChild(self, name, request):
|
||||
creator_id = request_path(request).split("/")[-2]
|
||||
name = as_text(name)
|
||||
filename = ".".join(name.split(".")[:-1])
|
||||
if Database.FlipnoteExists(creator_id, filename):
|
||||
return self.CreatorIDFile
|
||||
if name == "":
|
||||
return self
|
||||
return NotFound
|
||||
|
||||
def render(self, request):
|
||||
request.setResponseCode(403)
|
||||
return b"403 - Denied access"
|
||||
|
||||
|
||||
class CreatorIDFileResource(resource.Resource):
|
||||
isLeaf = True
|
||||
|
||||
def render(self, request):
|
||||
creator, file = request_path(request).split("/")[-2:]
|
||||
filetype = file.rsplit(".", 1)[-1].lower()
|
||||
path = "/".join(request_path(request).split("/")[3:])
|
||||
|
||||
if filetype == "ppm":
|
||||
Log(request, path)
|
||||
Database.AddView(creator, file[:-4])
|
||||
request.setHeader(b"content-type", b"text/plain")
|
||||
return Database.GetFlipnotePPM(creator, file[:-4])
|
||||
|
||||
if filetype == "info":
|
||||
Log(request, path, True)
|
||||
request.setHeader(b"content-type", b"text/plain")
|
||||
return b"0\n0\n"
|
||||
|
||||
if filetype == "htm":
|
||||
request.setHeader(b"content-type", b"text/html; charset=utf-8")
|
||||
return self.GenerateDetailsPage(creator, ".".join(file.split(".")[:-1])).encode("UTF-8")
|
||||
|
||||
if filetype == "star":
|
||||
args = request_args(request)
|
||||
color = args.get("starcolor", ["yellow"])[0].split(",", 1)[0].lower()
|
||||
headers = request_headers(request)
|
||||
if "x-hatena-star-count" not in headers:
|
||||
ServerLog.write(
|
||||
"%s got 403 when requesting %s without a X-Hatena-Star-Count header" % (client_ip(request), path),
|
||||
Silent,
|
||||
)
|
||||
request.setResponseCode(403)
|
||||
return b"403 - Denied access\nRequest lacks a X-Hatena-Star-Count http header"
|
||||
try:
|
||||
amount = int(headers["x-hatena-star-count"])
|
||||
except ValueError:
|
||||
amount = 0
|
||||
if amount < 1 or amount > 65535:
|
||||
ServerLog.write(
|
||||
"%s got 403 when requesting %s with an invalid X-Hatena-Star-Count header" % (client_ip(request), path),
|
||||
Silent,
|
||||
)
|
||||
request.setResponseCode(403)
|
||||
return b"403 - Denied access\nRequest has an invalid X-Hatena-Star-Count http header"
|
||||
if not Database.AddStar(creator, file[:-5], amount, color):
|
||||
ServerLog.write("%s got 500 when requesting %s" % (client_ip(request), path), Silent)
|
||||
request.setResponseCode(500)
|
||||
return b"500 - Internal server error\nAdding the stars seems to have failed."
|
||||
ServerLog.write(
|
||||
"%s added %i %s stars to %s/%s.ppm" % (client_ip(request), amount, color, creator, file[:-5]),
|
||||
Silent,
|
||||
)
|
||||
return b"Success"
|
||||
|
||||
if filetype == "dl":
|
||||
Log(request, path, True)
|
||||
Database.AddDownload(creator, file[:-3])
|
||||
return b"Noted ;)"
|
||||
|
||||
ServerLog.write("%s got 403 when requesting %s" % (client_ip(request), path), Silent)
|
||||
request.setResponseCode(403)
|
||||
return b"403 - Denied access"
|
||||
|
||||
def GenerateDetailsPage(self, CreatorID, filename):
|
||||
flipnote = Database.GetFlipnote(CreatorID, filename)
|
||||
if not flipnote:
|
||||
return "This flipnote doesn't exist!"
|
||||
tmb = TMB().Read(Database.GetFlipnoteTMB(CreatorID, filename))
|
||||
if not tmb:
|
||||
return "This flipnote is corrupt!"
|
||||
|
||||
spinoff = ""
|
||||
if tmb.OriginalAuthorID != tmb.EditorAuthorID or tmb.OriginalFilename != tmb.CurrentFilename:
|
||||
if Database.FlipnoteExists(tmb.OriginalAuthorID, tmb.OriginalFilename[:-4]):
|
||||
spinoff = SpinoffTemplate1.replace("%%CreatorID%%", tmb.OriginalAuthorID).replace("%%Filename%%", tmb.OriginalFilename[:-4])
|
||||
elif tmb.OriginalAuthorID != tmb.EditorAuthorID:
|
||||
spinoff = SpinoffTemplate2
|
||||
|
||||
entries = []
|
||||
content = '<a href="http://flipnote.hatena.com/ds/v2-xx/%s/profile.htm?t=260&pm=80">%s</a>' % (CreatorID, tmb.Username)
|
||||
entries.append(PageEntryTemplate.replace("%%Name%%", "Creator").replace("%%Content%%", content))
|
||||
|
||||
content = '<a href="http://flipnote.hatena.com/ds/v2-xx/movie/%s/%s.htm?mode=stardetail"><span class="star0c">★</span> <span class="star0">%s</span></a>' % (CreatorID, filename, flipnote[2])
|
||||
for css, value in zip(("1", "2", "3", "4"), flipnote[3:7]):
|
||||
content += '<br/><a href="http://flipnote.hatena.com/ds/v2-xx/movie/%s/%s.htm?mode=stardetail"><span class="star%sc">★</span> <span class="star%s">%s</span></a>' % (CreatorID, filename, css, css, value)
|
||||
entries.append(PageEntryTemplate.replace("%%Name%%", "Stars").replace("%%Content%%", content))
|
||||
entries.append(PageEntryTemplate.replace("%%Name%%", "Views").replace("%%Content%%", str(flipnote[1])))
|
||||
entries.append(PageEntryTemplate.replace("%%Name%%", "Downloads").replace("%%Content%%", str(flipnote[8])))
|
||||
|
||||
if flipnote[7]:
|
||||
content = '<a href="http://flipnote.hatena.com/ds/v2-xx/ch/%s.uls">%s</a>' % (flipnote[7], flipnote[7])
|
||||
entries.append(PageEntryTemplate.replace("%%Name%%", "Channel").replace("%%Content%%", content))
|
||||
|
||||
return (
|
||||
DetailsPageTemplate.replace("%%CreatorID%%", CreatorID)
|
||||
.replace("%%Filename%%", filename)
|
||||
.replace("%%Username%%", tmb.Username)
|
||||
.replace("%%CommentCount%%", "0")
|
||||
.replace("%%Spinoff%%", spinoff)
|
||||
.replace("%%PageEntries%%", PageEntrySeparator.join(entries))
|
||||
)
|
||||
|
||||
#templates:
|
||||
DetailsPageTemplate = """<html>
|
||||
<head>
|
||||
<title>Flipnote by %%Username%%</title>
|
||||
<meta name="upperlink" content="http://flipnote.hatena.com/ds/v2-xx/movie/%%CreatorID%%/%%Filename%%.ppm">
|
||||
<meta name="starbutton" content="http://flipnote.hatena.com/ds/v2-xx/movie/%%CreatorID%%/%%Filename%%.star">
|
||||
<meta name="starbutton1" content="http://flipnote.hatena.com/ds/v2-xx/movie/%%CreatorID%%/%%Filename%%.star?starcolor=green,9001">
|
||||
<meta name="starbutton2" content="http://flipnote.hatena.com/ds/v2-xx/movie/%%CreatorID%%/%%Filename%%.star?starcolor=red,9001">
|
||||
<meta name="starbutton3" content="http://flipnote.hatena.com/ds/v2-xx/movie/%%CreatorID%%/%%Filename%%.star?starcolor=blue,9001">
|
||||
<meta name="starbutton4" content="http://flipnote.hatena.com/ds/v2-xx/movie/%%CreatorID%%/%%Filename%%.star?starcolor=purple,9001">
|
||||
<meta name="savebutton" content="http://flipnote.hatena.com/ds/v2-xx/movie/%%CreatorID%%/%%Filename%%.ppm">
|
||||
<meta name="playcontrolbutton" content="">
|
||||
<link rel="stylesheet" href="http://flipnote.hatena.com/css/ds/basic.css">
|
||||
</head>
|
||||
<body>
|
||||
<table width="240" border="0" cellspacing="0" cellpadding="0" class="tab">
|
||||
<tr>
|
||||
<td class="border" width="5" align="center">
|
||||
<div class="border"></div>
|
||||
</td>
|
||||
<td class="border" width="70" align="center">
|
||||
<div class="border"></div>
|
||||
</td>
|
||||
<td class="border" width="95" align="center">
|
||||
<div class="border"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space"> </td>
|
||||
<td class="tabon" align="center">
|
||||
<div class="on" align="center">Description</div>
|
||||
</td>
|
||||
<td class="taboff" align="center">
|
||||
<a class="taboff" href="http://flipnote.hatena.com/ds/v2-eu/movie/%%CreatorID%%/%%Filename%%.htm?mode=commentshalfsize">Comments(%%CommentCount%%)</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pad5b"></div>%%Spinoff%%
|
||||
<table width="226" border="0" cellspacing="0" cellpadding="0" class="detail">%%PageEntries%%
|
||||
</table>
|
||||
</body>
|
||||
</html>"""
|
||||
SpinoffTemplate1 = """
|
||||
<div class="notice2" align="center">
|
||||
This Flipnote is a spin-off.<br>
|
||||
<a href="http://flipnote.hatena.com/ds/v2-eu/movie/%%CreatorID%%/%%Filename%%.htm">Original Flipnote</a>
|
||||
</div>"""
|
||||
SpinoffTemplate2 = """
|
||||
<div class="notice2" align="center">
|
||||
This Flipnote is a spin-off.
|
||||
</div>"""
|
||||
PageEntryTemplate = """
|
||||
<tr>
|
||||
<th width="90">
|
||||
<div class="item-term" align="left">%%Name%%</div>
|
||||
</th>
|
||||
<td width="136">
|
||||
<div class="item-value" align="right">
|
||||
%%Content%%
|
||||
</div>
|
||||
</td>
|
||||
</tr>"""
|
||||
PageEntrySeparator="""
|
||||
<tr> </tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="hr"></div>
|
||||
</td>
|
||||
</tr>"""
|
||||
@@ -1,25 +0,0 @@
|
||||
from twisted.web import resource
|
||||
|
||||
from hatena import ServerLog, Silent, request_args, client_ip
|
||||
from DB import Database
|
||||
|
||||
|
||||
class PyResource(resource.Resource):
|
||||
isLeaf = True
|
||||
|
||||
def render_GET(self, request):
|
||||
ServerLog.write("%s got 403 when requesting post/flipnote.post with GET" % client_ip(request), Silent)
|
||||
request.setResponseCode(405)
|
||||
return b"405 - Method Not Allowed"
|
||||
|
||||
def render_POST(self, request):
|
||||
data = request.content.read()
|
||||
channel = request_args(request).get("channel", [""])[0]
|
||||
add = Database.AddFlipnote(data, channel)
|
||||
if add:
|
||||
ServerLog.write('%s successfully uploaded "%s.ppm"' % (client_ip(request), add[1]), Silent)
|
||||
request.setResponseCode(200)
|
||||
else:
|
||||
ServerLog.write("%s tried to upload a flipnote, but failed..." % client_ip(request), Silent)
|
||||
request.setResponseCode(500)
|
||||
return b""
|
||||
Reference in new issue
Block a user
