Пример #1
0
    def __init__(self):
        self.using_appdata = True  # Set to false if we weren't able to find a directory to save the appdata
        appname = 'harp'
        appdata_dir = appdirs.user_data_dir(appname)
        self.app_data = {}

        if not os.path.isdir(appdata_dir):
            try:
                os.mkdir(appdata_dir)
            except WindowsError:
                #Can't find the AppData directory. So just make one in home directory
                appdata_dir = os.path.join(expanduser("~"), '.' + appname)
                if not os.path.isdir(appdata_dir):
                    try:
                        os.mkdir(appdata_dir)
                    except:
                        self.using_appdata = False
            except OSError:
                self.using_appdata = False

        if self.using_appdata:
            self.app_data_file = os.path.join(appdata_dir, 'app_data.yaml')

            if os.path.isfile(self.app_data_file):
                with open(self.app_data_file, 'r') as fh:
                    self.app_data = yaml.load(fh)
Пример #2
0
def setup():
    backends.removeBackendsByProvider(('ttsd','speechutil'))

    user_path = appdirs.user_data_dir('speech.server','ruuksoft')
    if not os.path.exists(user_path): os.makedirs(user_path)
    util.LOG('Config file located at: {0}'.format(CONFIG_PATH))
    if os.path.exists(CONFIG_PATH):
        return
    config = ConfigParser.ConfigParser()
    config.add_section('settings')
    config.set('settings','address','0.0.0.0')
    config.set('settings','port','8256')
    config.set('settings','player','')
    with open(CONFIG_PATH,'w') as cf: config.write(cf)
Пример #3
0
    def __init__(self):
        self.using_appdata = True  # Set to false if we weren't able to find a directory to save the appdata
        appname = 'harp'
        appdata_dir = appdirs.user_data_dir(appname)
        self.app_data = {}

        if not os.path.isdir(appdata_dir):
            try:
                os.mkdir(appdata_dir)
            except WindowsError:
                #Can't find the AppData directory. So just make one in home directory
                appdata_dir = os.path.join(expanduser("~"), '.' + appname)
                if not os.path.isdir(appdata_dir):
                    try:
                        os.mkdir(appdata_dir)
                    except:
                        self.using_appdata = False
            except OSError:
                self.using_appdata = False

        if self.using_appdata:
            self.app_data_file = os.path.join(appdata_dir, 'app_data.yaml')
            yaml_load_error = False
            if os.path.isfile(self.app_data_file):
                with open(self.app_data_file, 'r') as fh:
                    try:
                        self.app_data = yaml.load(fh)
                    except yaml.reader.ReaderError as e:
                        # try to remove file
                        try:
                            os.remove(self.app_data_file)
                        except OSError as e:
                            print(
                                'the harp app data config file at {} is corrupt, nad it cannot be deleted. '
                                'Please remove it before restarting'.format(
                                    self.app_data_file))
                            yaml_load_error = True

                # In case loading failed
                if not self.app_data or not isinstance(
                        self.app_data, dict) or yaml_load_error:
                    self.app_data = {}
Пример #4
0
    def __init__(self):
        self.using_appdata = True  # Set to false if we weren't able to find a directory to save the appdata
        appname = 'harp'
        appdata_dir = appdirs.user_data_dir(appname)
        self.app_data = {}

        if not os.path.isdir(appdata_dir):
            try:
                os.mkdir(appdata_dir)
            except WindowsError:
                #Can't find the AppData directory. So just make one in home directory
                appdata_dir = os.path.join(expanduser("~"), '.' + appname)
                if not os.path.isdir(appdata_dir):
                    try:
                        os.mkdir(appdata_dir)
                    except:
                        self.using_appdata = False
            except OSError:
                self.using_appdata = False

        if self.using_appdata:
            self.app_data_file = os.path.join(appdata_dir, 'app_data.yaml')
            yaml_load_error = False
            if os.path.isfile(self.app_data_file):
                with open(self.app_data_file, 'r') as fh:
                    try:
                        self.app_data = yaml.load(fh)
                    except yaml.reader.ReaderError as e:
                        # try to remove file
                        try:
                            os.remove(self.app_data_file)
                        except OSError as e:
                            print('the harp app data config file at {} is corrupt, nad it cannot be deleted. '
                                  'Please remove it before restarting'.format(self.app_data_file))
                            yaml_load_error = True

                # In case loading failed
                if not self.app_data or not isinstance(self.app_data, dict) or yaml_load_error:
                    self.app_data = {}
Пример #5
0
def configDirectory():
    from lib import appdirs
    return appdirs.user_data_dir('speech.server','ruuksoft')
Пример #6
0
#! /usr/bin/env python

__version__ = '0.0.8'

import os, sys, ConfigParser, socket, cgi, optparse, copy
sys.path.insert(0,os.path.join(os.path.dirname(__file__),'lib'))
from lib import backends
from lib import util
from lib import appdirs
import cherrypy
from cherrypy.lib import file_generator

TTS = None

user_path = appdirs.user_data_dir('speech.server','ruuksoft')
CONFIG_PATH = os.path.join(user_path,'config.txt')

def strIsNumber(numstr):
    try: float(numstr)
    except: return False
    return True

class TTSHandler:
    preferred_player = None
    def __init__(self):
        self.backend = None

    def setEngine(self,provider,wav_stream=False):
        if not provider:
            if self.backend: return
        else:
Пример #7
0
from os import path
from lib import appdirs

_appdir = appdirs.user_data_dir('exoduscli')

specialroot = path.join(_appdir, 'fakexbmc', 'special')
addonsdir = path.join(_appdir, 'addons')
logfile = path.join(_appdir, 'fakexbmc.log')
exodus = dict(
    id = 'plugin.video.exodus',
    b64url = 'aHR0cHM6Ly9vZmZzaG9yZWdpdC5jb20vZXhvZHVzL3BsdWdpbi52aWRlby5leG9kdXMvcGx1Z2luLnZpZGVvLmV4b2R1cy0yLjAuOC56aXA=',
    zipmd5 = 'd1bf483d48be348c916fb95750b30e61',
    entryfile = 'exodus.py',
    version = '2.0.8'
)
libs = [
    dict(
        id = 'script.module.urlresolver',
        b64url = 'aHR0cHM6Ly9vZmZzaG9yZWdpdC5jb20vdHZhcmVzb2x2ZXJzL3R2YS1jb21tb24tcmVwb3NpdG9yeS9yYXcvbWFzdGVyL3ppcHMvc2NyaXB0Lm1vZHVsZS51cmxyZXNvbHZlci9zY3JpcHQubW9kdWxlLnVybHJlc29sdmVyLTMuMC4xOS56aXA=',
        zipmd5 = '4b78acc8d1f61cc7765071bbcbb8e09a',
        libpath = 'lib',
        version = '3.0.19'
    )
]