Skip to content

Instantly share code, notes, and snippets.

@Ash258
Last active May 12, 2019 20:12
Show Gist options
  • Save Ash258/221b68710d5e0f7c667d9fdd07e1cda8 to your computer and use it in GitHub Desktop.
Save Ash258/221b68710d5e0f7c667d9fdd07e1cda8 to your computer and use it in GitHub Desktop.
version: 1.0beta
description: FreeRapid Downloader. Easy to use downloader that supports downloading from Youtube, Facebook, Picasa and other file-sharing services, include the new ones like mega.co.nz.
homepage: https://wordrider.net/freerapid/
license: GPL-2.0-or-later
suggest:
java: oraclejdk-lts
url: https://wordrider.net/download/FreeRapid-1.0beta.zip
hash: c493b4fb4223c7a75fa748b309dc9342ca8bd68d4415b686d28d68c6a8b7b520
extract_dir: FreeRapid-1.0beta
post_install: |
$delimeter = "`r`n"
$start = @(
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>',
'<!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">',
'<preferences EXTERNAL_XML_VERSION="1.0">',
' <root type="user">',
' <map>'
)
$ents = @()
$end = @(' </map>', ' </root>', '</preferences>')
$entryTemplate = " <entry key=""%%key%%"" value=""%%value%%""/>"
$entries = @{
'enableDirectDownloads' = 'true'
'enableNewLinkCheckDownloadHistory' = 'true'
'errorAttemptsCount' = '-1'
'openIncompleteFiles' = 'true'
'pluginUpdateCheckInterval' = '1'
'pluginUpdateMethod' = '3'
'preCreateFile' = 'true'
'showInfoInFrameTitle' = 'true'
'showPercentProgress' = 'true'
'skipDuplicateFiles' = 'true'
'zoomCaptchaImage' = 'true'
}
foreach ($entry in $entries.Keys) {
$ent = ($entryTemplate -replace '%%key%%', $entry) -replace '%%value%%', $entries.Item($entry)
$ents += $ent
}
# Create file string
$finalFile = $start -join $delimeter
$finalFile += $ents -join $delimeter
$finalFile += $end -join $delimeter
# Set File
$FILE = "$env:AppData\VitySoft\FRD\frd.xml"
if (-not (Test-Path $FILE)) {
Write-Host 'File' $FILE 'does not exists. Creating.' -f Yellow
New-Item $FILE -Type File -Force | Out-Null
Set-Content $FILE $finalFile -Encoding Ascii -Force
}
shortcuts:
- - frd.bat
- Freerapid Downloader
- ''
- frd.ico
checkver:
url: https://wordrider.net/freerapid/download.htm
regex: Current version is\s*<em>FreeRapid Downloader ([\d\.]+\w+)
autoupdate:
url: https://www.wordrider.net/download/FreeRapid-$version.zip
extract_dir: FreeRapid-$version
@kiedtl
Copy link

kiedtl commented May 7, 2019

Definitely better than JSON manifests. But who's going to convert the JSON to YAML? An automated script, perhaps?

@Ash258
Copy link
Author

Ash258 commented May 7, 2019

Ofcourse.
Basicly this script https://github.com/Ash258/scoop-Ash258/blob/master/bin/convert.ps1
with additional body of

Set-Manifest "$name.yml" (Get-Manifest "$name.json")

@shoogle
Copy link

shoogle commented May 12, 2019

Looks good! I'd just suggest taking the opportunity to update the shortcuts syntax to something more descriptive, such as:

shortcuts:
  - name: Freerapid Downloader
    target: frd.bat
    icon: frd.ico
  - name: Another Shortcut
    target: prog.bat
    params: -F
    icon: Prog.ico

(Notice that a side benefit of this is that the params field is now truly optional: you don't need to specify a blank param just to get an icon.)

I'd do the same for bin and any other tags that use arrays inappropriately (i.e. where each array item is not of the same type, and they have special meaning based on solely on their position in the array).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment