示例#1
0
	def onCurrentDateChange(self, gdate):
		print("praytimes: onCurrentDateChange", gdate)
		if not self.enable:
			return
		jd = gregorian_to_jd(*tuple(gdate))
		#print(
		#	getUtcOffsetByJd(jd, localTz) / 3600,
		#	getUtcOffsetCurrent() / 3600,
		#)
		#utcOffset = getUtcOffsetCurrent()
		utcOffset = getUtcOffsetByJd(jd, localTz)
		tmUtc = now()
		epochLocal = tmUtc + utcOffset
		secondsFromMidnight = epochLocal % (24 * 3600)
		midnightUtc = tmUtc - secondsFromMidnight
		#print("------- hours from midnight", secondsFromMidnight/3600.0)
		for timeName, azanHour in self.backend.getTimesByJd(
			jd,
			utcOffset / 3600,
		).items():
			if timeName not in self.azanTimeNamesAll:
				continue
			if timeName not in self.shownTimeNames:
				continue
			azanSec = azanHour * 3600.0
			#####
			toAzanSecs = int(azanSec - secondsFromMidnight)
			if toAzanSecs >= 0:
				preAzanSec = azanSec - self.preAzanMinutes * 60
				toPreAzanSec = max(
					0,
					int(preAzanSec - secondsFromMidnight)
				)
				print("toPreAzanSec=%.1f" % toPreAzanSec)
				Timer(
					toPreAzanSec,
					self.doPlayPreAzan,
					#midnightUtc + preAzanSec,
				).start()
				###
				print("toAzanSecs=%.1f" % toAzanSecs)
				Timer(
					toAzanSecs,
					self.doPlayAzan,
					#midnightUtc + azanSec,
				).start()
示例#2
0
 def onCurrentDateChange(self, gdate):
     print("praytimes: onCurrentDateChange", gdate)
     if not self.enable:
         return
     jd = gregorian_to_jd(*tuple(gdate))
     #print(
     #	getUtcOffsetByJd(jd, localTz) / 3600,
     #	getUtcOffsetCurrent() / 3600,
     #)
     #utcOffset = getUtcOffsetCurrent()
     utcOffset = getUtcOffsetByJd(jd, localTz)
     tmUtc = now()
     epochLocal = tmUtc + utcOffset
     secondsFromMidnight = epochLocal % (24 * 3600)
     midnightUtc = tmUtc - secondsFromMidnight
     #print("------- hours from midnight", secondsFromMidnight/3600.0)
     for timeName, azanHour in self.backend.getTimesByJd(
             jd,
             utcOffset / 3600,
     ).items():
         if timeName not in self.azanTimeNamesAll:
             continue
         if timeName not in self.shownTimeNames:
             continue
         azanSec = azanHour * 3600.0
         #####
         toAzanSecs = int(azanSec - secondsFromMidnight)
         if toAzanSecs >= 0:
             preAzanSec = azanSec - self.preAzanMinutes * 60
             toPreAzanSec = max(0, int(preAzanSec - secondsFromMidnight))
             print("toPreAzanSec=%.1f" % toPreAzanSec)
             Timer(
                 toPreAzanSec,
                 self.doPlayPreAzan,
                 #midnightUtc + preAzanSec,
             ).start()
             ###
             print("toAzanSecs=%.1f" % toAzanSecs)
             Timer(
                 toAzanSecs,
                 self.doPlayAzan,
                 #midnightUtc + azanSec,
             ).start()
示例#3
0
 def get_text(self, year, month,
              day):  ## just for compatibity (usage by external programs)
     return self.get_text_jd(gregorian_to_jd(year, month, day))
示例#4
0
	def get_text(self, year, month, day):## just for compatibity (usage by external programs)
		return self.get_text_jd(gregorian_to_jd(year, month, day))