Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use APKMirror's MD5 pre-check for duplicates #402

Merged
merged 4 commits into from Dec 19, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -186,9 +186,14 @@ if [ -n "$newapks" ]; then
case "$REPLY" in
y*|Y*)
for apk in $newapks; do
echo "Uploading $apk to APKmirror.com..."
filename="$(basename "$apk")"
curl -s -S -X POST -F "fullname=$name (OpenGApps.org)" -F "email=$email" -F "changes=" -F "file=@$apk;filename=$filename" "http://www.apkmirror.com/wp-content/plugins/UploadManager/inc/upload.php" > /dev/null
upload=$(curl -s -S "http://www.apkmirror.com/wp-json/apkm/v1/apk_uploadable/$(md5sum "$apk"|cut -f1 -d' ')" | grep uploadable)
Copy link
Member

@mfonville mfonville Dec 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use spaces for the cut parameters:
cut -f 1 -d ' '
(to be fully compliant with some older/stricter versions of it)
it is also often more readable to keep space around the pipe

also best to pass the -q to grep, to keep it silent if matching, or not; and " around the keyword

if [ -z "$upload" ]; then
echo "Skipping $apk, already exists on APKmirror.com..."
else
echo "Uploading $apk to APKmirror.com..."
filename="$(basename "$apk")"
curl -s -S -X POST -F "fullname=$name (OpenGApps.org)" -F "email=$email" -F "changes=" -F "file=@$apk;filename=$filename" "http://www.apkmirror.com/wp-content/plugins/UploadManager/inc/upload.php" > /dev/null
fi
done
;;
*) echo "Did NOT submit to APKmirror.com";;