Closed Azathothas closed 2 days ago
Nope, it was asked by another developer that wanted to create an electron frontend for AM and tht is disappeared.
So I don't really need that file anymore. I also disabled its update in my workflow because useless at this point.
Hmm. I see. Seems like I have to parse shell scripts directly
Didn't get everything, sadly.
Is there a way to list pkg_name + description + version + url?
am -q --all
That only lists name and description
Nope, this is a simple list with just appname and description. This is all the user needs to know.
In addition, -a
gives a more complete description, with URL, and -d
allows the download of the script, so the user can see exactly what the script will download and istal, and how the version can be obtained.
About apps version, it is always the latest one.
Hmm, seems like no way, without installing everything. No easy for machines to parse any data... For instance to just get the pkg name:
am -q --appimages | sed -n 's/.* ◆ \(.*\) :.*/\1/p'
As it's all formatted
am -q --appimages | sed -n 's/.* ◆ \(.*\) :.*/\1/p'
you forgot the argument
do you mean -l
?
am -l --appimages | sed -n 's/.* ◆ \(.*\) :.*/\1/p'
In my testing, I found -q to be faster than -l
$ time am -l --appimages | sed -n 's/.* ◆ \(.*\) :.*/\1/p' | wc -l
2121
real 0m1.726s
user 0m2.707s
sys 0m1.979s
$ time am -q --appimages | sed -n 's/.* ◆ \(.*\) :.*/\1/p' | wc -l
2121
real 0m1.717s
user 0m2.701s
sys 0m2.015s
I finally managed to generate one, but it's very slow process https://pub.ajam.dev/temp/AM.json
am -q --appimages | sed -n 's/.* ◆ \(.*\) :.*/\1/p' | xargs -I{} am -a "{}" | awk '
function escape_json(s) {
gsub(/\\/, "\\\\", s)
gsub(/"/, "\\\"", s)
gsub(/\n/, "\\n", s)
return s
}
function trim(s) {
sub(/^[ \t]+/, "", s)
sub(/[ \t]+$/, "", s)
return s
}
/^ PACKAGE:/ { pkg = substr($0, index($0, $2)) }
/^ STATUS:/ { status = $NF }
/^ / && $1 !~ /^(PACKAGE:|STATUS:|DOCUMENTATION:|SOURCE:|SITE:)/ {
desc = (desc == "" ? substr($0, 2) : desc " " substr($0, 2))
}
/^ SOURCE:/ { source = substr($0, index($0, $2)) }
/^ SITE:/ { site = substr($0, index($0, $2)) }
/^-+$/ {
if (length($0) > 15 && pkg != "" && desc != "") {
final_site = (source ~ /github\.com/ ? source : site)
print "{ \"pkg\": \"" escape_json(pkg) "\", \"description\": \"" escape_json(trim(desc)) "\", \"site\": \"" escape_json(trim(final_site)) "\" }"
}
pkg = desc = site = source = ""
}' | sed 's/\\"//g' | sed 's/[[:space:]]\+/ /g' | tee "./AM.json.tmp"
jq -s 'map(select(.pkg != null and .description != null and .site != null))' "./AM.json.tmp" > "./AM.json"
The two missing entries probably got purged due to some of the filter
$ jq -r '.[].pkg' "./AM.json" | sort -u | wc -l
2119
This will likely break if AM changes the way it prints stuff to the screen.
Hopefully one day there would be no need to parse shell scripts, and use something reliable like json.
If nothing, this will increase speed by at least 2x-3x, when using am -q | -l
Hi, I noticed https://github.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/blob/main/apps.json, but this contains no source url i.e the
SITE=
orversion=
from your scripts Any interest in completing that list and also including thesource_url
?