update historyDownload script and api/history for yyyy subfolder
This commit is contained in:
parent
47bd8b85fc
commit
a60c40c51f
|
@ -13,7 +13,9 @@ async function history(req: Request, res: Response) {
|
||||||
if (!BACKUP_DIR || !day || !id || day.includes('/') || day.includes('\\')) {
|
if (!BACKUP_DIR || !day || !id || day.includes('/') || day.includes('\\')) {
|
||||||
res.status(404).end();
|
res.status(404).end();
|
||||||
}
|
}
|
||||||
const path = `${BACKUP_DIR}/${day}/${id}`;
|
const yyyy = day.slice(0, 4);
|
||||||
|
const mmdd = day.slice(4);
|
||||||
|
const path = `${BACKUP_DIR}/${yyyy}/${mmdd}/${id}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ async def get_area(canvas, x, y, w, h, start_date, end_date):
|
||||||
image = PIL.Image.new('RGBA', (w, h))
|
image = PIL.Image.new('RGBA', (w, h))
|
||||||
for iy in range(yc, hc + 1):
|
for iy in range(yc, hc + 1):
|
||||||
for ix in range(xc, wc + 1):
|
for ix in range(xc, wc + 1):
|
||||||
url = 'https://storage.pixelplanet.fun/%s/%s/tiles/%s/%s.png' % (iter_date, canvas_id, ix, iy)
|
url = 'https://storage.pixelplanet.fun/%s/%s/%s/tiles/%s/%s.png' % (iter_date[0:4], iter_date[4:], canvas_id, ix, iy)
|
||||||
offx = ix * 256 + offset - x
|
offx = ix * 256 + offset - x
|
||||||
offy = iy * 256 + offset - y
|
offy = iy * 256 + offset - y
|
||||||
tasks.append(fetch(session, url, offx, offy, image, bkg, True))
|
tasks.append(fetch(session, url, offx, offy, image, bkg, True))
|
||||||
|
@ -153,7 +153,7 @@ async def get_area(canvas, x, y, w, h, start_date, end_date):
|
||||||
image_rel = image.copy()
|
image_rel = image.copy()
|
||||||
for iy in range(yc, hc + 1):
|
for iy in range(yc, hc + 1):
|
||||||
for ix in range(xc, wc + 1):
|
for ix in range(xc, wc + 1):
|
||||||
url = 'https://storage.pixelplanet.fun/%s/%s/%s/%s/%s.png' % (iter_date, canvas_id, time, ix, iy)
|
url = 'https://storage.pixelplanet.fun/%s/%s/%s/%s/%s/%s.png' % (iter_date[0:4], iter_date[4:], canvas_id, time, ix, iy)
|
||||||
offx = ix * 256 + offset - x
|
offx = ix * 256 + offset - x
|
||||||
offy = iy * 256 + offset - y
|
offy = iy * 256 + offset - y
|
||||||
tasks.append(fetch(session, url, offx, offy, image_rel, bkg))
|
tasks.append(fetch(session, url, offx, offy, image_rel, bkg))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user