Skip to content

Commit

Permalink
chore: Refactor Update-OpenMedia.4KVideoDownloader.ps1 script
Browse files Browse the repository at this point in the history
  • Loading branch information
Utesgui authored May 17, 2024
1 parent f13b190 commit f09c49e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Scripts/Packages/Update-OpenMedia.4KVideoDownloader.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
. .\Scripts\common.ps1

$versionPattern = "videodownloader_(\d+\.\d+\.\d+\.\d+)_windows_(x86|x64)"
$URLFilter = "videodownloader_windows_(x32|x64)_installer"
$versionParts = $wingetPackage.Split('.')
$PackageName = $versionParts[1]

$ProductName = ($PackageName -replace '4K', '').Trim().ToLower()

$versionPattern = "$($ProductName)_(\d+\.\d+\.\d+\.\d+)_windows_(x86|x64)"
$URLFilter = "$($ProductName)_windows_(x32|x64)_installer"

# Download the webpage
$website = Invoke-WebRequest -Uri $WebsiteURL
Expand Down
2 changes: 1 addition & 1 deletion Scripts/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function Update-WingetPackage {
[Parameter(Mandatory = $false)] [string] $WingetPackage = ${Env:PackageName},
[Parameter(Mandatory = $false)][ValidateSet("Komac", "WinGetCreate")] [string] $With = "Komac",
[Parameter(Mandatory = $false)] [string] $resolves = (${Env:resolves} -match '^\d+$' ? ${Env:resolves} : ""),
[Parameter(Mandatory = $false)] [switch] $Submit = $false,
[Parameter(Mandatory = $false)] [bool] $Submit = $false,
[Parameter(Mandatory = $false)] [string] $latestVersion,
[Parameter(Mandatory = $false)] [string] $latestVersionURL
)
Expand Down

0 comments on commit f09c49e

Please sign in to comment.