feat: add termux tts support
This commit is contained in:
@ -40,7 +40,6 @@ return function()
|
||||
vim.notify(debug_message, vim.log.ERROR)
|
||||
end
|
||||
|
||||
|
||||
Trans.curl.get(uri, {
|
||||
output = zip,
|
||||
callback = handle,
|
||||
@ -51,7 +50,7 @@ return function()
|
||||
vim.notify(message, vim.log.levels.INFO)
|
||||
|
||||
-- INFO : Install tts dependencies
|
||||
if fn.has 'linux' == 0 and fn.has 'mac' == 0 then
|
||||
if Trans.system == 'win' then
|
||||
os.execute 'cd ./tts && npm install'
|
||||
end
|
||||
end
|
||||
|
@ -23,12 +23,8 @@ function M.setup()
|
||||
for action, key in pairs(M.opts.keymaps) do
|
||||
set('n', key, function()
|
||||
local instance = M.get_active_instance()
|
||||
|
||||
if instance then
|
||||
coroutine.wrap(instance.execute)(instance, action)
|
||||
else
|
||||
return key
|
||||
end
|
||||
return instance and coroutine.wrap(instance.execute)(instance, action) or key
|
||||
-- TODO : Fix remap
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
@ -38,13 +38,13 @@ local function check_binary_dependencies()
|
||||
'sqlite3',
|
||||
}
|
||||
|
||||
if has 'linux' == 1 then
|
||||
binary_dependencies[3] = 'festival'
|
||||
elseif has 'mac' == 1 then
|
||||
binary_dependencies[3] = 'say'
|
||||
else
|
||||
binary_dependencies[3] = 'node'
|
||||
end
|
||||
binary_dependencies[3] = ({
|
||||
win = 'node',
|
||||
mac = 'say',
|
||||
linux = 'festival',
|
||||
termux = 'termux-api-speak',
|
||||
})[Trans.system]
|
||||
|
||||
|
||||
for _, dep in ipairs(binary_dependencies) do
|
||||
if executable(dep) == 1 then
|
||||
|
@ -18,18 +18,26 @@ end
|
||||
---@field width function @Get string display width
|
||||
---@field play function @Use tts to play string
|
||||
|
||||
local uname = vim.loop.os_uname().sysname
|
||||
local system =
|
||||
uname == 'Darwin' and 'mac' or
|
||||
uname == 'Windows_NT' and 'win' or
|
||||
uname == 'Linux' and (vim.fn.executable 'termux-api-start' == 1 and 'termux' or 'linux') or
|
||||
error 'Unknown System, Please Report Issue'
|
||||
|
||||
local sep = vim.loop.os_uname().sysname == 'Windows' and '\\' or '/'
|
||||
local sep = system == 'win' and '\\' or '/'
|
||||
---@class Trans
|
||||
---@field style table @Style module
|
||||
---@field cache table<string, TransData> @Cache for translated data object
|
||||
---@field plugin_dir string @Plugin directory
|
||||
---@field separator string @Path separator
|
||||
---@field system 'mac'|'win'|'termux'|'linux' @Path separator
|
||||
local M = metatable('core', {
|
||||
cache = {},
|
||||
style = metatable 'style',
|
||||
plugin_dir = debug.getinfo(1, 'S').source:sub(2):match('(.-)lua' .. sep .. 'Trans'),
|
||||
separator = sep,
|
||||
system = system,
|
||||
plugin_dir = debug.getinfo(1, 'S').source:sub(2):match('(.-)lua' .. sep .. 'Trans'),
|
||||
})
|
||||
|
||||
M.metatable = metatable
|
||||
|
Reference in New Issue
Block a user