09d531b3b95e7943df53233d1abcb40d7e87de94,homeassistant/components/media_player/gpmdp.py,GPMDP,update,#GPMDP#,72

Before Change


            self._status = STATE_OFF
            return
        else:
            state = websocket.recv()
            state = ((json.loads(state))["payload"])
            if state is True:
                websocket.recv()
                websocket.recv()

After Change


            receiving = True
            while receiving:
                from websocket import _exceptions
                try:
                    msg = json.loads(websocket.recv())
                    if msg["channel"] == "lyrics":
                        receiving = False  // end of now playing data
                    elif msg["channel"] == "playState":
                        if msg["payload"] is True:
                            self._status = STATE_PLAYING
                        else:
                            self._status = STATE_PAUSED
                    elif msg["channel"] == "track":
                        self._title = (msg["payload"]["title"])
                        self._artist = (msg["payload"]["artist"])
                        self._albumart = (msg["payload"]["albumArt"])
                except (_exceptions.WebSocketTimeoutException,
                        _exceptions.WebSocketProtocolException,
                        _exceptions.WebSocketPayloadException):
                    return

    @property
    def media_content_type(self):
        Content type of current playing media.
        return MEDIA_TYPE_MUSIC
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: home-assistant/home-assistant
Commit Name: 09d531b3b95e7943df53233d1abcb40d7e87de94
Time: 2016-08-18
Author: nkgilley@gmail.com
File Name: homeassistant/components/media_player/gpmdp.py
Class Name: GPMDP
Method Name: update


Project Name: chakki-works/doccano
Commit Name: f8a72a0a60658d462753fe39a2119932358ccca5
Time: 2018-12-26
Author: sergiy.n@attendify.com
File Name: app/server/views.py
Class Name: DataUpload
Method Name: post


Project Name: NervanaSystems/nlp-architect
Commit Name: 24d3656c6c4b3c6806954487720d53af775a1150
Time: 2018-06-07
Author: shira.guskin@intel.com
File Name: set_expansion_demo/ui/main.py
Class Name:
Method Name: get_expand_results_callback