Skip to content

Instantly share code, notes, and snippets.

@TTTPOB
Created October 21, 2020 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TTTPOB/91843a618f5ea7d0d46dbf1897431ef9 to your computer and use it in GitHub Desktop.
Save TTTPOB/91843a618f5ea7d0d46dbf1897431ef9 to your computer and use it in GitHub Desktop.
auto genereate winget manifest yaml for calibre when specify version code; for my own use so...
import yaml
import os
import sys
versioncode = sys.argv[1]
url="https://download.calibre-ebook.com/" + versioncode + "/calibre-64bit-" + versioncode + ".msi"
os.system("aria2c -x16 --continue=true -o " + "calibre-64bit-" + versioncode + ".msi "+url)
hashval = os.popen("sha256sum calibre-64bit-"+versioncode+".msi"+" | cut -d\ -f1").read().strip()
manifest_dict = {
"Id": "calibre.calibre",
"Name": "calibre",
"Version": versioncode,
"Publisher": "calibre",
"License": "GNU General Public License v3.0",
"LicenseUrl": "https://github.com/kovidgoyal/calibre/blob/master/LICENSE",
"AppMoniker": "calibre",
"Tags": "ebook, calibre, kobo, kindle, epub, mobi",
"Description": "calibre is a powerful and easy-to-use e-book manager",
"Homepage": "https://calibre-ebook.com",
"Installers": [{
"Arch":
"x64",
"Url":
url,
"Sha256":
hashval,
"InstallerType":
"msi",
"Switches": {
"Silent": "/quiet /norestart",
"SilentWithProgress": "/passive /norestart"
}
}]
}
yaml=yaml.safe_dump(manifest_dict, open("t1.yaml", "w"), sort_keys=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment