diff --git a/const.py b/const.py index 2cb4be5..c17be4f 100644 --- a/const.py +++ b/const.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Constants for Google Assistant.""" -VERSION = '1.10.8' +VERSION = '1.10.9' PUBLIC_URL = 'https://[your public url]' CONFIGFILE = 'config/config.yaml' LOGFILE = 'dzga.log' diff --git a/smarthome.py b/smarthome.py index 0fc95ac..fc09271 100644 --- a/smarthome.py +++ b/smarthome.py @@ -32,20 +32,25 @@ if 'Chromecast_Name' in configuration and configuration['Chromecast_Name'] != 'add_chromecast_name': try: import pychromecast - import socket ## + except ImportError as e: + logger.error('Installing package pychromecast') + subprocess.call(['pip3', 'install', '--upgrade', '--force-reinstall', 'pychromecast']) + try: from gtts import gTTS - from slugify import slugify except ImportError as e: - logger.error('Installing package pychromecast, socket, gtts and slugify') - subprocess.call(['pip3', 'install', 'pychromecast']) - subprocess.call(['pip3', 'install', 'socket']) ## + logger.error('Installing package gtts') subprocess.call(['pip3', 'install', 'gtts']) + try: + from slugify import slugify + except ImportError as e: + logger.error('Installing package slugify') subprocess.call(['pip3', 'install', 'slugify']) - import pychromecast - import socket ## - from gtts import gTTS - from slugify import slugify + import pychromecast + import socket ## + from gtts import gTTS + from slugify import slugify + logger.info("Starting up chromecasts") try: chromecasts, _ = pychromecast.get_chromecasts()