コード例 #1
0
ファイル: Script.py プロジェクト: emperorcezar/gandalf
 def getCurrentSegment(self):
     """
     Returns the segment that should currently be playing.
     """
     switch = 0
     
     (day, time) = gtime.getCurSecs()
     print "Current: "+str(gtime.getCurSecs()[0])
     curseg = 0
     for i in self._times:
         
         print "Segment time: "+str(i)
         print "Actual time: "+str(time)
         print "Actual day: "+str(day)
         if i[0] == day:
             if i[1] < time:
                 print "Segment skipped"
                 switch = 1
                 curseg = self._times.index(i)
             else:
                 
                 if switch == 1:
                      print "Found segment: "+str(curseg)
                      self._cursegment = curseg
                 
                      break
         else:
             if switch == 1:
                      print "Found segment: "+str(curseg)
                      self._cursegment = curseg
                 
                      break
             print "Day doesn't match"
     
     return self.getSegment(time=self._times[curseg])
コード例 #2
0
ファイル: Script.py プロジェクト: emperorcezar/gandalf
 def getCurrentSegment(self):
     """
     Returns the segment that should currently be playing.
     """
     
     (day, time) = gtime.getCurSecs()
     
     curseg = 0
     for i in self._times:
         if i[1] < time and i[0] == day:
             curseg = i
             
     return getSegment(time=curseg)