From 5893e7c6e66ecdbe9927161e37507f75e94617ca Mon Sep 17 00:00:00 2001 From: Yuxin Wu Date: Wed, 29 Nov 2017 02:33:15 -0800 Subject: [PATCH] update docs --- android-interact.sh | 17 +++++++++++------ count-message.sh | 6 +++--- list-chats.py | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/android-interact.sh b/android-interact.sh index 799eddf..563c5f8 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -1,6 +1,6 @@ #!/bin/bash # File: android-interact.sh -# Date: Fri Jun 26 10:38:07 2015 +0800 +# Date: Wed Nov 29 02:19:00 2017 -0800 # Author: Yuxin Wu PROG_NAME=`python -c "import os, sys; print(os.path.realpath(sys.argv[1]))" "$0"` @@ -31,7 +31,7 @@ elif [[ $1 == "imei" ]]; then imei=$(adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed 's/[^0-9A-F]*//g' | tr -d '\n') } [[ -n $imei ]] || { - >&2 echo "Failed to get imei. You can try other methods, or report a bug." + >&2 echo "Failed to get imei. You can try other methods mentioned in README, or report a bug." exit 1 } echo "Got imei: $imei" @@ -51,12 +51,17 @@ elif [[ $1 == "db" || $1 == "res" ]]; then echo "Found $numUser user(s). User chosen: $chooseUser" if [[ $1 == "res" ]]; then - echo "Pulling resources... this might take a long time, because adb sucks..." mkdir -p resource; cd resource + echo "Pulling resources... " for d in avatar image2 voice2 emoji video sfs; do - mkdir -p $d; cd $d - adb pull "$RES_DIR/$chooseUser/$d" - cd .. + adb shell "cd $RES_DIR/$chooseUser && + busybox tar czf - $d 2>/dev/null | busybox base64" | + base64 -di | tar xzf - + + # Old Slow Way: + # mkdir -p $d; cd $d + # adb pull "$RES_DIR/$chooseUser/$d" + # cd .. [[ -d $d ]] || { >&2 echo "Failed to download resource directory: $RES_DIR/$chooseUser/$d" exit 1 diff --git a/count-message.sh b/count-message.sh index 3e8d42f..4d885dd 100755 --- a/count-message.sh +++ b/count-message.sh @@ -1,6 +1,6 @@ #!/bin/bash -e # File: count-message.sh -# Date: Sun Apr 12 21:01:01 2015 +0900 +# Date: Wed Nov 29 02:32:40 2017 -0800 # Author: Kangjing Huang @@ -11,7 +11,7 @@ then fi # TODO work on db directly -echo -e "Filename\tCounts of message\tCounts of chars\tCounts of words" +echo -e "Filename\t#Lines\t#Chars\t#Words" SAVEIFS=$IFS IFS=$(echo -en "\n\b") @@ -23,6 +23,6 @@ do CHARCOUNT=$(cat "$i"| sed 's/.*:[0-9][0-9]:\(.*\)/\1/g' | sed 's/\[.*\]//g' | grep -v img | wc -m) WORDCOUNT=$(cat "$i"| sed 's/.*:[0-9][0-9]:\(.*\)/\1/g' | sed 's/\[.*\]//g' | grep -v img | wc -w) echo -e "$LINECOUNT\t$CHARCOUNT\t$WORDCOUNT" -done +done | sort -t $'\t' -k 2 -n | column -t -s $'\t' IFS=$SAVEIFS diff --git a/list-chats.py b/list-chats.py index cc08447..e68fbd4 100755 --- a/list-chats.py +++ b/list-chats.py @@ -14,4 +14,4 @@ db_file = sys.argv[1] parser = WeChatDBParser(db_file) chats = parser.msgs_by_chat.keys() for k in chats: - print parser.contacts[k], '\t', k + print parser.contacts[k], '\t', k