|
|
@ -10,9 +10,9 @@ import json |
|
|
|
import logging |
|
|
|
import logging |
|
|
|
import os |
|
|
|
import os |
|
|
|
import re |
|
|
|
import re |
|
|
|
|
|
|
|
import time |
|
|
|
import urllib.parse |
|
|
|
import urllib.parse |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateHttpServer: |
|
|
|
class UpdateHttpServer: |
|
|
|
def __init__(self, port, bind, catalog_dir): |
|
|
|
def __init__(self, port, bind, catalog_dir): |
|
|
|
def handler(*args): |
|
|
|
def handler(*args): |
|
|
@ -120,8 +120,9 @@ def dir_json(path): |
|
|
|
else: |
|
|
|
else: |
|
|
|
e['type'] = "file" |
|
|
|
e['type'] = "file" |
|
|
|
if os.path.splitext(entry)[1] == '.bin': |
|
|
|
if os.path.splitext(entry)[1] == '.bin': |
|
|
|
|
|
|
|
fn = os.path.join(path, entry) |
|
|
|
try: |
|
|
|
try: |
|
|
|
f = open(os.path.join(path, entry), 'rb') |
|
|
|
f = open(fn, 'rb') |
|
|
|
c = f.read(1) |
|
|
|
c = f.read(1) |
|
|
|
f.close() |
|
|
|
f.close() |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
@ -129,6 +130,10 @@ def dir_json(path): |
|
|
|
c = b'\x00' |
|
|
|
c = b'\x00' |
|
|
|
if c == b'\xe9': |
|
|
|
if c == b'\xe9': |
|
|
|
e['type'] = "bin" |
|
|
|
e['type'] = "bin" |
|
|
|
|
|
|
|
mtime = os.path.getmtime(fn); |
|
|
|
|
|
|
|
e['date'] = time.strftime('%x', time.localtime(mtime)) |
|
|
|
|
|
|
|
e['time'] = time.strftime('%X', time.localtime(mtime)) |
|
|
|
|
|
|
|
e['size'] = os.path.getsize(fn) |
|
|
|
d.append(e) |
|
|
|
d.append(e) |
|
|
|
return d |
|
|
|
return d |
|
|
|
|
|
|
|
|
|
|
|