3e01ce2a6ce1b12432b8e81004981a9373856f42,homeassistant/components/media_player/cast.py,CastDevice,media_play_pause,#CastDevice#,132

Before Change



    def media_play_pause(self):
         Service to send the chromecast the command for play/pause. 
        ramp = self.cast.get_protocol(pychromecast.PROTOCOL_RAMP)

        if ramp:
            ramp.playpause()

    def media_play(self):
         Service to send the chromecast the command for play/pause. 
        ramp = self.cast.get_protocol(pychromecast.PROTOCOL_RAMP)

After Change


    def media_play_pause(self):
         Service to send the chromecast the command for play/pause. 
        media_state = self.state_attributes[ATTR_MEDIA_STATE]
        if media_state == MEDIA_STATE_STOPPED or media_state == MEDIA_STATE_PAUSED:
            self.media_pause()
        elif media_state == MEDIA_STATE_PLAYING:
            self.media_play()

    def media_play(self):
         Service to send the chromecast the command for play/pause. 
        if self.state_attributes[ATTR_MEDIA_STATE] == MEDIA_STATE_STOPPED:
            self.media_play_pause()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: home-assistant/home-assistant
Commit Name: 3e01ce2a6ce1b12432b8e81004981a9373856f42
Time: 2015-05-29
Author: hansmbakker@gmail.com
File Name: homeassistant/components/media_player/cast.py
Class Name: CastDevice
Method Name: media_play_pause


Project Name: home-assistant/home-assistant
Commit Name: 3e01ce2a6ce1b12432b8e81004981a9373856f42
Time: 2015-05-29
Author: hansmbakker@gmail.com
File Name: homeassistant/components/media_player/cast.py
Class Name: CastDevice
Method Name: media_pause


Project Name: home-assistant/home-assistant
Commit Name: 3e01ce2a6ce1b12432b8e81004981a9373856f42
Time: 2015-05-29
Author: hansmbakker@gmail.com
File Name: homeassistant/components/media_player/cast.py
Class Name: CastDevice
Method Name: media_play