2018-02-04 12:55:21 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
TOOLS="$(ls -d ${ANDROID_HOME}/build-tools/* | tail -1)"
|
|
|
|
|
|
|
|
mkdir -p repo/apk
|
|
|
|
mkdir -p repo/icon
|
|
|
|
|
2018-02-04 17:13:51 +00:00
|
|
|
cp -f apk/* repo/apk
|
2018-02-04 12:55:21 +00:00
|
|
|
|
|
|
|
cd repo
|
|
|
|
|
2020-11-13 00:22:02 +00:00
|
|
|
APKS=( ../apk/*".apk" )
|
2018-02-04 12:55:21 +00:00
|
|
|
|
|
|
|
for APK in ${APKS[@]}; do
|
|
|
|
FILENAME=$(basename ${APK})
|
2020-08-08 19:59:03 +00:00
|
|
|
BADGING="$(${TOOLS}/aapt dump --include-meta-data badging $APK)"
|
2018-02-04 12:55:21 +00:00
|
|
|
|
|
|
|
PACKAGE=$(echo "$BADGING" | grep package:)
|
2020-06-27 19:21:46 +00:00
|
|
|
PKGNAME=$(echo $PACKAGE | grep -Po "package: name='\K[^']+")
|
2018-02-04 12:55:21 +00:00
|
|
|
VCODE=$(echo $PACKAGE | grep -Po "versionCode='\K[^']+")
|
|
|
|
VNAME=$(echo $PACKAGE | grep -Po "versionName='\K[^']+")
|
2020-08-08 19:59:03 +00:00
|
|
|
NSFW=$(echo $BADGING | grep -Po "tachiyomi.extension.nsfw' value='\K[^']+")
|
2018-02-04 12:55:21 +00:00
|
|
|
|
|
|
|
APPLICATION=$(echo "$BADGING" | grep application:)
|
|
|
|
LABEL=$(echo $APPLICATION | grep -Po "label='\K[^']+")
|
|
|
|
|
|
|
|
LANG=$(echo $APK | grep -Po "tachiyomi-\K[^\.]+")
|
|
|
|
|
|
|
|
ICON=$(echo "$BADGING" | grep -Po "application-icon-320.*'\K[^']+")
|
|
|
|
unzip -p $APK $ICON > icon/${FILENAME%.*}.png
|
|
|
|
|
|
|
|
jq -n \
|
|
|
|
--arg name "$LABEL" \
|
|
|
|
--arg pkg "$PKGNAME" \
|
|
|
|
--arg apk "$FILENAME" \
|
|
|
|
--arg lang "$LANG" \
|
|
|
|
--argjson code $VCODE \
|
|
|
|
--arg version "$VNAME" \
|
2020-08-08 19:59:03 +00:00
|
|
|
--argjson nsfw $NSFW \
|
|
|
|
'{name:$name, pkg:$pkg, apk:$apk, lang:$lang, code:$code, version:$version, nsfw:$nsfw}'
|
2018-02-04 12:55:21 +00:00
|
|
|
|
2020-08-02 22:55:14 +00:00
|
|
|
done | jq -sr '[.[]]' > index.json
|
|
|
|
|
|
|
|
# Alternate gzipped copy
|
|
|
|
gzip -c index.json > index.json.gz
|
2020-06-27 19:21:46 +00:00
|
|
|
|
|
|
|
cat index.json
|