mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-07 22:18:30 -04:00
fix(bluetooth): derive codec from locale-independent profile name in bluez-card-profile.lua
fixes #3004 port 1.5
This commit is contained in:
@@ -29,10 +29,24 @@ local function profile_available(profile)
|
||||
return profile and profile.available ~= "no"
|
||||
end
|
||||
|
||||
local codec_profile_prefixes = {
|
||||
"^a2dp%-sink%-(.+)$",
|
||||
"^a2dp%-source%-(.+)$",
|
||||
"^headset%-head%-unit%-(.+)$",
|
||||
"^headset%-audio%-gateway%-(.+)$",
|
||||
}
|
||||
|
||||
local function codec_from_profile(profile)
|
||||
if not profile then
|
||||
return ""
|
||||
end
|
||||
local name = profile.name or ""
|
||||
for _, pattern in ipairs(codec_profile_prefixes) do
|
||||
local codec = name:match(pattern)
|
||||
if codec then
|
||||
return codec:gsub("%-", "_"):upper()
|
||||
end
|
||||
end
|
||||
local desc = profile.description or ""
|
||||
local codec = desc:match("[Cc]odec%s+([%w%+%-%._]+)")
|
||||
if not codec then
|
||||
|
||||
Reference in New Issue
Block a user