fix order in json out + test x file list ordinata
This commit is contained in:
@@ -8,6 +8,8 @@ import os
|
||||
import json
|
||||
from werkzeug.utils import redirect
|
||||
import os.path, time
|
||||
#from pathlib import Path
|
||||
#from stat import S_ISREG, ST_CTIME, ST_MODE
|
||||
|
||||
#assegno ipv4 statico
|
||||
ipv4 = '10.74.83.210'
|
||||
@@ -25,6 +27,7 @@ def getRedisVal(redisKey):
|
||||
return redSrv0.get(redisKey).decode('utf-8')
|
||||
|
||||
flaskApp = Flask(__name__)
|
||||
flaskApp.config['JSON_SORT_KEYS'] = False
|
||||
@flaskApp.route("/")
|
||||
#funzione main: passa al template home il titolo
|
||||
def main():
|
||||
@@ -131,8 +134,16 @@ def api_channels_current():
|
||||
def api_get_files():
|
||||
dataDir='/home/pi/data/'
|
||||
fileList = os.listdir(dataDir)
|
||||
# #all entries in the directory w/ stats
|
||||
# data = (os.path.join(dataDir, fn) for fn in os.listdir(dataDir))
|
||||
# data = ((os.stat(path), path) for path in data)
|
||||
# # regular files, insert creation date
|
||||
# data = ((stat[ST_CTIME], path)
|
||||
# for stat, path in data if S_ISREG(stat[ST_MODE]))
|
||||
|
||||
lista = []
|
||||
idx=0
|
||||
# for item in sorted(data):
|
||||
for item in fileList:
|
||||
t_obj = time.strptime(time.ctime(os.path.getctime(dataDir+item)))
|
||||
# Transforming the time object to a timestamp
|
||||
|
||||
@@ -229,7 +229,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<p class="text-center" id="showData"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user