File: fetch_devices.sh

package info (click to toggle)
googleplay-api 0.4.4%2Bgit20200310-3
  • links: PTS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,624 kB
  • sloc: python: 836; sh: 22; makefile: 7
file content (33 lines) | stat: -rwxr-xr-x 856 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

REPO_SRC="https://github.com/yeriomin/play-store-api"
REPO_LOCAL="/tmp/psapi"
RES_DIR="${REPO_LOCAL}/src/main/resources"

DEVS_FILE="./gpapi/device.properties"

command -v git >/dev/null 2>&1 || { echo "git not installed"; exit 1; }

if [ ! -d "./gpapi" ]; then
        echo "No gpapi dir found! Make sure you're in googleplay-api root dir"
        exit 1
fi

echo "==> Cloning play-store-api repo into $REPO_LOCAL"
git clone $REPO_SRC $REPO_LOCAL &>/dev/null

# clean device.properties file
echo "" > $DEVS_FILE

for dev in `ls $RES_DIR`; do
        FILE="$RES_DIR/$dev"
        NAME=`echo $dev | sed -e "s/device-\(.*\).properties/\1/"`
        echo "==> appending device data for $NAME"
        echo "[$NAME]" >> $DEVS_FILE
        cat $FILE >> $DEVS_FILE
        echo "" >> $DEVS_FILE
done

# cleanup
echo "==> Cleanup"
rm -rf $REPO_LOCAL