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

View File

@ -29,6 +29,7 @@ def main():
if type_names[0] == "IN_MOVED_TO":
if filename.endswith(ext):
processFIT(filename)
deleteFiles(filename)
pass
@ -126,10 +127,13 @@ def writeDB():
print("The SQLite connection is closed")
#row.extend(["Date", "Total Distance", "Total Ascent", "Max Alt.", "AVG Speed", "AVG HR", "Calories"])
#row.extend([fitData["date"], fitData["total_distance"], fitData["total_ascent"], fitData["max_altitude"], fitData["avg_speed"],
# fitData["avg_heart_rate"], fitData["total_calories"] ])
def deleteFiles(filename):
try:
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__':