import sys, os import getposlib as gp import sys, time if len(sys.argv) > 1 : cmd = sys.argv[1] else : cmd = "positions" vlmfirstid = 1600 vlmidrace = 20121125 vlmusernameprefix = "ARC2012_" basefilename = "ts%d" % vlmidrace vlmtmp = gp.vlm_get_tmp() ybtree = gp.YellowBrickTree("http://yb.tl/Flash/arc2012/TeamSetup/", basefilename) boats = ybtree.boats() if cmd == "insert" : for rid in boats: b = boats[rid] vlmid = vlmfirstid + int(b['marker']) vlmusername = "******" % (vlmusernameprefix, int(b['marker'])) vlmboatname = "%03d - %s" % (int(b['marker']), b['name'].encode('utf8')) color = b['trackC'].lower() print("INSERT INTO `users` SET idusers = %d, username = '******', boatname = '%s', engaged = %d, color = '%s';" % (-vlmid, vlmusername, vlmboatname, vlmidrace, color)) else :
#import xml.etree.ElementTree as ElementTree import json #import requests import getposlib as gp import sys, time #Generate with basedatas def baseboat(rid): vlmboatidfirst = 3000 return {'vlmid' : -vlmboatidfirst-int(rid)} vlmidrace = 20161106 vlmusernameprefix = "JV - " basefilename = "JV%d" % vlmidrace vlmtmp = gp.vlm_get_tmp() #recup du fichier de config configUrl = "http://www.dolink.fr/dolink/trace/7038027" configFile = os.path.join(vlmtmp,"config") gp.geturl(configUrl,configFile,) with open(configFile+".static.tmp.xml") as data_file: livedata = json.load(data_file) #gp.unzipurl(raceBaseUrl+"reports/"+reportfile,basefilename+"_rep") #with open(os.path.join(vlmtmp,basefilename+"_rep.static.tmp.xml")) as data_file: # reportdata = json.load(data_file)
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib import sys, zipfile, os import time import xml.etree.ElementTree as ElementTree import getposlib vlmidrace = 20121110 basefilename = "vdg%d" % vlmidrace vlmtmp = getposlib.vlm_get_tmp() updatexml = os.path.join(vlmtmp, basefilename + ".update.xml") now = int(time.time()) urllib.urlretrieve( "http://tracking2012.vendeeglobe.org/data/class2.xml?%d" % now, updatexml) tree = ElementTree.parse(updatexml) vlmids = { 'benedetto': 1516, 'thomson': 1517, 'lecleach': 1518, 'boissieres': 1519, 'stamm': 1520, 'debroc': 1521, 'wavre': 1522, 'gabart': 1523, 'sanso': 1524, 'lecam': 1525, 'dick': 1526,