from subprocess import call

from mycroft.frontends.tts.tts_plugin import TtsPlugin


class MimicTts(TtsPlugin):
    def read(self, text):
        call(['mimic', '-t', text, '-voice', self.config['voice']])

from subprocess import call

from os.path import isdir

from mycroft.frontends.tts.tts_plugin import TtsPlugin
from mycroft.util.git_repo import GitRepo


class MimicTts(TtsPlugin):
    def __init__(self, rt):
        super().__init__(rt)

        if not isdir(self.rt.paths.mimic_exe):
            self.download_mimic()

    def download_mimic(self):
        repo = GitRepo(self.rt.paths.mimic, self.config['url'], 'master')
        repo.try_pull()
        repo.run_inside('./dependencies.sh --prefix="/usr/local"')
        repo.run_inside('./autogen.sh')
        repo.run_inside('./configure.sh --prefix="/usr/local"')
        repo.run_inside('make -j2')

    def read(self, text):
        call([self.rt.paths.mimic_exe, '-t', text, '-voice', self.config['voice']])

Add download and compile step to mimic
Add download and compile step to mimic

  from subprocess import call
  
+ from os.path import isdir
+ 
  from mycroft.frontends.tts.tts_plugin import TtsPlugin
+ from mycroft.util.git_repo import GitRepo
  
  
  class MimicTts(TtsPlugin):
+     def __init__(self, rt):
+         super().__init__(rt)
+ 
+         if not isdir(self.rt.paths.mimic_exe):
+             self.download_mimic()
+ 
+     def download_mimic(self):
+         repo = GitRepo(self.rt.paths.mimic, self.config['url'], 'master')
+         repo.try_pull()
+         repo.run_inside('./dependencies.sh --prefix="/usr/local"')
+         repo.run_inside('./autogen.sh')
+         repo.run_inside('./configure.sh --prefix="/usr/local"')
+         repo.run_inside('make -j2')
+ 
      def read(self, text):
-         call(['mimic', '-t', text, '-voice', self.config['voice']])
+         call([self.rt.paths.mimic_exe, '-t', text, '-voice', self.config['voice']])
  
Add download and compile step to mimic
## Code Before:
from subprocess import call

from mycroft.frontends.tts.tts_plugin import TtsPlugin


class MimicTts(TtsPlugin):
    def read(self, text):
        call(['mimic', '-t', text, '-voice', self.config['voice']])

## Instruction:
Add download and compile step to mimic
## Code After:
from subprocess import call

from os.path import isdir

from mycroft.frontends.tts.tts_plugin import TtsPlugin
from mycroft.util.git_repo import GitRepo


class MimicTts(TtsPlugin):
    def __init__(self, rt):
        super().__init__(rt)

        if not isdir(self.rt.paths.mimic_exe):
            self.download_mimic()

    def download_mimic(self):
        repo = GitRepo(self.rt.paths.mimic, self.config['url'], 'master')
        repo.try_pull()
        repo.run_inside('./dependencies.sh --prefix="/usr/local"')
        repo.run_inside('./autogen.sh')
        repo.run_inside('./configure.sh --prefix="/usr/local"')
        repo.run_inside('make -j2')

    def read(self, text):
        call([self.rt.paths.mimic_exe, '-t', text, '-voice', self.config['voice']])
