def main(argv): log.init("listversion") context = ut.mContext() try: user = "" password = "" try: opts, args = getopt.getopt(argv, "u:p:", ["user="******"password="******"-u": user = arg elif opt == "-p": password = arg log.init("listversion") db.init(context) res = listversion(user, password, context) print("%-25s " % ('version')) for row in res: print("%-25s" % (row['VERSION'])) except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main(argv): log.init("setpersonal") context = ut.mContext() try: user = "" password = "" try: opts, args = getopt.getopt(argv, "u:p:", ["user="******"password="******"-u": user = arg elif opt == "-p": password = arg log.init("listpersonal") db.init(context) res = listpersonal(user, password, context) print "%-25s %-16s " % ('date_time', 'mass') for row in res: print("%-25s %-16s" % (row['DATE_TIME'], row['MASS'])) except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main2(argv): try: db.init() log.init("tcx_upload") tcxfile = "Move_2019_10_08_14_24_38_Bieganie.tcx" tcxfile = "Move_2019_10_14_16_17_57_Kolarstwo.tcx" tcxfile = "Move_2019_11_10_12_29_50_Sport+multidyscyplinarny.tcx" tcxfile = "Move_2019_10_14_16_17_57_Kolarstwo.tcx" tcxfile = "Move_2019_11_10_12_29_50_Sport+multidyscyplinarny.tcx" # tcxfile="Move_2019_11_12_15_30_36_Bieganie.tcx" tcxf = open(tcxfile, "r") tcx_string = tcxf.read() tcx_upload(tcx_string, True, "*****@*****.**", "test") tcxf.close() except Exception as e: ut.proc_finally_exc() finally: ut.proc_finally()
def main(argv): log.init("delactivity") context = ut.mContext() try: user = "" password = "" ext_id = "" try: opts, args = getopt.getopt(argv, "i:u:p:", ["id=", "user="******"password="******"-i": ext_id = arg elif opt == "-u": user = arg elif opt == "-p": password = arg log.init("delactivity") db.init(context) delactivity(ext_id, user, password, context) except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main(argv): log.init("delversion") context = ut.mContext() try: user = "" password = "" version = "" try: opts, args = getopt.getopt(argv, "v:u:p:", ["version=", "user="******"password="******"-v": version = arg elif opt == "-u": user = arg elif opt == "-p": password = arg log.init("delversion") db.init(context) delversion(version, user, password, context) except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main(argv): log.init("plan_upload") context = ut.mContext() try: user = "" password = "" override = False planfile = "" version = "" try: opts, args = getopt.getopt(argv, "f:u:p:ov:", [ "planfilename=", "user="******"password="******"override", "version=" ]) except getopt.GetoptError: print 'planupload.py -o -t <planfilename> -v <version> -u <user> -p <password>' sys.exit(2) for opt, arg in opts: if opt == "-f": planfile = arg elif opt == "-u": user = arg elif opt == "-p": password = arg elif opt == "-o": override = True elif opt == "-v": version = arg print "db connecting..." db.init(context) print "db connected..." planf = open(planfile, "r") plan_text = planf.read() plan_upload(plan_text, override, version, user, password, context) planf.close() except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main(argv): result = 0 # print('starting...') log.init("setpersonal") context = ut.mContext() try: user = "" password = "" mass = None date_time = None try: opts, args = getopt.getopt( argv, "d:m:u:p:", ["datetime=", "mass=", "user="******"password="******"<datetime>" -m <mass> -u <user> -p <password>' ) sys.exit(2) for opt, arg in opts: if opt == "-d": date_time = arg elif opt == "-m": mass = arg elif opt == "-u": user = arg elif opt == "-p": password = arg # print('db connecting...') db.init(context) # print('db connected') data = {"mass": mass} setpersonal(date_time, data, user, password, context) except: ut.proc_finally_exc(context) result = -1 finally: ut.proc_finally(context) db.close() return result
def main(argv): log.init("profupload") context=ut.mContext() try: profiles_file="" user="" password="" try: opts, args = getopt.getopt(argv,"i:u:p:",["profilesfile=","user="******"password="******"-i": profiles_file=arg elif opt=="-u": user=arg; elif opt=="-p": password=arg; db.init(context) pf=open(profiles_file,"r") pf_string=pf.read(); profiles_upload(pf_string, user,password, context) pf.close() except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main(argv): log.init("listactivity") context=ut.mContext() try: user="" password="" version="log" try: opts, args = getopt.getopt(argv,"u:p:v:",["user="******"password="******"version="]) except getopt.GetoptError: print 'listactivity.py -version <version> -u <user> -p <password>' sys.exit(2) for opt, arg in opts: if opt=="-u": user=arg elif opt=="-p": password=arg; elif opt=="-v": version=arg; log.init("listactivity") db.init(context) res=listactivity(version,user,password, context) print("%-25s %-16s %-16s %-s " % ('start date_time', 'discipline', 'version', 'id')) for row in res: print("%-25s %-16s %-16s %-s " % (row['START_DATE_TIME'], row['DISCIPLINE_NAME'].strip(), row['VERSION'].strip(), row['EXTERNAL_ID'].strip())) except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main(argv): log.init("addactivity") context = ut.mContext() try: user = "" password = "" date_time = None duration = None rTSS = None hrTSS = None TSS = None sTSS = None version = None discipline = None override = False try: opts, args = getopt.getopt(argv, "u:p:o", [ "datetime=", "discipline=", "duration=", "rTSS=", "hrTSS=", "TSS=", "sTSS=", "user="******"password="******"version=" ]) except getopt.GetoptError: print 'addactivity.py -d "<datetime>" -m <mass> -u <user> -p <password>' sys.exit(2) # --datetime "2019-12-05 10:10:00" --discipline Running --duration 3600 --rTSS=50 --sTSS=30 --hrTSS=80 --TSS=100 --version plan1 -u [email protected] -p test for opt, arg in opts: if opt == "--datetime": date_time = arg elif opt == "--discipline": discipline = arg elif opt == "--duration": duration = arg elif opt == "--rTSS": rTSS = arg elif opt == "--hrTSS": hrTSS = arg elif opt == "--TSS": TSS = arg elif opt == "--sTSS": sTSS = arg elif opt == "--version": version = arg elif opt == "-u": user = arg elif opt == "-p": password = arg elif opt == "-o": override = True db.init(context) addactivity(date_time, discipline, duration, version, override, user, password, context, rTSS, hrTSS, TSS, sTSS) except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()
def main(argv): log.init("tcx_upload") context = ut.mContext() try: tcxfile = "Move_2019_10_08_14_24_38_Bieganie.tcx" tcxfile = "Move_2019_10_14_16_17_57_Kolarstwo.tcx" tcxfile = "Move_2019_11_10_12_29_50_Sport+multidyscyplinarny.tcx" user = "" password = "" override = False tcxfile = None version = "log" try: opts, args = getopt.getopt( argv, "t:u:p:ov:", ["tcxfile=", "user="******"password="******"override", "version="]) except getopt.GetoptError: print 'tcxupload.py -o -t <inputtcxfile> -v <version> -u <user> -p <password>' sys.exit(2) for opt, arg in opts: if opt == "-t": tcxfile = arg elif opt == "-u": user = arg elif opt == "-p": password = arg elif opt == "-o": override = True elif opt == "-v": version = arg tcx_list_path = [] if not tcxfile: cw = os.getcwd() tcx_list = os.listdir(cw + "/" + user + "/to_upload") for i, item in enumerate(tcx_list, 0): tcx_list_path.append(cw + "/" + user + "/to_upload/" + tcx_list[i]) if not tcx_list: context.funlog().logger.info("no files to upload") return 0 else: tcx_list_path = [tcxfile] db.init(context) # print tcx_list_path # tcxfile="Move_2019_10_08_14_24_38_Bieganie.tcx" # tcxfile="Move_2019_10_14_16_17_57_Kolarstwo.tcx" # tcxfile="Move_2019_11_10_12_29_50_Sport+multidyscyplinarny.tcx" # tcxfile="Move_2019_10_14_16_17_57_Kolarstwo.tcx" # tcxfile="Move_2019_11_10_12_29_50_Sport+multidyscyplinarny.tcx" # tcxfile="Move_2019_11_12_15_30_36_Bieganie.tcx" for i, tcxitem in enumerate(tcx_list_path, 0): print "processed: " + tcx_list[i] tcxf = open(tcxitem, "r") tcx_string = tcxf.read() tcx_upload(tcx_string, override, version, user, password, context) tcxf.close() if not tcxfile: src = os.getcwd() + "\\" + user + "\\to_upload\\" + tcx_list[i] dst = os.getcwd() + "\\" + user + "\\uploaded\\" + tcx_list[i] # print src, dst # os.rename(src, dst) except: ut.proc_finally_exc(context) finally: ut.proc_finally(context) db.close()