Initial qiwei secondary development handoff
This commit is contained in:
5
tools/audio/silkdecode/go.mod
Normal file
5
tools/audio/silkdecode/go.mod
Normal file
@@ -0,0 +1,5 @@
|
||||
module qiweimanager/tools/audio/silkdecode
|
||||
|
||||
go 1.24.0
|
||||
|
||||
require github.com/git-jiadong/go-silk v0.0.0-20241215085148-b8734e30c24b
|
||||
2
tools/audio/silkdecode/go.sum
Normal file
2
tools/audio/silkdecode/go.sum
Normal file
@@ -0,0 +1,2 @@
|
||||
github.com/git-jiadong/go-silk v0.0.0-20241215085148-b8734e30c24b h1:mvzgg0ytGepp0JtyfbVZm8eDr0slpi5GwmVwuLg8M1o=
|
||||
github.com/git-jiadong/go-silk v0.0.0-20241215085148-b8734e30c24b/go.mod h1:sUxAzIfB02wqSwFgGR083I4Ye7w8xVynPzoIbHQxBbo=
|
||||
85
tools/audio/silkdecode/main.go
Normal file
85
tools/audio/silkdecode/main.go
Normal file
@@ -0,0 +1,85 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
silk "github.com/git-jiadong/go-silk"
|
||||
)
|
||||
|
||||
const sampleRate = 24000
|
||||
|
||||
func main() {
|
||||
in := flag.String("in", "", "input .silk file")
|
||||
out := flag.String("out", "", "output .wav file")
|
||||
flag.Parse()
|
||||
if strings.TrimSpace(*in) == "" || strings.TrimSpace(*out) == "" {
|
||||
fatalf("missing -in or -out")
|
||||
}
|
||||
if err := decodeSilkToWav(*in, *out); err != nil {
|
||||
fatalf("%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func fatalf(format string, args ...interface{}) {
|
||||
_, _ = fmt.Fprintf(os.Stderr, format+"\n", args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func decodeSilkToWav(inputPath string, outputPath string) error {
|
||||
input, err := os.Open(inputPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("open silk failed: %w", err)
|
||||
}
|
||||
defer input.Close()
|
||||
var pcm bytes.Buffer
|
||||
writer := silk.NewWriter(&pcm)
|
||||
writer.Decoder.SetSampleRate(sampleRate)
|
||||
if _, err := io.Copy(writer, input); err != nil {
|
||||
_ = writer.Close()
|
||||
return fmt.Errorf("silk decode failed: %w", err)
|
||||
}
|
||||
if err := writer.Close(); err != nil {
|
||||
return fmt.Errorf("silk decode close failed: %w", err)
|
||||
}
|
||||
if pcm.Len() == 0 {
|
||||
return fmt.Errorf("silk decode returned empty pcm")
|
||||
}
|
||||
return writeWAV(outputPath, pcm.Bytes())
|
||||
}
|
||||
|
||||
func writeWAV(path string, pcm []byte) error {
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
file, err := os.Create(path)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create wav failed: %w", err)
|
||||
}
|
||||
defer file.Close()
|
||||
dataSize := uint32(len(pcm))
|
||||
header := &bytes.Buffer{}
|
||||
header.WriteString("RIFF")
|
||||
_ = binary.Write(header, binary.LittleEndian, uint32(36)+dataSize)
|
||||
header.WriteString("WAVEfmt ")
|
||||
_ = binary.Write(header, binary.LittleEndian, uint32(16))
|
||||
_ = binary.Write(header, binary.LittleEndian, uint16(1))
|
||||
_ = binary.Write(header, binary.LittleEndian, uint16(1))
|
||||
_ = binary.Write(header, binary.LittleEndian, uint32(sampleRate))
|
||||
_ = binary.Write(header, binary.LittleEndian, uint32(sampleRate*2))
|
||||
_ = binary.Write(header, binary.LittleEndian, uint16(2))
|
||||
_ = binary.Write(header, binary.LittleEndian, uint16(16))
|
||||
header.WriteString("data")
|
||||
_ = binary.Write(header, binary.LittleEndian, dataSize)
|
||||
if _, err := file.Write(header.Bytes()); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = file.Write(pcm)
|
||||
return err
|
||||
}
|
||||
79
tools/disable_wxwork_update.ps1
Normal file
79
tools/disable_wxwork_update.ps1
Normal file
@@ -0,0 +1,79 @@
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
function Test-Admin {
|
||||
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
|
||||
return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
}
|
||||
|
||||
if (-not (Test-Admin)) {
|
||||
Write-Host "Please run this script as Administrator." -ForegroundColor Yellow
|
||||
pause
|
||||
exit 1
|
||||
}
|
||||
|
||||
$services = @(
|
||||
"WXWorkUpgrader",
|
||||
"WemeetUpdateSvc"
|
||||
)
|
||||
|
||||
foreach ($serviceName in $services) {
|
||||
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
|
||||
if ($service) {
|
||||
if ($service.Status -ne "Stopped") {
|
||||
Stop-Service -Name $serviceName -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Set-Service -Name $serviceName -StartupType Disabled -ErrorAction SilentlyContinue
|
||||
Write-Host "Disabled service: $serviceName"
|
||||
}
|
||||
}
|
||||
|
||||
$updaters = @(
|
||||
"C:\Program Files (x86)\WXWork\WXWorkUpgrader\WXWorkUpgrader.exe",
|
||||
"C:\Program Files (x86)\WXWork\4.1.33.6009\WXWorkUpgrader.exe",
|
||||
"C:\Program Files (x86)\WXWork\4.1.33.6009\WeMeet\3.26.16.708\WemeetUpdateSvc.exe",
|
||||
"C:\Program Files (x86)\WXWork\4.1.33.6009\WeMeet\3.26.16.708\DeltaUpgradeHelper.exe"
|
||||
)
|
||||
|
||||
foreach ($path in $updaters) {
|
||||
if (Test-Path -LiteralPath $path) {
|
||||
$disabledPath = "$path.disabled"
|
||||
if (-not (Test-Path -LiteralPath $disabledPath)) {
|
||||
Rename-Item -LiteralPath $path -NewName ([IO.Path]::GetFileName($disabledPath)) -Force
|
||||
Write-Host "Renamed updater: $path"
|
||||
} else {
|
||||
Write-Host "Disabled backup already exists: $disabledPath"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($path in $updaters) {
|
||||
$ruleName = "Block WXWork updater - " + ([IO.Path]::GetFileName($path))
|
||||
if (-not (Get-NetFirewallRule -DisplayName $ruleName -ErrorAction SilentlyContinue)) {
|
||||
New-NetFirewallRule -DisplayName $ruleName -Direction Outbound -Program $path -Action Block -Profile Any | Out-Null
|
||||
Write-Host "Added firewall block rule: $ruleName"
|
||||
}
|
||||
}
|
||||
|
||||
Get-ScheduledTask -ErrorAction SilentlyContinue |
|
||||
Where-Object {
|
||||
$_.TaskName -match "WXWork|Wemeet|WeMeet|Tencent" -or
|
||||
$_.TaskPath -match "WXWork|Wemeet|WeMeet|Tencent"
|
||||
} |
|
||||
ForEach-Object {
|
||||
Disable-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath -ErrorAction SilentlyContinue | Out-Null
|
||||
Write-Host "Disabled scheduled task: $($_.TaskPath)$($_.TaskName)"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Done. Current updater status:" -ForegroundColor Green
|
||||
Get-Service -Name WXWorkUpgrader,WemeetUpdateSvc -ErrorAction SilentlyContinue |
|
||||
Select-Object Name,DisplayName,Status,StartType |
|
||||
Format-Table -AutoSize
|
||||
|
||||
Get-ChildItem -LiteralPath "C:\Program Files (x86)\WXWork" -Recurse -File -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -match "WXWorkUpgrader|WemeetUpdateSvc|DeltaUpgradeHelper" } |
|
||||
Select-Object FullName,Length,LastWriteTime |
|
||||
Format-Table -AutoSize
|
||||
|
||||
pause
|
||||
Reference in New Issue
Block a user