first tsv commit
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ from pymongo import MongoClient
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
load_dotenv("./creds.env")
|
||||
load_dotenv("../db/creds.env")
|
||||
|
||||
mUser = os.getenv()
|
||||
mPass = os.getenv()
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import csv, os
|
||||
import app_obd, app_car, app_account, app_gps
|
||||
from datetime import datetime
|
||||
|
||||
currentday = datetime.today().strftime("%d%m%Y")
|
||||
currenttime = datetime.now().strftime("%H_%M_%S")
|
||||
account = app_account.Account
|
||||
car = app_car.Car
|
||||
sCarModel = ''.join(letter for letter in car.model if letter.isalnum())
|
||||
tsv_name = account.name + "_" + sCarModel + "_" + currentday + "_" + currenttime + ".tsv"
|
||||
tsv_path = "../db/tsv/" + tsv_name
|
||||
|
||||
def tsv_writer(bExist):
|
||||
with open(tsv_path, 'w') as o_file:
|
||||
## VN, NAME, DATE, TIME, GPS_X, GPS_Y, SPEED, ODOMETER
|
||||
writer = csv.writer(o_file, delimiter='\t')
|
||||
if bExist == False:
|
||||
writer.writerow(["VN", "NAME", "DATE", "TIME", "GX", "GY", "SPEED", "ODO"])
|
||||
else:
|
||||
writer.writerow([car.model, account.name, currentday, currenttime])
|
||||
|
||||
if os.path.exists(tsv_path):
|
||||
tsv_writer(True)
|
||||
else:
|
||||
tsv_writer(False)
|
||||
@@ -1,7 +0,0 @@
|
||||
##
|
||||
## MangoDB server connection details
|
||||
##
|
||||
|
||||
mangosrv_user = ""
|
||||
mangosrv_pass = ""
|
||||
mangosrv_db = ""
|
||||
@@ -1,4 +1,4 @@
|
||||
## TSV File to MangoDB
|
||||
## VN_20240401_00_00_00.TSV
|
||||
## ACCOUNT_VN_20240401_00_00_00.TSV
|
||||
##
|
||||
## VN NAME, DATE, TIME, GPS_X, GPS_Y, SPEED, ODOMETER
|
||||
|
Reference in New Issue
Block a user