Exemple #1
0
 def getGamesOfThisWeek(self):        
     api = WebApi()
     ret=api.getGamesOfWeek(self._weekBegin, self._weekEnd)
     data = json.loads(ret)['data']
     data = json.loads(data)
     for i in range(len(data)):
         #print data[i]['round'] + " " + data[i]['tournamentId']
         self.storeData(data[i]['tournamentId'], data[i]['round'])
     print self._thisRound;
Exemple #2
0
 def __init__(self):
     self._tmp = 'tmp.html'
     self._date = ''
     self._time = ''
     self._webApi = WebApi()
Exemple #3
0
            #print data[i]['round'] + " " + data[i]['tournamentId']
            self.storeData(data[i]['tournamentId'], data[i]['round'])
        print self._thisRound;
    

    def updateGames(self):
        sina = GamesFromSina()        
            
        self.getGamesOfThisWeek()    
        
        # After query, self._thisRound's value would like this:    
        # {17: [17], 18: [16], 19: [18], 20: [16, 17], 21: [16]}
        keys = self._thisRound.keys()
        for i in range(len(keys)):
            tourId = keys[i]
            rounds = self._thisRound[keys[i]]
            for j in range(len(rounds)):
                leagueId = self._tourId2UrlId.get(tourId)
                if None != leagueId:
                    print leagueId, rounds[j]
                    sina.getRoundGames(leagueId, rounds[j])
                    sina.uploadRoundGames()
        
    
if __name__ == "__main__":
        updater = UpdateSoccerGameTime()
        updater.updateGames()
        
        webApi = WebApi()
        webApi.updateParam('updateGameTime', '')
                
Exemple #4
0
import sys
import re

from WebApi import WebApi

date = None
time = None
guestTeam = None
hostTeam = None

matches = 0

webHandler = WebApi()


def getPage(file):
    file = open(file)
    if not file:
        print "open %s error" % file
        sys.exit()
    line = file.readline()
    while line:
        checkDate(line)  # TODO if is date, then jump next 2
        checkTime(line)
        checkTeam(line)

        line = file.readline()
    file.close()
    global matches
    print matches + 1