Beispiel #1
0
    def reboot(self):

        try:
            from pychromecast.dial import reboot
        except ImportError:
            # reboot is removed from pychromecast.dial since PR394
            # see: https://github.com/home-assistant-libs/pychromecast/pull/394
            print(
                colors.warning(
                    "This version of pychromecast does not support reboot. Will do nothing."
                ))
            reboot = lambda x: None

        if self.platform == "Darwin":
            self.cast.host = socket.gethostbyname(self.cast_to + ".local")
            reboot(self.cast.host)
        else:
            print(colors.error("This method is not supported in Linux yet."))
Beispiel #2
0
 def reboot(self):
     if platform == 'Darwin':
         try:
             self.cast.host_ = socket.gethostbyname(self.cast_to + '.local')
             print('Cast device IP: '+str(self.cast.host_))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host_)
         except socket.gaierror:
             print('Cast device IP: '+str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             # FIXME I should add a notification here
             pass
     else:
         try:
             print('Cast device IP: %s' % str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             self.reset_audio()
             self.stop_cast()
             try:
                 for device in self.availablecc:
                     if self.cast_to in device:
                         ip = device[3]
                         print('Sonos device IP: %s' % str(ip))
                 url = 'http://' + ip + ':1400/reboot'
                 urlopen(url).read()
             except AttributeError:
                 pass
Beispiel #3
0
 def reboot(self):
     if platform == "Darwin":
         try:
             self.cast.host_ = socket.gethostbyname(self.cast_to + ".local")
             print("Cast device IP: " + str(self.cast.host_))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host_)
         except socket.gaierror:
             print("Cast device IP: " + str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             # FIXME I should add a notification here
             pass
     else:
         try:
             print("Cast device IP: %s" % str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             self.reset_audio()
             self.stop_cast()
             try:
                 for device in self.available_devices:
                     if self.cast_to in device:
                         ip = device[3]
                         print("Sonos device IP: %s" % str(ip))
                 url = "http://" + ip + ":1400/reboot"
                 urlopen(url).read()
             except AttributeError:
                 pass
Beispiel #4
0
 def reboot(self):
     if platform == 'Darwin':
         try:
             self.cast.host_ = socket.gethostbyname(self.cast_to + '.local')
             print('Cast device IP: '+str(self.cast.host_))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host_)
         except socket.gaierror:
             print('Cast device IP: '+str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             # FIXME I should add a notification here
             pass
     else:
         try:
             print('Cast device IP: %s' % str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             self.reset_audio()
             self.stop_cast()
             try:
                 for device in self.available_devices:
                     if self.cast_to in device:
                         ip = device[3]
                         print('Sonos device IP: %s' % str(ip))
                 url = 'http://' + ip + ':1400/reboot'
                 urlopen(url).read()
             except AttributeError:
                 pass
Beispiel #5
0
    def reboot(self):

        try:
            from pychromecast.dial import reboot
        except ImportError:
            # reboot is removed from pychromecast.dial since PR394
            # see: https://github.com/home-assistant-libs/pychromecast/pull/394
            print(
                colors.warning(
                    "This version of pychromecast does not support reboot. Will do nothing."
                ))
            reboot = lambda x: None

        if platform == "Darwin":
            try:
                self.cast.host_ = socket.gethostbyname(self.cast_to + ".local")
                print("Cast device IP: " + str(self.cast.host_))
                self.reset_audio()
                self.stop_cast()
                reboot(self.cast.host_)
            except socket.gaierror:
                print("Cast device IP: " + str(self.cast.host))
                self.reset_audio()
                self.stop_cast()
                reboot(self.cast.host)
            except AttributeError:
                # FIXME I should add a notification here
                pass
        else:
            try:
                print("Cast device IP: %s" % str(self.cast.host))
                self.reset_audio()
                self.stop_cast()
                reboot(self.cast.host)
            except AttributeError:
                self.reset_audio()
                self.stop_cast()
                try:
                    for device in self.available_devices:
                        if self.cast_to in device:
                            ip = device[3]
                            print("Sonos device IP: %s" % str(ip))
                    url = "http://" + ip + ":1400/reboot"
                    urlopen(url).read()
                except AttributeError:
                    pass
Beispiel #6
0
 def reboot(self):
     if platform == 'Darwin':
         try:
             self.cast.host_ = socket.gethostbyname(self.cast_to + '.local')
             print('Cast device IP: ' + str(self.cast.host_))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host_)
         except socket.gaierror:
             print('Cast device IP: ' + str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             pass  # I should add a notification here
     else:
         try:
             print('Cast device IP: ' + str(self.cast.host))
             self.reset_audio()
             self.stop_cast()
             reboot(self.cast.host)
         except AttributeError:
             pass  # I should add a notification here
Beispiel #7
0
 def reboot(self):
     if self.platform == "Darwin":
         self.cast.host = socket.gethostbyname(self.cast_to + ".local")
         reboot(self.cast.host)
     else:
         print(colors.error("This method is not supported in Linux yet."))
Beispiel #8
0
 def reboot(self):
     if self.platform == 'Darwin':
         self.cast.host = socket.gethostbyname(self.cast_to+'.local')
         reboot(self.cast.host)
     else:
         print(colors.error('This method is not supported in Linux yet.'))
Beispiel #9
0
 def reboot(self):
     if self.platform == 'Darwin':
         self.cast.host = socket.gethostbyname(self.cast_to + '.local')
         reboot(self.cast.host)
     else:
         print(colors.error('This method is not supported in Linux yet.'))