示例#1
0
def inject():
    #makes an injection for snpips from the kodi library. Entities Injection musst be installed
    #replaces all special chars with ' ' bevor inject.
    global is_injecting
    is_injecting = 1
    ausgabe('inject', 1)
    send = {
        "operations": [[
            "addFromVanilla", {
                "shows": [],
                "movies": [],
                "genre": [],
                "artist": [],
                "albums": []
            }
        ]]
    }  #"shows":[],"movies":[],... are entitie names from snips
    tupel = build_tupel(kodi.get_movies(), 'title')
    send['operations'][0][1][
        'movies'] = send['operations'][0][1]['movies'] + tupel
    tupel = build_tupel(kodi.get_shows(), 'title')
    send['operations'][0][1][
        'shows'] = send['operations'][0][1]['shows'] + tupel
    tupel = build_tupel(kodi.get_genre(), 'title')
    send['operations'][0][1][
        'genre'] = send['operations'][0][1]['genre'] + tupel
    tupel = build_tupel(kodi.get_artists(), 'artist')
    send['operations'][0][1][
        'artist'] = send['operations'][0][1]['artist'] + tupel
    tupel = build_tupel(kodi.get_albums(), 'title')
    send['operations'][0][1][
        'albums'] = send['operations'][0][1]['albums'] + tupel
    client.publish("hermes/injection/perform", json.dumps(send))
    return
