Beispiel #1
0
    def onNotification(self, sender, method, data):
        if method in [
                'Player.OnPlay', 'Player.OnStop', 'Player.OnAVChange',
                'Playlist.OnAdd', 'Playlist.OnRemove', 'VideoLibrary.OnUpdate',
                'AudioLibrary.OnUpdate'
        ]:
            self.data = json.loads(data)
        ''' Clear music or video playlist based on player content.
        '''
        if method == 'Playlist.OnAdd':
            self.clear_playlists()
        ''' Get stuff when playback starts.
        '''
        if method == 'Player.OnPlay':
            xbmc.stopSFX()
            self.pvr_playback = condition(
                'String.StartsWith(Player.Filenameandpath,pvr://)')

            self.get_art_info()

            if condition('Skin.HasSetting(BlurPlayerIcon)'):
                self.blur_player_icon()

            if self.pvr_playback:
                self.get_channellogo()

            if PLAYER.isPlayingVideo() and not self.pvr_playback:
                self.get_videoinfo()
        ''' Check if multiple audio tracks are available and refetch
            artwork info for PVR playback.
        '''
        if method == 'Player.OnAVChange':
            self.get_audiotracks()

            if self.pvr_playback:
                self.get_art_info()
        ''' Playback stopped. Clean up.
        '''
        if method == 'Player.OnStop':
            while not self.abortRequested(
            ):  # workaround for unwanted behaviours on slow systems
                self.waitForAbort(3)
                break

            if not PLAYER.isPlaying() and xbmcgui.getCurrentWindowId() not in [
                    12005, 12006, 10028, 10500, 10138, 10160
            ]:
                self.pvr_playback = False
                self.get_channellogo(clear=True)
                self.get_audiotracks(clear=True)
                self.get_videoinfo(clear=True)
                self.get_art_info(clear=True)
                ''' Kodi doesn't reset shuffle to false automatically. To prevent issues with Emby for Kodi we have to
                    set shuffle to false for the next video playback if it was enabled by the script before.
                '''
                if winprop('script.shuffle.bool'):
                    winprop('script.shuffle', clear=True)

                    json_call('Player.SetShuffle',
                              params={
                                  'playerid': 1,
                                  'shuffle': False
                              })
Beispiel #2
0
 def stop(self):
     self.event.set()
     xbmc.stopSFX()
Beispiel #3
0
def stopSounds():
    if hasattr(xbmc, 'stopSFX'): xbmc.stopSFX()
Beispiel #4
0
def stopSounds():
    if hasattr(xbmc,'stopSFX'): xbmc.stopSFX()
    def onNotification(self, sender, method, data):
        if method in [
                'Player.OnPlay', 'Player.OnStop', 'Player.OnAVChange',
                'Playlist.OnAdd', 'Playlist.OnRemove', 'VideoLibrary.OnUpdate',
                'AudioLibrary.OnUpdate'
        ]:
            self.data = json.loads(data)
        ''' Clear music or video playlist based on player content.
        '''
        if method == 'Playlist.OnAdd':
            self.clear_playlists()
        ''' Get stuff when playback starts.
        '''
        if method == 'Player.OnPlay':
            xbmc.stopSFX()
            self.pvr_playback = condition(
                'String.StartsWith(Player.Filenameandpath,pvr://)')

            self.get_art_info()

            if self.pvr_playback:
                self.get_channellogo()

            if PLAYER.isPlayingVideo() and not self.pvr_playback:
                self.get_videoinfo()
                self.get_nextitem()

            if PLAYER.isPlayingAudio() and not self.pvr_playback and condition(
                    '!String.IsEmpty(MusicPlayer.DBID) + [String.IsEmpty(Player.Art(thumb)) | String.IsEmpty(Player.Art(album.discart))]'
            ):
                self.get_songartworks()

            if not self.fullscreen_lock:
                self.do_fullscreen()
        ''' Playlist changed. Fetch nextitem again.
        '''
        if method in ['Playlist.OnAdd', 'Playlist.OnRemove'
                      ] and PLAYER.isPlayingVideo() and not self.pvr_playback:
            self.get_nextitem()
        ''' Check if multiple audio tracks are available and refetch
            artwork info for PVR playback.
        '''
        if method == 'Player.OnAVChange':
            self.get_audiotracks()

            if self.pvr_playback:
                self.get_art_info()
        ''' Playback stopped. Clean up.
        '''
        if method == 'Player.OnStop':
            xbmc.sleep(2500)
            if not PLAYER.isPlaying() and xbmcgui.getCurrentWindowId() not in [
                    12005, 12006, 10028, 10500, 10138, 10160
            ]:
                self.fullscreen_lock = False
                self.pvr_playback = False
                self.get_nextitem(clear=True)
                self.get_channellogo(clear=True)
                self.get_audiotracks(clear=True)
                self.get_videoinfo(clear=True)
                self.get_art_info(clear=True)
                ''' Kodi doesn't reset shuffle to false automatically. To prevent issues with Emby for Kodi we have to
                    set shuffle to false for the next video playback if it was enabled by the script before.
                '''
                if winprop('script.shuffle.bool'):
                    winprop('script.shuffle', clear=True)

                    json_call('Player.SetShuffle',
                              params={
                                  'playerid': 1,
                                  'shuffle': False
                              })
Beispiel #6
0
 def stop(self):
     self.event.set()
     xbmc.stopSFX()
def stopsfx(params):
    xbmc.stopSFX()
Beispiel #8
0
 def stopTheme(self):
     log('stopTheme')
     xbmc.stopSFX()
Beispiel #9
0

def pause():
    if not isPlaybackPaused(): xbmc.Player().pause()  #trigger


#	xbmcgui.Dialog().ok(addonname, str(isPlaybackPaused()))
#	xbmcgui.Dialog().ok(addonname, str(isMuted()))

# Main execution
if len(sys.argv) == 2:
    xbmc.enableNavSounds(True)

    if sys.argv[1] != "MESSAGE":
        if "/cms/cached/voice/" in sys.argv[1]:
            if tts_stop == "true": xbmc.stopSFX()
            if media_unpause == "true": play()
            if tts_notification == "true":
                xbmc.executebuiltin(
                    'XBMC.Notification(TTS arrived, trying to say it..., ' +
                    notification_time + ')')
            xbmc.playSFX(sys.argv[1], False)
        elif sys.argv[1] == "ping":
            pass
        elif sys.argv[1] == "ringtone":
            if media_unpause == "true": play()
            if tts_notification == "true":
                xbmc.executebuiltin(
                    'XBMC.Notification(Built-in sound called, "RINGTONE")')
            xbmc.playSFX(SOUND_RINGTONE)
        elif sys.argv[1] == "welcome":