# -*- coding: utf-8 -*-
from demeter.core import *

Shell.popen('apt-get install python-pyaudio python3-pyaudio sox pulseaudio libsox-fmt-all ffmpeg libatlas-base-dev libsox-fmt-mp3 && pip install pydub pyaudio baidu-aip hmac python-dateutil pyttsx3')

#CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
def manage():
	model = Demeter.model('manage_admin')
	model.id = 1
	info = model.select(type='fetchone')
	if not info:
		model.role_id = 1
		model.username = 'admin'
		model.mobile = '15810090845'
		model.password = '123456'
		model.insert()

	model = Demeter.model('manage_role')
	model.id = 1
	info = model.select(type='fetchone')
	if not info:
		model.name = u'管理员'
		model.insert()

manage()

Demeter.echo('install success!')