示例#2
0
def on_message(client, userdata, msg):
    global playing_state_old
    global is_in_session
    if msg.topic != 'hermes/audioServer/default/audioFrame':
        ausgabe(''+msg.topic,0)
    if msg.topic == 'hermes/hotword/default/detected':
        #when hotword is detected pause kodi player for better understanding. check if kodi is online, kodi is playing, not in kodi navigator session
        ausgabe('silent_mediaplay',1)
        if kodi.check_connectivity() and kodi.get_running_state() and not is_in_session:
            kodi.pause()
            playing_state_old = 1
    elif msg.topic == 'hermes/dialogueManager/sessionEnded':
        '''
        if session ended return to kodi playing state. check if not in kodi navigator session so kodi keeps on pause while navigating.
        also check current playing state so kodi wont return to play when "hey snips kodi pause"
        check for is_in_session to end kodi navigator when asked or start a new session for navigator session loop
        '''
        if kodi.check_connectivity() and not is_in_session:
            ausgabe('reset_mediaplay',1)
            playing_state_current = kodi.get_running_state() 
            if playing_state_old == 1 and playing_state_current == 0:
                kodi.resume()
            playing_state_old = 0
        elif kodi.check_connectivity() and is_in_session:
            if kodi.get_running_state():
                end_navigator()
            else:
                start_session(intent_filter='"'+snipsuser+'kodiNavigator","'+snipsuser+'kodiInputNavigation",'\
                              '"'+snipsuser+'kodiWindowNavigation", "'+snipsuser+'search_album",'\
                              '"'+snipsuser+'search_artist","'+snipsuser+'search_movie",'\
                              '"'+snipsuser+'search_show"'\
                              ,customData="kodi_navigation")
                
    elif msg.topic == 'hermes/asr/textCaptured':
        #checks for captured text to end session immediately if it is empty 
        payload = json.loads(msg.payload.decode())
        session_id= payload['sessionId']
        if payload['text'] == '':
            end_session(session_id,text="")
            
    elif 'intent' in msg.topic:
        ausgabe("Intent detected!",1)
        payload = json.loads(msg.payload.decode())
        slotvalue = ""
        slotname = ""
        slotisrandom = ""
        playlistid = 1
        if len(payload['slots']) > 1:
            #check if besides the mediatitle name the random slot is given 
            for item in payload['slots']:
                if item['slotName'] == 'random':
                    slotisrandom = "random"
                else:
                    slotvalue = item["value"]["value"]
                    slotname = item["slotName"]
        elif payload["slots"] != []:
            slotvalue = payload["slots"][0]["value"]["value"]
            slotname = payload["slots"][0]["slotName"]   
        name = payload["intent"]["intentName"]
        session_id= payload['sessionId']
        custom_data = payload['customData']
        ausgabe('"{0}" \n   -- "{1}":"{2}"\n   -- "customData":"{3}\n   -- "{4}" wiedergabe \n   -- "sessionId: {5} '\
            .format(name, slotname, slotvalue, custom_data, slotisrandom,session_id),0)
        if kodi.check_connectivity():
            #check if kodi is online else end session
            #first check for intents which can require the session to keep alive or start a new session with tts
            if msg.topic == 'hermes/intent/'+snipsuser+'datenbank':
                #hey snips synchronise library
                inject()
            elif msg.topic == 'hermes/intent/'+snipsuser+'play_movie':
                '''
                hey snips start the movie iron man
                add the select_movie intent in case multiple titles will be found e.g. iron man 1, iron man 2, iron man 3
                slotname: movies
                slotvalue:  -filled from injection
                '''
                intent_filter = '"'+snipsuser+'select_movie","'+snipsuser+'play_movie"'
                main_controller(slotvalue,slotname,'movieid',kodi.get_movies(),session_id,intent_filter,slotisrandom, playlistid)
            elif msg.topic == 'hermes/intent/'+snipsuser+'select_movie':
                '''
                iron man 3
                this intent will only work if the session is keept alive with the customData "media_selected" when multiple sessions are found. so it is possible to only say the movie name without hey snips...
                slotname: movies
                slotvalue:  -filled from injection
                '''
                
                if payload['customData']=="media_selected":
                    intent_filter = '"'+snipsuser+'select_movie","'+snipsuser+'play_movie"'
                    main_controller(slotvalue,slotname,'movieid',kodi.get_movies(),session_id,intent_filter,slotisrandom,playlistid)
                else:
                    end_session(session_id,text="")
            elif msg.topic == 'hermes/intent/'+snipsuser+'play_show':
                '''
                hey snips play the show marvels iron fist, hey snips play a random episode of futurama
                slotname: shows
                slotvalue:  -filled from injection
                slotname: random
                slotvalue: random +synonyms
                '''
                intent_filter = '"'+snipsuser+'play_show","'+snipsuser+'select_show"'
                main_controller(slotvalue,slotname,'tvshowid',kodi.get_shows(),session_id,intent_filter,slotisrandom,playlistid)
            elif msg.topic == 'hermes/intent/'+snipsuser+'select_show':
                '''
                if multiple shows are found e.g hey snips play the show marvels - marvels iron fist, marvels luke cake....
                slotname: shows
                slotvalue:  -filled from injection
                '''
                if payload['customData']=="media_selected":
                    intent_filter = '"'+snipsuser+'play_show","'+snipsuser+'select_show"'
                    main_controller(slotvalue,slotname,'tvshowid',kodi.get_shows(),session_id,intent_filter,slotisrandom,playlistid)
                else:
                    end_session(session_id,text="")
            elif msg.topic == 'hermes/intent/'+snipsuser+'play_genre':
                '''
                hey snips play pop music
                slotname: genre
                slotvalue:  -filled from injection
                '''
                intent_filter = '"'+snipsuser+'play_genre"'
                main_controller(slotvalue,slotname,'genreid',kodi.get_genre(),session_id,intent_filter,slotisrandom,0)
            elif msg.topic == 'hermes/intent/'+snipsuser+'play_artist':
                '''
                hey snips play songs by lady gaga
                slotname: artist
                slotvalue:  -filled from injection
                '''
                intent_filter = '"'+snipsuser+'play_genre"'
                main_controller(slotvalue,slotname,'artistid',kodi.get_artists(),session_id,intent_filter,slotisrandom,0)
            elif msg.topic == 'hermes/intent/'+snipsuser+'play_album':
                '''
                hey snips play album ...
                slotname: albums
                slotvalue:  -filled from injection
                '''
                intent_filter = '"'+snipsuser+'play_album"'
                main_controller(slotvalue,slotname,'albumid',kodi.get_albums(),session_id,intent_filter,slotisrandom,0)
            elif msg.topic == 'hermes/intent/'+snipsuser+'kodiNavigator':
                '''
                hey snips start navigator
                slotname: startstop
                slotvalue: start, stop +synonyms
                '''
                if slotvalue =='start':
                    start_navigator(session_id)    
                if slotvalue == 'stop':
                    end_navigator(session_id)
            elif msg.topic == 'hermes/intent/'+snipsuser+'kodiInputNavigation':
                '''
                up, left, okay, back, search for movies with marvels
                this intent only works if the navigator loop started
                slotname: kodiinput
                slotvalue: (value, synonyms)
                    left, links, nach links
                    right, rechts, nach rechts
                    up, hoch, nach oben
                    down, runter, nach unten
                    pageup, eine seite hoch, eine seite nach oben
                    pagedown, eine seite runter, eine seite nach unten
                    select, okay, öffnen
                    back, zurück
                    info, information
                    playlist, öffne wiedergabe liste
                    queue, in playlist einreihen, zur playlist hinzufügen, zur wiedergabeliste hinzufügen
                    close, schließen
                    togglewatched, wechsel gesehen status
                    parentdir, ein ordner nach oben
                    scrollup, scroll hoch, hoch scrollen, nach oben scrollen
                    scrolldown, sroll runter, runter scrollen, nach unten scrollen

                '''
                if payload['customData']=="kodi_navigation":
                    kodi_navigation_input(slotvalue,session_id)
                else:
                    end_session(session_id)
            elif msg.topic == 'hermes/intent/'+snipsuser+'kodiWindowNavigation':
                '''
                hey snips open movies, home, addons
                slotname: windows
                slotvalues: (value, synonyms)
                    videos, Filme
                    shows, Serien
                    music, Musik
                    addon, Add ons
                    useraddon, benutzer addon
                    videoaddon, video addon
                    audiaddon, musik addon
                    executableaddon, programm addon
                    home, hauptmenü
                    videoplaylist, video playlist, video wiedergabeliste
                    musicplaylist, musik playlist, musik wiedergabeliste
                    fullscreenvideo, zurück zum video, zurück zur wiedergabe, zurück zum film, zurück zur serie, zurück zur folge

                '''
                kodi_navigation_gui(slotvalue,session_id)
            
            else:
                #these intent will end the session after the function is called
                if msg.topic == 'hermes/intent/'+snipsuser+'KodiPause':
                    #hey snips papuse
                    playing_state_old = 0
                    kodi.pause()
                    ausgabe('pause',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'KodiResume':
                    #hey snips resume
                    playing_state_old = 0
                    kodi.resume()
                    ausgabe('resume',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'KodiStop':
                    #hey snips stop player
                    playing_state_old = 0
                    kodi.stop()
                    ausgabe('stop',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'KodiNext':
                    #hey snips play next song/episode
                    kodi.next_media()
                    ausgabe('next_media',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'KodiPrevious':
                    #hey snips play previous
                    kodi.previous_media()
                    ausgabe('previous_media',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'KodiShuffleON':
                    #hey snips set suffle on
                    kodi.shuffle_on(playlistid)
                    ausgabe('shuffle_on',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'KodiShuffleOFF':
                    #hey snips set suffle off
                    kodi.shuffle_off(playlistid)
                    ausgabe('shuffle_off',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'subtitles':
                    '''
                    hey snips set subtitles off
                    slotname: on_off
                    slotvalue: on, off +synonyms
                    '''
                    kodi.subtitles(slotvalue)
                    ausgabe('set_subtitles',1)
                elif msg.topic == 'hermes/intent/'+snipsuser+'search_show':
                    '''
                    hey snips search show marvel
                    slotname: shows
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue,slotname,kodi.get_shows())
                elif msg.topic == 'hermes/intent/'+snipsuser+'search_movie':
                    '''
                    hey snips search movie spider
                    slotname: movies
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue,slotname,kodi.get_movies())
                elif msg.topic == 'hermes/intent/'+snipsuser+'search_artist':
                    '''
                    hey snips search artist eminem
                    slotname: artist
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue,slotname,kodi.get_artists())
                elif msg.topic == 'hermes/intent/'+snipsuser+'search_album':
                    '''
                    hey snips search album relapse
                    slotname: albums
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue,slotname,kodi.get_albums())
                end_session(session_id,text="")
        else:
            end_session(session_id,text="")
def on_message(client, userdata, msg):
    global playing_state_old
    global is_in_session
    #global is_injecting
    global is_injected
    global status
    if msg.topic == 'hermes/injection/complete':
        is_injected = 1
        start_session(session_type="notification", intent_filter="",\
                      text="Kodi Remote für Snips ist jetzt bereit.",\
                      customData="", site_id="rpiz1.zuhause.xx")
        ausgabe('injection erfolgreich beendet', 0)
    if msg.topic != 'hermes/audioServer/default/audioFrame':
        payload = json.loads(msg.payload.decode())
        ausgabe('"{0}" - "{1}"'.format(msg.topic, payload), 0)
    if msg.topic == 'hermes/hotword/default/detected':
        #when hotword is detected pause kodi player for better understanding. check if kodi is online, kodi is playing, not in kodi navigator session
        ausgabe(
            'silent_mediaplay - hotword detected - is_in_session = {0}'.format(
                is_in_session), 1)
        if kodi.check_connectivity() and kodi.get_running_state(
        ) and not is_in_session:
            kodi.pause()
            playing_state_old = 1
    elif msg.topic == 'hermes/dialogueManager/sessionEnded':
        payload = json.loads(msg.payload.decode())
        session_id = payload['sessionId']
        site_id = payload['siteId']
        ausgabe(
            'Session Ended on : siteId=' + str(site_id) + ' -- sessionId=' +
            str(session_id), 0)
        '''
        if session ended return to kodi playing state. check if not in kodi navigator session so kodi keeps on pause while navigating.
        also check current playing state so kodi wont return to play when "hey snips kodi pause"
        check for is_in_session to end kodi navigator when asked or start a new session for navigator session loop
        '''
        if kodi.check_connectivity() and not is_in_session:
            ausgabe('reset_mediaplay', 1)
            playing_state_current = kodi.get_running_state()
            if playing_state_old == 1 and playing_state_current == 0:
                kodi.resume()
            playing_state_old = 0
        elif kodi.check_connectivity() and is_in_session:
            status = 0
            status = kodi.get_running_state()
            if status:
                #if kodi.get_running_state():
                #ausgabe('Kodi-Status:'+status,2)
                ausgabe('Kodi-Status : {0}'.format(status), 2)
                end_navigator(session_id="", site_id=side_id)
            else:
                start_session(intent_filter='"'+snipsuser+'kodiNavigator","'+snipsuser+'kodiInputNavigation",'\
                              '"'+snipsuser+'kodiWindowNavigation", "'+snipsuser+'search_album",'\
                              '"'+snipsuser+'search_artist","'+snipsuser+'search_movie",'\
                              '"'+snipsuser+'search_show","'+snipsuser+'search_genre"'\
                              ,customData="kodi_navigation",site_id=site_id)
    elif msg.topic == 'hermes/asr/textCaptured':
        #checks for captured text to end session immediately if it is empty
        payload = json.loads(msg.payload.decode())
        session_id = payload['sessionId']
        if payload['text'] == '':
            end_session(session_id, text="")
    elif 'intent' in msg.topic:
        #ausgabe("Intent detected!",1)
        payload = json.loads(msg.payload.decode())
        slotvalue = ""
        slotname = ""
        slotisrandom = ""
        playlistid = 1
        if len(payload['slots']) > 1:
            #check if besides the mediatitle name the random slot is given
            for item in payload['slots']:
                if item['slotName'] == 'random':
                    slotisrandom = "random"
                else:
                    slotvalue = item["value"]["value"]
                    slotname = item["slotName"]
        elif payload["slots"] != []:
            slotvalue = payload["slots"][0]["value"]["value"]
            slotname = payload["slots"][0]["slotName"]
        name = payload["intent"]["intentName"]
        session_id = payload['sessionId']
        site_id = payload['siteId']
        custom_data = payload['customData']
        #added siteId to invest who was the sending satellite
        ausgabe('"{0}" \n   -- "{1}":"{2}"\n   -- "customData":"{3}"\n   -- "{4}" wiedergabe \n   -- "sessionId":"{5}"\n   -- "siteId"   :"{6}"'\
                .format(name, slotname, slotvalue, custom_data, slotisrandom,session_id,site_id),0) # 0-->1
        ausgabe('Anfang Intent Loop')
        if kodi.check_connectivity():
            #check if kodi is online else end session
            #first check for intents which can require the session to keep alive or start a new session with tts
            if msg.topic == 'hermes/intent/' + snipsuser + 'datenbank':
                #hey snips synchronise library
                if not is_injecting and not is_injected:
                    inject()
                else:
                    end_session(session_id,
                                text="Kodi Datenbank wurde bereits injiziert.")
            elif msg.topic == 'hermes/intent/' + snipsuser + 'play_movie':
                '''
                hey snips start the movie iron man
                add the select_movie intent in case multiple titles will be found e.g. iron man 1, iron man 2, iron man 3
                slotname: movies
                slotvalue:  -filled from injection
                '''
                intent_filter = '"' + snipsuser + 'select_movie","' + snipsuser + 'play_movie"'
                main_controller(slotvalue, slotname, 'movieid',
                                kodi.get_movies(), session_id, intent_filter,
                                slotisrandom, playlistid, site_id)
            elif msg.topic == 'hermes/intent/' + snipsuser + 'select_movie':
                '''
                iron man 3
                this intent will only work if the session is keept alive with the customData "media_selected" when multiple sessions are found. so it is possible to only say the movie name without hey snips...
                slotname: movies
                slotvalue:  -filled from injection
                '''
                if payload['customData'] == "media_selected":
                    intent_filter = '"' + snipsuser + 'select_movie","' + snipsuser + 'play_movie"'
                    main_controller(slotvalue, slotname, 'movieid',
                                    kodi.get_movies(), session_id,
                                    intent_filter, slotisrandom, playlistid,
                                    site_id)
                else:
                    end_session(session_id, text="")
            elif msg.topic == 'hermes/intent/' + snipsuser + 'play_show':
                '''
                hey snips play the show marvels iron fist, hey snips play a random episode of futurama
                slotname: shows
                slotvalue:  -filled from injection
                slotname: random
                slotvalue: random +synonyms
                '''
                intent_filter = '"' + snipsuser + 'play_show","' + snipsuser + 'select_show"'
                main_controller(slotvalue, slotname, 'tvshowid',
                                kodi.get_shows(), session_id, intent_filter,
                                slotisrandom, playlistid, site_id)
            elif msg.topic == 'hermes/intent/' + snipsuser + 'select_show':
                '''
                if multiple shows are found e.g hey snips play the show marvels - marvels iron fist, marvels luke cake....
                slotname: shows
                slotvalue:  -filled from injection
                '''
                if payload['customData'] == "media_selected":
                    intent_filter = '"' + snipsuser + 'play_show","' + snipsuser + 'select_show"'
                    main_controller(slotvalue, slotname, 'tvshowid',
                                    kodi.get_shows(), session_id,
                                    intent_filter, slotisrandom, playlistid,
                                    site_id)
                else:
                    end_session(session_id, text="")
            elif msg.topic == 'hermes/intent/' + snipsuser + 'play_genre':
                '''
                hey snips play pop music
                slotname: genre
                slotvalue:  -filled from injection
                '''
                intent_filter = '"' + snipsuser + 'play_genre",' + '"' + snipsuser + 'select_genre"'
                main_controller(slotvalue, slotname, 'genreid',
                                kodi.get_genre(), session_id, intent_filter,
                                slotisrandom, 0, site_id)
            elif msg.topic == 'hermes/intent/' + snipsuser + 'select_genre':
                #maybe slotname is wrong has to be investigated : look at play show/select_show
                '''
                if multiple shows are found e.g hey snips play the show marvels - marvels iron fist, marvels luke cake....
                slotname: shows
                slotvalue:  -filled from injection
                '''
                if payload['customData'] == "media_selected":
                    intent_filter = '"' + snipsuser + 'play_genre",' + '"' + snipsuser + 'select_genre"'
                    main_controller(slotvalue, slotname, 'genreid',
                                    kodi.get_genre(), session_id,
                                    intent_filter, slotisrandom, 0, site_id)
                else:
                    end_session(session_id, text="")
            elif msg.topic == 'hermes/intent/' + snipsuser + 'play_artist':
                '''
                hey snips play songs by lady gaga
                slotname: artist
                slotvalue:  -filled from injection
                '''
                intent_filter = '"' + snipsuser + 'play_artist",' + '"' + snipsuser + 'select_artist"'
                main_controller(slotvalue, slotname, 'artistid',
                                kodi.get_artists(), session_id, intent_filter,
                                slotisrandom, 0, site_id)
            elif msg.topic == 'hermes/intent/' + snipsuser + 'select_artist':
                '''
                if multiple shows are found e.g hey snips play the show marvels - marvels iron fist, marvels luke cake....
                slotname: shows
                slotvalue:  -filled from injection
                '''
                if payload['customData'] == "media_selected":
                    intent_filter = '"' + snipsuser + 'play_artist",' + '"' + snipsuser + 'select_artist"'
                    main_controller(slotvalue, slotname, 'artistid',
                                    kodi.get_artists(), session_id,
                                    intent_filter, slotisrandom, 0, site_id)
                else:
                    end_session(session_id, text="")
            elif msg.topic == 'hermes/intent/' + snipsuser + 'play_album':
                '''
                hey snips play album ...
                slotname: albums
                slotvalue:  -filled from injection
                '''
                intent_filter = '"' + snipsuser + 'play_album",' + '"' + snipsuser + 'select_album"'
                main_controller(slotvalue, slotname, 'albumid',
                                kodi.get_albums(), session_id, intent_filter,
                                slotisrandom, 0, site_id)
            elif msg.topic == 'hermes/intent/' + snipsuser + 'select_album':
                '''
                if multiple shows are found e.g hey snips play the show marvels - marvels iron fist, marvels luke cake....
                slotname: shows
                slotvalue:  -filled from injection
                '''
                if payload['customData'] == "media_selected":
                    intent_filter = '"' + snipsuser + 'play_album",' + '"' + snipsuser + 'select_album"'
                    main_controller(slotvalue, slotname, 'albumid',
                                    kodi.get_albums(), session_id,
                                    intent_filter, slotisrandom, 0, site_id)
                else:
                    end_session(session_id, text="")
            elif msg.topic == 'hermes/intent/' + snipsuser + 'kodiNavigator':
                '''
                hey snips start navigator
                slotname: startstop
                slotvalue: start, stop +synonyms
                '''
                if slotvalue == 'start':
                    start_navigator(session_id, site_id)
                if slotvalue == 'stop':
                    end_navigator(session_id, site_id)
            elif msg.topic == 'hermes/intent/' + snipsuser + 'kodiInputNavigation':
                '''
                up, left, okay, back, search for movies with marvels
                this intent only works if the navigator loop started
                slotname: kodiinput
                slotvalue: (value, synonyms)
                    left, links, nach links
                    right, rechts, nach rechts
                    up, hoch, nach oben
                    down, runter, nach unten
                    pageup, eine seite hoch, eine seite nach oben
                    pagedown, eine seite runter, eine seite nach unten
                    select, okay, öffnen
                    back, zurück
                    info, information
                    playlist, öffne wiedergabe liste
                    queue, in playlist einreihen, zur playlist hinzufügen, zur wiedergabeliste hinzufügen
                    close, schließen
                    togglewatched, wechsel gesehen status
                    parentdir, ein ordner nach oben
                    scrollup, scroll hoch, hoch scrollen, nach oben scrollen
                    scrolldown, sroll runter, runter scrollen, nach unten scrollen
                '''
                if payload['customData'] == "kodi_navigation":
                    kodi_navigation_input(slotvalue, session_id)
                else:
                    end_session(session_id)
            elif msg.topic == 'hermes/intent/' + snipsuser + 'kodiWindowNavigation':
                '''
                hey snips open movies, home, addons
                slotname: windows
                slotvalues: (value, synonyms)
                    videos, Filme
                    shows, Serien
                    music, Musik
                    addon, Add ons
                    useraddon, benutzer addon
                    videoaddon, video addon
                    audiaddon, musik addon
                    executableaddon, programm addon
                    home, hauptmenü
                    videoplaylist, video playlist, video wiedergabeliste
                    musicplaylist, musik playlist, musik wiedergabeliste
                    fullscreenvideo, zurück zum video, zurück zur wiedergabe, zurück zum film, zurück zur serie, zurück zur folge
                    fullscreenmusic
                '''
                kodi_navigation_gui(slotvalue, session_id)
            else:
                #these intent will end the session after the function is called
                if msg.topic == 'hermes/intent/' + snipsuser + 'KodiPause':
                    #hey snips pause
                    playing_state_old = 0
                    kodi.pause()
                    #ausgabe('pause',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiResume':
                    #hey snips resume
                    playing_state_old = 0
                    kodi.resume()
                    #ausgabe('resume',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiStop':
                    #hey snips stop player
                    playing_state_old = 0
                    kodi.stop()
                    #ausgabe('stop',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiNext':
                    #hey snips play next song/episode
                    kodi.next_media()
                    #ausgabe('next_media',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiPrevious':
                    #hey snips play previous
                    kodi.previous_media()
                    #ausgabe('previous_media',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiLauter':
                    #hey snips lauter, kodi lauter, lautstärke hoch
                    if slotname == "schritte":
                        kodi.lauter(slotvalue)
                    else:
                        kodi.lauter(1)
                    #ausgabe('lautstärke_hoch',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiLeiser':
                    #hey snips leiser, nicht so laut, lautstärke runter
                    if slotname == 'schritte':
                        kodi.leiser(slotvalue)
                    else:
                        kodi.leiser(1)
                    #ausgabe('lautstärke_runter',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiSetVolume':
                    #hey snips leiser, nicht so laut, lautstärke runter
                    kodi.volume(slotvalue)
                    #ausgabe('lautstärke_setzen',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiMute':
                    #hey snips leiser, nicht so laut, lautstärke runter
                    kodi.mute()
                    #ausgabe('lautstärke_an-aus',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'KodiShuffle':
                    '''
                    hey snips set shuffle an,off,an,aus
                    slotname: on_off
                    slotvalue: on, off +synonyms
                    '''
                    kodi.shuffle(slotvalue)
                    #ausgabe('shuffle',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'kodiSubtitles':
                    '''
                    hey snips set subtitles off
                    slotname: on_off
                    slotvalue: on, off +synonyms
                    '''
                    kodi.subtitles(slotvalue)
                    #ausgabe('set_subtitles',1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'search_show':
                    '''
                    hey snips search show marvel
                    slotname: shows
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue, slotname, kodi.get_shows(), site_id)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'search_movie':
                    '''
                    hey snips search movie spider
                    slotname: movies
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue, slotname, kodi.get_movies(), site_id)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'search_artist':
                    '''
                    hey snips search artist eminem
                    slotname: artist
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue, slotname, kodi.get_artists(), site_id)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'search_album':
                    '''
                    hey snips search album relapse
                    slotname: albums
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue, slotname, kodi.get_albums(), site_id)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'search_genre':
                    '''
                    hey snips search genre pop
                    slotname: genre
                    slotvalue:  -filled from injection
                    '''
                    search(slotvalue, slotname, kodi.get_genre(), site_id)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'play_music':
                    '''
                    hey snips starte partymode, partymode an
                    slotname: none
                    slotvalue: none
                    '''
                    start_partymode(session_id)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'play_tv':
                    '''
                    hey snips spiele fernseher ab
                    intent: play_tv
                    spielt eine vorgegebene PLayliste von Serien ab
                    die playliste heisst tv.xsp
                    alternativ start_tv spiele mit tv getaggte Serien ab?
                    '''
                    #start_tv()
                    start_playlist("video/tv.xsp", 1)
                elif msg.topic == 'hermes/intent/' + snipsuser + 'kodi_wakeup':
                    '''
                    hey snips wecke kodi, kodi aufwecken, wecke kodi auf
                    holt kodi aus dem standby
                    '''
                    gui_id = kodi.get_gui()['id']
                    print('kodi_wakeup: get_gui_id=', gui_id)
                    if str(kodi.get_gui()['id']) == '13003':
                        kodi.send_input("up")
                end_session(session_id, text="")
        else:
            end_session(session_id, text="")