def SFX(n,e='.wav'): if len(n)==0: return snd=art(n,e) try: xbmc.playSFX(snd,False) except: try: xbmc.playSFX(snd) except: pass
def openattach(self, pos): if self.filebel == "Text": if not self.showing: self.showing = True self.showtext(pos) else: self.resetemail() self.curpos = self.getControl(81).getSelectedPosition() self.showattach(self.getControl(81).getSelectedPosition()) elif self.filebel == "Audio": xbmc.playSFX(TEMPFOLDER + self.attachments[pos][0]) elif self.filebel == "Video": xbmc.Player().play(TEMPFOLDER + self.attachments[pos][0]) elif self.filebel == "Image": if not self.showing: self.showing = True self.showimage(pos) else: self.resetemail() self.curpos = self.getControl(81).getSelectedPosition() self.showattach(self.getControl(81).getSelectedPosition()) elif self.filebel == "Archive": if not self.showing: self.showing = True self.showzip(pos) else: self.resetemail() self.curpos = self.getControl(81).getSelectedPosition() self.showattach(self.getControl(81).getSelectedPosition())
def run(self): try: play_sfx = False # NB: xbmc.abortRequested not work correctly with threading.Thread while not xbmc.abortRequested: try: self.getWindow() if self.sprite != self.addon.getSetting("sprite"): self.getMedias() if not xbmc.getCondVisibility( 'Window.IsActive(Pointer.xml)'): time.sleep(.3) continue pos = xbmcgui.getMousePosition() if ((pos[0] - self.offsetx) == self.current_pos[0]) and ( pos[1] == self.current_pos[1]): self.control.setImage(self.sprites["wait"]) if play_sfx: if self.sprites["sfx"] and self.addon.getSetting( "playsfx") == "true": xbmc.playSFX(self.sprites["sfx"]) play_sfx = False else: play_sfx = True if pos[0] < self.current_pos[0]: self.control.setImage(self.sprites["left"]) else: self.control.setImage(self.sprites["right"]) #start = "%i,%i" % self.current_pos #end = "%i,%i" % ( pos[ 0 ]-self.offsetx, pos[ 1 ] ) ##self.speed = str( self.current_pos[ 0 ] - pos[ 0 ] ).strip( "-" ) #self.control.setAnimations( [ ( 'conditional', 'condition=true effect=slide start=%s end=%s time=%s' % ( start, end, self.speed ) ) ] ) self.setAnimation(pos) self.current_pos = (pos[0] - self.offsetx, pos[1]) #self.control.setPosition( *self.current_pos ) if xbmc.getCondVisibility( "Window.IsActive(addonsettings)"): self.reload_addon = True elif self.reload_addon: self.addon = Addon("script.mouse.tracker.service") self.speed = self.addon.getSetting("speed").split( ".")[0] self.reload_addon = False except SystemExit: break except: print_exc() time.sleep(float(int(self.speed)) * 0.001) except SystemExit: pass except: print_exc()
def PlaySndWav(f, e='.wav'): try: if (tfalse(getSet("use-sfx")) == True) and (xbmc.Player().isPlaying() == False): if f.endswith(e) == False: f += e xbmc.playSFX(tP(os.path.join(MediaPath, 'snd', f)), useCached=True) except: pass
def play_sound(toplay, ltheme=""): if toplay != "": if ltheme != "": playpath = THEME_DIR + ltheme + "\\sounds\\" + toplay + ".wav" if not os.path.exists(playpath): playpath = SRC_DIR + "sounds\\" + toplay + ".wav" else: playpath = SRC_DIR + "sounds\\" + toplay + ".wav" if os.path.exists(playpath): xbmc.playSFX(playpath)
def run(self): try: play_sfx = False # NB: xbmc.abortRequested not work correctly with threading.Thread while not xbmc.abortRequested: try: self.getWindow() if self.sprite != self.addon.getSetting("sprite"): self.getMedias() if not xbmc.getCondVisibility("Window.IsActive(Pointer.xml)"): time.sleep(0.3) continue pos = xbmcgui.getMousePosition() if ((pos[0] - self.offsetx) == self.current_pos[0]) and (pos[1] == self.current_pos[1]): self.control.setImage(self.sprites["wait"]) if play_sfx: if self.sprites["sfx"] and self.addon.getSetting("playsfx") == "true": xbmc.playSFX(self.sprites["sfx"]) play_sfx = False else: play_sfx = True if pos[0] < self.current_pos[0]: self.control.setImage(self.sprites["left"]) else: self.control.setImage(self.sprites["right"]) # start = "%i,%i" % self.current_pos # end = "%i,%i" % ( pos[ 0 ]-self.offsetx, pos[ 1 ] ) ##self.speed = str( self.current_pos[ 0 ] - pos[ 0 ] ).strip( "-" ) # self.control.setAnimations( [ ( 'conditional', 'condition=true effect=slide start=%s end=%s time=%s' % ( start, end, self.speed ) ) ] ) self.setAnimation(pos) self.current_pos = (pos[0] - self.offsetx, pos[1]) # self.control.setPosition( *self.current_pos ) if xbmc.getCondVisibility("Window.IsActive(addonsettings)"): self.reload_addon = True elif self.reload_addon: self.addon = Addon("script.mouse.tracker.service") self.speed = self.addon.getSetting("speed").split(".")[0] self.reload_addon = False except SystemExit: break except: print_exc() time.sleep(float(int(self.speed)) * 0.001) except SystemExit: pass except: print_exc()
def Bet_plus(self): if not self.is_started: if not self.cash == 0: if not self.bet >= self.max_bet: self.bet = self.bet + 1 xbmc.playSFX(coin) self.info_Bet.setLabel("Mi$e\n"+str(self.bet)) self.cash = self.cash - 1 self.info_cash.setLabel("Ca$h\n"+str(self.cash)) if self.bet == self.max_bet: self.max_is_betted = True self.btn_betmax.setLabel("Max.\nbetted")
def SFX(wav): if ADDON.getSetting("playsfx") == "false": return wav = os.path.join(ADDON_DIR, "resources", "sounds", wav) # played = 0 # if winsound and xbmc.getCondVisibility( "Player.Playing" ): # try: # winsound.PlaySound( wav, winsound.SND_ASYNC ) # played = 1 # except: # pass # if not played: xbmc.playSFX(wav, False)
def Stopped_diplay(self): if self.is_started: if self.display == 3: self.display = 0 self.is_started = False self.max_is_betted = False self.check_score(self.display1, self.display2, self.display3) if not self.winner_pot: if xbmc.Player().isPlaying(): try: xbmc.Player().stop() except: pass xbmc.playSFX(os.path.join(skin_cache, "stop.wav")) self.winner_pot = False
def playSound(name,return_duration=False): wavPath = os.path.join(xbmc.translatePath('special://home'),'addons','service.xbmc.tts','resources','wavs','{0}.wav'.format(name)) #wavPath = os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8'),'resources','wavs','{0}.wav'.format(name)) xbmc.playSFX(wavPath) if return_duration: wavPath = wavPath.decode('utf-8') if not os.path.exists(wavPath): return 0 import wave w = wave.open(wavPath,'rb') frames = w.getnframes() rate = w.getframerate() w.close() duration = frames / float(rate) return duration
def playSound(name,return_duration=False): wavPath = os.path.join(addonPath(), 'resources','wavs','{0}.wav'.format(name)) # This doesn't work as this may be called when the addon is disabled # wavPath = os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8'),'resources','wavs','{0}.wav'.format(name)) xbmc.playSFX(wavPath) if return_duration: wavPath = wavPath.decode('utf-8') if not os.path.exists(wavPath): return 0 import wave w = wave.open(wavPath,'rb') frames = w.getnframes() rate = w.getframerate() w.close() duration = frames / float(rate) return duration
def togglePause(self): xbmcgui.lock() self.removeBlocks(self.imgBlocks + self.imgPiece + self.imgNextPiece + self.imgGhostPiece) xbmcgui.unlock() self.state = STATE_PAUSED xbmc.playSFX(SOUND_DIR+"pause.wav") name,score = self.dlgGame.dlgHighScores.getHighestScore() self.dlgPause.lblHighScore.setLabel(score) self.dlgPause.lblHighScoreName.setLabel(name) self.dlgPause.doModal() #leaves gui locked xbmc.playSFX(SOUND_DIR+"unpause.wav") self.state = STATE_READY for img in (self.imgBlocks + self.imgPiece + self.imgNextPiece + self.imgGhostPiece): self.addControl(img) xbmcgui.unlock()
def playSound(name, return_duration=False): wavPath = os.path.join(xbmc.translatePath('special://home'), 'addons', 'service.xbmc.tts', 'resources', 'wavs', '{0}.wav'.format(name)) #wavPath = os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8'),'resources','wavs','{0}.wav'.format(name)) xbmc.playSFX(wavPath) if return_duration: wavPath = wavPath.decode('utf-8') if not os.path.exists(wavPath): return 0 import wave w = wave.open(wavPath, 'rb') frames = w.getnframes() rate = w.getframerate() w.close() duration = frames / float(rate) return duration
def playSound(name, return_duration=False): wavPath = os.path.join(addonPath(), 'resources', 'wavs', '{0}.wav'.format(name)) # This doesn't work as this may be called when the addon is disabled # wavPath = os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8'),'resources','wavs','{0}.wav'.format(name)) xbmc.playSFX(wavPath) if return_duration: wavPath = wavPath.decode('utf-8') if not os.path.exists(wavPath): return 0 import wave w = wave.open(wavPath, 'rb') frames = w.getnframes() rate = w.getframerate() w.close() duration = frames / float(rate) return duration
def TakeScreenShot(self): try: if xbmc.Player().isPlaying(): try: xbmc.Player().stop() except: pass #time.sleep(1) directory = os.path.join(CWD, "screenshot_win") if not os.path.exists(directory): os.makedirs(directory) now = time.localtime(time.time()) year, month, day, hour, minute, second, weekday, yearday, daylight = now dated = "%02d%02d%02d_%02d%02d%02d" % (year, month, day, hour, minute, second) name = os.path.join(directory, dated) screen = {"x":int(self.getWidth()), "y":int(self.getHeight())} command = "TakeScreenShot(%s.jpg,0,false,%s,-1,%s)" % (name, screen["x"], screen["y"]) xbmc.playSFX(os.path.join(skin_cache, "screenshot.wav")) xbmc.executehttpapi(command) except: pass
def togglePause(self): xbmcgui.lock() self.removeBlocks(self.imgBlocks + self.imgPiece + self.imgNextPiece + self.imgGhostPiece) xbmcgui.unlock() self.state = STATE_PAUSED xbmc.playSFX(SOUND_DIR + "pause.wav") name, score = self.dlgGame.dlgHighScores.getHighestScore() self.dlgPause.lblHighScore.setLabel(score) self.dlgPause.lblHighScoreName.setLabel(name) self.dlgPause.doModal() #leaves gui locked xbmc.playSFX(SOUND_DIR + "unpause.wav") self.state = STATE_READY for img in (self.imgBlocks + self.imgPiece + self.imgNextPiece + self.imgGhostPiece): self.addControl(img) xbmcgui.unlock()
def NextPlayer(self): self.actualTry = 0 self.actualPlayer = self.actualPlayer + 1 #reset hold for i in range(5): self.hold[i] = False if (self.actualPlayer > self.player): self.actualPlayer = 1 self.round = self.round + 1 if (self.round == 14): self.gameOn = False # game over if (self.soundOn): xbmc.playSFX(MEDIA_PATH + '\\applaus.wav') self.updateToggleButtons(0)
def onInit(self): self.colors = themecontrol.ThemeColors() self.sounds = themecontrol.ThemeSounds() # This is where we use style variable to decide which sound clip to use later. notifyAudio = self.sounds.notifyinfo if style == 'INFO': notifyAudio = self.sounds.notifyinfo elif style == 'WARNING': notifyAudio = self.sounds.notifywarning elif style == 'ERROR': notifyAudio = self.sounds.notifyerror ''' Save the IDs used for the title and textbox controls in the XML We do the ID instead of the getControl() reference so we can use the IDs for more than just getControl(). Such as when checking onClick() since it passes the ID only and not the object reference. ''' self.title = 401 self.msg = 402 # Get the control reference for the Title/Header Label and set it's text/label self.getControl(self.title).setLabel(title) # Here we set the property for the header color so that the control can use it # in the XML self.setProperty('dhtext', self.colors.dh_color) # Get the control reference for the Label used for the message. I used a label # for this control because it would allow for a nicer scroll. self.getControl(self.msg).setLabel(msg) # Here we set the property for the message color so that the control can use it # in the XML self.setProperty('dttext', self.colors.dt_color) # This will play the sound, without the Player controls popping up, in the background xbmc.playSFX(notifyAudio) # slight sleep cuz we can xbmc.sleep(100) # this puts the focus on the top item of the container self.setFocusId(self.getCurrentContainerId()) # Kill any busy dialog if it popped up xbmc.executebuiltin("Dialog.Close(busydialog)") # sleep for the duration of the timer that passed xbmc.sleep(timer) # Auto close the dialog once time elapses self.close()
def playSFX(self, action): utils.log("playSFX") if action in [ 'ACTION_CLICK' ] + utils.ACTION_SELECT_ITEM + utils.ACTION_MOVE_DOWN + utils.ACTION_MOVE_UP + utils.ACTION_MOVE_LEFT + utils.ACTION_MOVE_RIGHT: xbmc.playSFX(utils.SELECT_SFX) elif action in utils.ACTION_CONTEXT_MENU + utils.ACTION_PAGEDOWN + utils.ACTION_PAGEUP: xbmc.playSFX(utils.CONTEXT_SFX) elif action in utils.ACTION_PREVIOUS_MENU: xbmc.playSFX(utils.BACK_SFX) elif action in ['ACTION_ALERT']: xbmc.playSFX(utils.ALERT_SFX)
def popup(self, newlist, inbox, ibsettings,ibfolder): if exists("X:\\mmcomu.xib"): if self.accountsettings.getSetting("Mini Mode SFX",None) == None or self.accountsettings.getSetting("Mini Mode SFX",None) == "True": xbmc.playSFX(str(ibsettings.getSetting("Email Notification"))) mymessage = self.language(210) + inbox + "\n" + self.language(219) % str(len(newlist)) w = Popup("XinBox_Popup.xml",self.srcpath,"DefaultSkin",0,message=mymessage, lang=self.language) w.doModal() self.returnval = w.returnval del w if self.returnval == 1: for item in newlist: self.emailist.insert(0,ibfolder + item[0] + ".sss") w = XinBox_MMPopup.GUI("XinBox_MMPopup.xml",self.srcpath,"DefaultSkin",0,emailist=self.emailist,lang=self.language,ibox=inbox) w.doModal() self.returnval = w.returnval del w self.emailist = [] if self.returnval == 1: self.inbox = inbox self.exit = True
def playSFX(self, action): utils.log("playSFX") # if REAL_SETTINGS.getSetting("SFX_Enabled") != "true": # return if action in [ 'ACTION_CLICK' ] + utils.ACTION_SELECT_ITEM + utils.ACTION_MOVE_DOWN + utils.ACTION_MOVE_UP + utils.ACTION_MOVE_LEFT + utils.ACTION_MOVE_RIGHT: xbmc.playSFX(utils.SELECT_SFX) elif action in utils.ACTION_CONTEXT_MENU + utils.ACTION_PAGEDOWN + utils.ACTION_PAGEUP: xbmc.playSFX(utils.CONTEXT_SFX) elif action in utils.ACTION_PREVIOUS_MENU: xbmc.playSFX(utils.BACK_SFX) elif action in ['ACTION_ALERT']: xbmc.playSFX(utils.ALERT_SFX)
def onQuestionAnswered(self, answer): """ @param answer: the chosen answer by the user @type answer: Answer """ xbmc.log("onQuestionAnswered(..)") if self.questionPointsThread is not None: self.questionPointsThread.cancel() if answer is not None and answer.correct: xbmc.playSFX(AUDIO_CORRECT) self.gameInstance.correctAnswer(self.questionPoints / 10.0) self.getControl(self.C_MAIN_CORRECT_VISIBILITY).setVisible(False) else: xbmc.playSFX(AUDIO_WRONG) self.gameInstance.wrongAnswer() self.getControl(self.C_MAIN_INCORRECT_VISIBILITY).setVisible(False) if self.player.isPlaying(): self.player.stop() threading.Timer(0.5, self.onQuestionAnswerFeedbackTimer).start() if ADDON.getSetting('show.correct.answer') == 'true' and not answer.correct: for idx, answer in enumerate(self.question.getAnswers()): if answer.correct: self.getControl(self.C_MAIN_FIRST_ANSWER + idx).setLabel('[B]%s[/B]' % answer.text) self.setFocusId(self.C_MAIN_FIRST_ANSWER + idx) self.onThumbChanged(self.C_MAIN_FIRST_ANSWER + idx) else: self.getControl(self.C_MAIN_FIRST_ANSWER + idx).setLabel(textColor='0x88888888') if isinstance(self.question.getDisplayType(), question.QuoteDisplayType): # Display non-obfuscated quote text self.getControl(self.C_MAIN_QUOTE_LABEL).setText(self.question.getDisplayType().getQuoteText()) xbmc.sleep(3000) self.onNewQuestion()
def Get_value(self, letter): info_mess = "" if letter in self.letters: xbmcgui.Dialog().ok(__script__+__version__,label[73]+" %s " % letter+label[74]+"\n"+label[75]) return else: self.letters.append(letter) self.letters.sort() if self.is_dead: self.toGain = self.toGain - 1 if xbmcgui.Dialog().yesno(__script__+__version__,label[76]+"\n"+label[77]+"\n"+label[78]): self.Clear_entry() return else: self.Remove_skin_cache() if not letter in str(self.word.s): # self.word.s = mot caché self.error = self.error+1 if self.error == 6: info_mess = dead_message() self.Set_scrore() self.hidden_letter.setLabel(str(self.word.s)) self.setFocus(self.btn_new) else: info_mess = error_message() self.set_hangman(self.error) else: if not self.is_dead: #if not self.error > 6: if self.word.guess(letter): info_mess = good_message() self.hidden_letter.setLabel(str(self.word)) if self.word.is_completed(): if not self.is_dead: #if not self.error > 6: self.Set_scrore() self.toGain = self.toGain + 1 info_mess = winner() self.setFocus(self.btn_new) xbmcgui.Dialog().ok(__script__+__version__,label[79]+"\n"+label[80]+" %s " % str(len(self.letters))+label[81]+"\n"+label[82]+" "+str(self.score)) self.Line_mess.setLabel(info_mess) if self.error == 5: xbmc.playSFX(heart)
def processEvent(self,event,rows): xbmcgui.lock() LOG('ProcessEvent-> ' + str(event)+ ' ' + str(rows)) self.updatePiece() entryEvent = event clearLev = bloomX = bloomY = 0 if event == EVENT_NEW_PIECE or event == EVENT_LEVEL_UP: if rows>0 or True: clearLev = self.controller.nLevel - (event == EVENT_LEVEL_UP) bloomX = self.controller.curPiece.x+self.controller.curPiece.type.size/2 -1 bloomY = self.controller.curPiece.y self.imgBlocks.extend(self.imgPiece) self.imgPiece = [] event = self.controller.doNewPiece() self.updatePiece() if event == EVENT_GAME_OVER: #sound priority self.state = STATE_PAUSED xbmc.playSFX(SOUND_DIR+"gameover.wav") xbmcgui.unlock() doNewGame = self.dlgGame.showDialog(self.controller.nScore) #it unlocks and locks gui xbmcgui.lock() if doNewGame: self.state = STATE_READY self.controller.newGame() self.updateBlocks() self.updatePiece() else: self.state = STATE_QUITTING self.close() LOG('PE after GO - '+str(self.state)) elif entryEvent == EVENT_LEVEL_UP: xbmc.playSFX(SOUND_DIR+"levelup.wav") self.updateBlocks() self.drawBloom("+"+str(rows*rows*clearLev),bloomX,bloomY) self.drawBloom("Level Up! +"+str(self.controller.nLevel*15),-1,5,font="font14",duration=90) elif rows > 0: xbmc.playSFX(SOUND_DIR+"clear"+str(rows)+".wav") self.updateBlocks() self.drawBloom("+"+str(rows*rows*clearLev),bloomX,bloomY) elif entryEvent == EVENT_NEW_PIECE: xbmc.playSFX(SOUND_DIR+"lock.wav") elif entryEvent == EVENT_MOVE: xbmc.playSFX(SOUND_DIR+"move.wav") elif entryEvent == EVENT_ROTATE: xbmc.playSFX(SOUND_DIR+"rotate.wav") elif entryEvent == EVENT_DROP: xbmc.playSFX(SOUND_DIR+"drop.wav") LOG('ProcessEvent<-') xbmcgui.unlock()
def playsfx(params): xbmc.playSFX(remove_quotes(params.get('path', '')))
def doPlaySFX(self, path): xbmc.playSFX(path, False)
def gameSounds(snd): if os.path.exists(snd): xbmc.playSFX(snd)
def playSound(snd): xbmc.playSFX(snd)
import xbmc, xbmcgui xbmc.executebuiltin( "Notification(ATTENTION, System Shut Down, 10000,/home/osmc/.kodi/addons/skin.picars/lcars/shut/red_alert.gif)" ) xbmc.playSFX('/home/osmc/.kodi/addons/skin.picars/lcars/wav/offline.wav')
import xbmc if not xbmc.Player().isPlaying() : xbmc.playSFX('/home/osmc/.kodi/addons/skin.picars/lcars/wav/tos-bones-MUSTHAVE.wav')
def play_SFX( self, SFX ): if not xbmc.getCondVisibility( "Skin.HasSetting(Lucky7_SFX_Muted)" ): xbmc.playSFX( SFX )
import xbmc if not xbmc.Player().isPlaying(): xbmc.playSFX( '/home/osmc/.kodi/addons/skin.picars/lcars/wav/settings/lcars_library.wav' )
import xbmc if not xbmc.Player().isPlaying(): xbmc.playSFX('/home/osmc/.kodi/addons/skin.picars/lcars/wav/blip1.wav')
def processEvent(self, event, rows): xbmcgui.lock() LOG('ProcessEvent-> ' + str(event) + ' ' + str(rows)) self.updatePiece() entryEvent = event clearLev = bloomX = bloomY = 0 if event == EVENT_NEW_PIECE or event == EVENT_LEVEL_UP: if rows > 0 or True: clearLev = self.controller.nLevel - (event == EVENT_LEVEL_UP) bloomX = self.controller.curPiece.x + self.controller.curPiece.type.size / 2 - 1 bloomY = self.controller.curPiece.y self.imgBlocks.extend(self.imgPiece) self.imgPiece = [] event = self.controller.doNewPiece() self.updatePiece() if event == EVENT_GAME_OVER: #sound priority self.state = STATE_PAUSED xbmc.playSFX(SOUND_DIR + "gameover.wav") xbmcgui.unlock() doNewGame = self.dlgGame.showDialog( self.controller.nScore) #it unlocks and locks gui xbmcgui.lock() if doNewGame: self.state = STATE_READY self.controller.newGame() self.updateBlocks() self.updatePiece() else: self.state = STATE_QUITTING self.close() LOG('PE after GO - ' + str(self.state)) elif entryEvent == EVENT_LEVEL_UP: xbmc.playSFX(SOUND_DIR + "levelup.wav") self.updateBlocks() self.drawBloom("+" + str(rows * rows * clearLev), bloomX, bloomY) self.drawBloom("Level Up! +" + str(self.controller.nLevel * 15), -1, 5, font="font14", duration=90) elif rows > 0: xbmc.playSFX(SOUND_DIR + "clear" + str(rows) + ".wav") self.updateBlocks() self.drawBloom("+" + str(rows * rows * clearLev), bloomX, bloomY) elif entryEvent == EVENT_NEW_PIECE: xbmc.playSFX(SOUND_DIR + "lock.wav") elif entryEvent == EVENT_MOVE: xbmc.playSFX(SOUND_DIR + "move.wav") elif entryEvent == EVENT_ROTATE: xbmc.playSFX(SOUND_DIR + "rotate.wav") elif entryEvent == EVENT_DROP: xbmc.playSFX(SOUND_DIR + "drop.wav") LOG('ProcessEvent<-') xbmcgui.unlock()
import xbmc if not xbmc.Player().isPlaying(): xbmc.playSFX( '/home/osmc/.kodi/addons/skin.picars/lcars/wav/settings/lcars_access_file.wav' )
def doPlaySFX(self,path): xbmc.playSFX(path,False)
def setColorDice(self): self.colorDice = self.colored[0] self.confirmed.setLabel(self.colored[0]) self.logo.setColorDiffuse(self.colored[0]) self.confirmedName.setLabel(self.nameCol[0]) if os.path.exists(ROLLDICE): xbmc.playSFX(ROLLDICE)
import xbmc, xbmcgui if not xbmc.Player().isPlaying(): xbmc.executebuiltin( "Notification(ATTENTION, Processing, 2000,/home/osmc/.kodi/addons/skin.picars/lcars/avi/yellow.gif)" ) xbmc.playSFX( '/home/osmc/.kodi/addons/skin.picars/lcars/wav/tos-lcars-accessing-files.wav' )
def PlaySndWav(f,e='.wav'): try: if (tfalse(getSet("use-sfx"))==True) and (xbmc.Player().isPlaying()==False): if f.endswith(e)==False: f+=e xbmc.playSFX(tP(os.path.join(MediaPath,'snd',f)),useCached=True) except: pass
# -*- coding: utf-8 -*- import os, sys, subprocess, wave, hashlib, threading, shutil, errno from lib import util try: import xbmc except: xbmc = None PLAYSFX_HAS_USECACHED = False try: voidWav = os.path.join(xbmc.translatePath(util.xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8'),'resources','wavs','void.wav') xbmc.playSFX(voidWav,False) PLAYSFX_HAS_USECACHED = True except: pass def check_snd_bm2835(): try: return 'snd_bcm2835' in subprocess.check_output(['lsmod']) except: util.ERROR('check_snd_bm2835(): lsmod filed',hide_tb=True) return False def load_snd_bm2835(): try: if not xbmc or not xbmc.getCondVisibility('System.Platform.Linux.RaspberryPi'): return except: #Handles the case where there is an xbmc module installed system wide and we're not running xbmc return
from common.logger import LazyLogger from common.old_logger import OldLogger from common import utils try: import xbmc except: xbmc = None module_logger = LazyLogger.get_addon_module_logger(file_path=__file__) PLAYSFX_HAS_USECACHED = False try: voidWav = os.path.join(Constants.ADDON_DIRECTORY, 'resources', 'wavs', 'void.wav') xbmc.playSFX(voidWav, False) PLAYSFX_HAS_USECACHED = True except: pass def check_snd_bm2835(): try: return 'snd_bcm2835' in subprocess.check_output(['lsmod'], universal_newlines=True) except: module_logger.error('check_snd_bm2835(): lsmod filed', hide_tb=True) return False def load_snd_bm2835():
def set_hangman(self, lucky): if lucky == 5: xbmc.playSFX(heart) self.hangman.setImage(hangman_cache+"\\index_"+str(lucky)+".png") self.info_error.setLabel(label[68]+" "+str(lucky)+" / 6") if lucky == 0: self.flag.setPosition(398,283) elif lucky == 6: self.flag.setPosition(438,283)
def sfx(filename): xbmc.playSFX(filename)
def check_score(self, slot1display, slot2display, slot3display): all_slot = [slot1display, slot2display, slot3display] and_add = 0 if (slot1display == slot2display) and (slot2display == slot3display): #print ''' SAME SLOTS. EXAMPLE: |7|7|7| ''' if slot1display == BG_F1: self.gain = self.gain + (self.bet*20) elif slot1display == BG_F2: self.gain = self.gain + (self.bet*25) elif slot1display == BG_F3: self.gain = self.gain + (self.bet*50) elif slot1display == BG_F4: self.gain = self.gain + (self.bet*15) #xbmc.playSFX(os.path.join(skin_cache, "bell.wav")) self.winner_pot = True # FAKE: added bell.wav for playing elif slot1display == BG_F5: self.gain = self.gain + (self.bet*10) elif slot1display == BG_F6: self.gain = self.gain + (self.bet*20) elif slot1display == BG_F7: self.gain = self.gain + (self.bet*5) elif slot1display == BG_F8: self.gain = self.gain + (self.bet*10) elif slot1display == BG_F9: self.gain = self.gain + (self.bet*100) xbmc.playSFX(os.path.join(skin_cache, "seven.wav")) self.winner_pot = True self.win_Jackpot() self.focus_slot1 = True self.focus_slot2 = True self.focus_slot3 = True self.win() #self.TakeScreenShot() elif (BG_F1 in all_slot) and (BG_F2 in all_slot) and (BG_F3 in all_slot): #print ''' ANY BAR. EXAMPLE: |B3R|B1R|B2R| ''' self.gain = self.gain + (self.bet*8) self.focus_slot1 = True self.focus_slot2 = True self.focus_slot3 = True self.win() elif (slot1display == slot2display) or (slot1display == slot3display) or (slot2display == slot3display): #print ''' DOUBLE FOR SEVEN AND CHERRY ONLY OR B?R.''' #print ''' EXAMPLE: |7|CHERRY|7| OR |CHERRY|CHERRY|B1R|''' if (all_slot[0] == BG_F5) and (all_slot[1] == BG_F5): self.gain = self.gain + (self.bet*(5+and_add)) self.focus_slot1 = True self.focus_slot2 = True self.win() elif (all_slot[0] == BG_F5) and (all_slot[2] == BG_F5): if slot2display == BG_F9: and_add = 5 self.focus_slot2 = True self.gain = self.gain + (self.bet*(5+and_add)) self.focus_slot1 = True self.focus_slot3 = True self.win() elif (all_slot[1] == BG_F5) and (all_slot[2] == BG_F5): self.gain = self.gain + (self.bet*(5+and_add)) self.focus_slot2 = True self.focus_slot3 = True self.win() elif (all_slot[0] == BG_F9) and (all_slot[2] == BG_F9): if slot2display == BG_F5: and_add = 1 self.focus_slot2 = True self.gain = self.gain + (self.bet*(15+and_add)) self.focus_slot1 = True self.focus_slot3 = True self.win() else: self.double_bar_and_(all_slot) elif BG_F5 in all_slot: self.is_cherry(all_slot) elif slot2display == BG_F9: #print ''' ONE SEVEN IN CENTER SLOT. EXAMPLE: |Bell|7|B3R| ''' self.gain = self.gain + (self.bet*5) self.focus_slot2 = True self.win() else: self.lose()
def PlaySndWav(f,e='.wav'): try: if f.endswith(e)==False: f+=e xbmc.playSFX(tP(os.path.join(MediaPath,'snd',f)),useCached=True) except: pass
def SFX( sound, muted=False ): if not muted: xbmc.playSFX( os.path.join( SOUNDS_PATH, sound ) )