def __init__(self, url, contact): super().__init__(url) self.updater_thread = None # this will contain the auto fetching thread self.working_dir = BASE_WORKING_DIR + r"/Whatsapp/" self.contact = contact self.auto_update = False self.lock = Lock() # init notification sound player dir_path = os.path.dirname(os.path.realpath(__file__)) self.sp = SoundPlayer(dir_path + NOTIFICATION_SOUND) Env.createFolder(self.working_dir)
def OpenAudio(self, path): if self.sound is not None: del self.sound self.sound = None # self.soundPath = str(path.encode("utf-8")) self.soundPath = path # .encode('latin-1', 'replace') self.sound = SoundPlayer.SoundPlayer(self.soundPath, self.parent) if self.sound.IsValid(): print("valid sound") self.soundDuration = int(self.sound.Duration() * self.fps) print(("self.sound.Duration(): %d" % int(self.sound.Duration()))) print(("frameRate: %d" % int(self.fps))) print(("soundDuration1: %d" % self.soundDuration)) if self.soundDuration < self.sound.Duration() * self.fps: self.soundDuration += 1 print(("soundDuration2: %d" % self.soundDuration)) else: self.sound = None
def __init__(self): self.soundPlayer = SoundPlayer.SoundPlayer()