0c91ba4a50e58734553bfb00fad5a3abab8abe43,homeassistant/components/media_player/gpmdp.py,GPMDP,update,#GPMDP#,179
Before 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
After Change
if playstate is None:
return
self._status = STATE_PLAYING if playstate["value"] else STATE_PAUSED
time_data = self.send_msg_with_req_id("getCurrentTime")
if time_data is None:
return
self._seek_position = int(time_data["value"] / 1000)
track_data = self.send_msg_with_req_id("getCurrentTrack")
if track_data is None:
return
self._title = track_data["value"]["title"]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: home-assistant/home-assistant
Commit Name: 0c91ba4a50e58734553bfb00fad5a3abab8abe43
Time: 2016-08-23
Author: nkgilley@gmail.com
File Name: homeassistant/components/media_player/gpmdp.py
Class Name: GPMDP
Method Name: update
Project Name: soft-matter/trackpy
Commit Name: b1316a19bc2c0ad8647b523cafcb0516754869f8
Time: 2012-09-17
Author: tcaswell@gmail.com
File Name: trackpy/tracking.py
Class Name: Hash_table
Method Name: get_region
Project Name: cjekel/tindetheus
Commit Name: 5a2b9314cd5b3f4da053a3813dceed362b039043
Time: 2018-11-03
Author: cjekel@gmail.com
File Name: tindetheus/tindetheus.py
Class Name:
Method Name: command_line_run