DB config

This commit is contained in:
Manuel Weiser 2024-05-11 10:50:53 +02:00
parent 368b556a51
commit fd583cbc5b
2 changed files with 54 additions and 48 deletions

View File

@ -46,6 +46,7 @@ def updateLast(db, cursor):
cursor.execute(sql) cursor.execute(sql)
row = cursor.fetchone() row = cursor.fetchone()
if row[0]:
ins_id = row[0] ins_id = row[0]
## hole alle Fahrten nach letzter Ladung ## hole alle Fahrten nach letzter Ladung
@ -62,6 +63,7 @@ def updateLast(db, cursor):
print("Anzahl:", len(rows)) print("Anzahl:", len(rows))
if len(rows) < 1: if len(rows) < 1:
print("Keine neuen Daten vorhanden, beende jetzt.")
cursor.close() cursor.close()
if db: if db:
db.close() db.close()

View File

@ -29,6 +29,7 @@ def main():
if type_names[0] == "IN_MOVED_TO": if type_names[0] == "IN_MOVED_TO":
if filename.endswith(ext): if filename.endswith(ext):
processFIT(filename) processFIT(filename)
deleteFiles(filename)
pass pass
@ -126,10 +127,13 @@ def writeDB():
print("The SQLite connection is closed") print("The SQLite connection is closed")
#row.extend(["Date", "Total Distance", "Total Ascent", "Max Alt.", "AVG Speed", "AVG HR", "Calories"]) def deleteFiles(filename):
#row.extend([fitData["date"], fitData["total_distance"], fitData["total_ascent"], fitData["max_altitude"], fitData["avg_speed"], try:
# fitData["avg_heart_rate"], fitData["total_calories"] ]) file = filename.remove(ext)
os.unlink(path+file+".*")
print("lösche", file)
except Exception as e:
print('Failed to delete %s. Reason: %s' % (path+filename, e))
if __name__ == '__main__': if __name__ == '__main__':