def save(json): print("pressed2") global now_time global now_date global noten for notje in noten: print(noten[notje]["noteduration"]) if len(noten) > 0: new_now_time = time.time() now_date = datetime.datetime.now() now_date = now_date.strftime("%Y-%m-%d %H:%M:%S") print(json) sesId = DataRepository.add_new_playsession(json['trackName'], duration, now_date, scale_number, interval, noten) noten = {}
def knop2(btn2): print("pressed2") global now_time global now_date global noten for notje in noten: print(noten[notje]["noteduration"]) if len(noten) > 0: new_now_time = time.time() sesId = DataRepository.add_new_playsession( new_now_time - now_time, now, 1, f'00:00:0{round(interval)}', noten) noten = {} now_date = datetime.datetime.now() now_date = now_date.strftime("%Y-%m-%d %H:%M:%S") now_time = time.time()