Skip to content

Commit

Permalink
buzz: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaquero committed Oct 6, 2024
1 parent 5175335 commit 96ae858
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 11 deletions.
41 changes: 30 additions & 11 deletions bucket/buzz.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
{
"version": "1.1.0",
"description": "Buzz transcribes and translates audio offline on your personal computer",
"description": "Buzz transcribes and translates audio offline on your personal computer. Powered by OpenAI's Whisper.",
"homepage": "https://buzzcaptions.com/",
"license": "MIT license",
"url": "https://mirror.ghproxy.com/https://github.com/chidiwilliams/buzz/releases/download/v1.1.0/Buzz-1.1.0-windows.exe",
"hash": "ef7d34f0a63ae61437849a75cef166c223c0ec30b29000d08bf48f6b285520b0",
"pre_install": "if ($dir -match ' ') { error 'The installation directory cannot include a space'; break}",
"architecture": {
"64bit": {
"url": "https://github.com/chidiwilliams/buzz/releases/download/v1.1.0/Buzz-1.1.0-windows.exe",
"hash": "ef7d34f0a63ae61437849a75cef166c223c0ec30b29000d08bf48f6b285520b0"
}
},
"innosetup": true,
"installer": {
"script": [
"Move-Item \"$dir\\$fname\" \"$dir\\..\\$fname\"",
"Start-Process -Wait \"$dir\\..\\$fname\" -ArgumentList @('/S', '/InstallationType=JustMe', '/RegisterPython=0', '/AddToPath=0', '/NoRegistry=1', \"/D=$dir\")",
"Remove-Item \"$dir\\..\\$fname\"",
"New-Item \"$env:LOCALAPPDATA\\Buzz\" -ItemType Junction -Target \"$persist_dir\" | Out-Null"
"# handle runtime cache",
"Import-Module $(Join-Path $(Find-BucketDirectory -Root -Name scoopet) scripts/AppsUtils.psm1)",
"Mount-ExternalRuntimeData -Source \"$persist_dir\\appdata\" -Target \"$env:LOCALAPPDATA\\Buzz\"",
"Mount-ExternalRuntimeData -Source \"$persist_dir\\model\\huggingface\" -Target \"$env:USERPROFILE\\.cache\\huggingface\"",
"Mount-ExternalRuntimeData -Source \"$persist_dir\\model\\whisper\" -Target \"$env:USERPROFILE\\.cache\\whisper\"",
"Remove-Module -Name AppsUtils"
]
},
"uninstaller": {
"script": "Remove-Item \"$env:LOCALAPPDATA\\Buzz\" -Recurse -Force -ErrorAction 'SilentlyContinue'"
"script": [
"Import-Module $(Join-Path $(Find-BucketDirectory -Root -Name scoopet) scripts/AppsUtils.psm1)",
"Dismount-ExternalRuntimeData -Target \"$env:LOCALAPPDATA\\Buzz\"",
"Dismount-ExternalRuntimeData -Target \"$env:USERPROFILE\\.cache\\huggingface\"",
"Dismount-ExternalRuntimeData -Target \"$env:USERPROFILE\\.cache\\whisper\"",
"Remove-Module -Name AppsUtils"
]
},
"shortcuts": [
[
"Buzz.exe",
"Buzz"
]
],
"checkver": "github",
"checkver": {
"url": "https://api.github.com/repos/chidiwilliams/buzz/releases",
"regex": "(?sm)browser_download_url.*?releases/download/v([\\d.]+)/Buzz-([\\d.]+)-windows\\.exe"
},
"autoupdate": {
"url": "https://mirror.ghproxy.com/https://github.com/chidiwilliams/buzz/releases/download/v$version/Buzz-$version-windows.exe"
"architecture": {
"64bit": {
"url": "https://github.com/chidiwilliams/buzz/releases/download/v$version/Buzz-$version-windows.exe"
}
}
}
}
57 changes: 57 additions & 0 deletions scripts/AppsUtils.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#Requires -Version 5.1
Set-StrictMode -Version 3.0

function Mount-ExternalRuntimeData {
<#
.SYNOPSIS
Mount external runtime data
.PARAMETER Source
The source path, which is the persist_dir
.PARAMETER Target
The target path, which is the actual path app uses to access the runtime data
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, Position = 0)]
[string] $Source,
[Parameter(Mandatory = $true, Position = 1)]
[string] $Target
)

if (Test-Path $Source) {
Remove-Item $Target -Force -Recurse -ErrorAction SilentlyContinue
}
else {
New-Item -ItemType Directory $Source -Force | Out-Null
if (Test-Path $Target) {
Get-ChildItem $Target | Move-Item -Destination $Source -Force
}
}

New-Item -ItemType Junction -Path $Target -Target $Source -Force | Out-Null
}

function Dismount-ExternalRuntimeData {
<#
.SYNOPSIS
Unmount external runtime data
.PARAMETER Target
The target path, which is the actual path app uses to access the runtime data
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, Position = 0)]
[string] $Target
)

if (Test-Path $Target) {
Remove-Item $Target -Force -Recurse
}
}

Export-ModuleMember `
-Function `
Mount-ExternalRuntimeData, Dismount-ExternalRuntimeData

0 comments on commit 96ae858

Please sign in to comment.