Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for client in Results_Database['client']:
- for car in Results_Database['client'][client]:
- for year in Results_Database['client'][client][car]['year']:
- if str(year) == str(current_year):
- print("same year, look for month")
- for month in Results_Database['client'][client][car]['year'][year]['month']:
- if str(month) == str(current_month):
- print("same month, look for day")
- for day in Results_Database['client'][client][car]['year'][year]['month'][month]['day']:
- if str(day) == str(current_day):
- print("same day, look for hour")
- for hour in Results_Database['client'][client][car]['year'][year]['month'][month]['day']['hour'][hour]:
- print(f"Let's add a new hour for {day} {month} {year}")
- Results_Database['client'][client][car]['year'][year]['month'][month]['day'].update({"hour": current_hour})
- else: #different day
- print("add a new day entry")
- print(Results_Database['client'][client][car]['year'][year]['month'][month]['day'])
- Results_Database['client'][client][car]['year'][year]['month'][month]['day'].update({str(current_day): {'hour': {str(current_hour): {'Engine_ON': 0, 'Car_at_base': 0, 'Car_speed': 0, 'PING_respose': 0, 'CPU_usage': 0, 'CPU_temp': 0, 'All_Errors': 0, 'Video0_Errors': 0, 'Camera_connected': 0, 'USB_Drive_connected': 0, 'Disk_full': 0, 'Files_list': 0, 'Uploading_gap': 0, 'Latest_video_tdelta': 0, 'Python_processes': 0}}}})
- #{str(current_day) : {}})#'hour':{'02':{'Engine_ON':0,'Car_at_base':0,'Car_speed':0,'PING_respose':0,'CPU_usage':0,'CPU_temp':0,'All_Errors':0,'Video0_Errors':0,'Camera_connected':0,'USB_Drive_connected':0,'Disk_full':0,'Files_list':0,'Uploading_gap':0,'Latest_video_tdelta':0,'Python_processes':0}}}})
- else: # different month
- print("add a new month entry")
- #Results_Database['client'][client][car]['year'][year]['month'] = current_month
- else: # different year
- print("add a new year entry")
- #Results_Database['client'][client][car]['year'] = current_year
- print("------------------------")
- print(Results_Database)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement