From 5e9272798b5786ebc1b92cfa3b560e8faf0381c9 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 23 Jan 2016 17:19:32 +0100 Subject: [PATCH] Let's do this --- CO101374607/pid | 2 +- bashbot.sh | 6 +-- other/backup/res/values/arrays.xml | 8 +--- other/backup/res/xml/settings.xml | 4 +- .../LiveWallpaperPainting$OutRunEngine.smali | 2 +- out/res/values/arrays.xml | 8 +--- out/res/xml/settings.xml | 4 +- .../LiveWallpaperPainting$OutRunEngine.smali | 2 +- run.sh | 39 +++++++++++++------ 9 files changed, 41 insertions(+), 34 deletions(-) diff --git a/CO101374607/pid b/CO101374607/pid index 97ad71d..08ef957 100644 --- a/CO101374607/pid +++ b/CO101374607/pid @@ -1 +1 @@ -27842 +26148 diff --git a/bashbot.sh b/bashbot.sh index d5545ff..27d3b1a 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -12,7 +12,6 @@ # This file is public domain in the USA and all free countries. # If you're in Europe, and public domain does not exist, then haha. -TOKEN='tokenhere' URL='https://api.telegram.org/bot'$TOKEN FORWARD_URL=$URL'/forwardMessage' @@ -51,7 +50,7 @@ send_message() { local sent=y fi if [ "$file" != "" ]; then - send_file "$chat" "$file" + send_file "$chat" "$file" "$text" local sent=y fi if [ "$lat" != "" -a "$long" != "" ]; then @@ -125,7 +124,7 @@ send_file() { esac send_action $chat_id $STATUS res=$(curl -s "$CUR_URL" -F "chat_id=$chat_id" -F "$WHAT=@$file" -F "caption=$3") - # rm -rf $(dirname $file) + rm -rf $(dirname $file) } # typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location @@ -149,6 +148,7 @@ forward() { startproc() { mkdir -p "$copname" mkfifo $copname/out + tmux kill-session -t $copname tmux new-session -d -s $copname "./run.sh bashbot ${USER[ID]} &>$copname/out" local pid=$(ps aux | sed '/tmux/!d;/'$copname'/!d;/sed/d;s/'$USER'\s*//g;s/\s.*//g') echo $pid>$copname/pid diff --git a/other/backup/res/values/arrays.xml b/other/backup/res/values/arrays.xml index 87bd911..66122da 100644 --- a/other/backup/res/values/arrays.xml +++ b/other/backup/res/values/arrays.xml @@ -1,13 +1,9 @@ - Big (Default) - Medium - Small + Default size 480, 854 - 480, 600 - 320, 480 - \ No newline at end of file + diff --git a/other/backup/res/xml/settings.xml b/other/backup/res/xml/settings.xml index 7164f5f..df8bc43 100644 --- a/other/backup/res/xml/settings.xml +++ b/other/backup/res/xml/settings.xml @@ -2,5 +2,5 @@ - - \ No newline at end of file + + diff --git a/other/backup/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali b/other/backup/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali index 0ae164c..d038b0b 100644 --- a/other/backup/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali +++ b/other/backup/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali @@ -62,7 +62,7 @@ iput v6, p0, Lcom/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine;->fps:I .line 281 - const-string v0, "320, 480" + const-string v0, "480, 854" iput-object v0, p0, Lcom/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine;->size:Ljava/lang/String; diff --git a/out/res/values/arrays.xml b/out/res/values/arrays.xml index 87bd911..66122da 100644 --- a/out/res/values/arrays.xml +++ b/out/res/values/arrays.xml @@ -1,13 +1,9 @@ - Big (Default) - Medium - Small + Default size 480, 854 - 480, 600 - 320, 480 - \ No newline at end of file + diff --git a/out/res/xml/settings.xml b/out/res/xml/settings.xml index 7164f5f..df8bc43 100644 --- a/out/res/xml/settings.xml +++ b/out/res/xml/settings.xml @@ -2,5 +2,5 @@ - - \ No newline at end of file + + diff --git a/out/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali b/out/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali index 0ae164c..d038b0b 100644 --- a/out/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali +++ b/out/smali/com/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine.smali @@ -62,7 +62,7 @@ iput v6, p0, Lcom/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine;->fps:I .line 281 - const-string v0, "320, 480" + const-string v0, "480, 854" iput-object v0, p0, Lcom/custom/lwp/suvbsib/LiveWallpaperPainting$OutRunEngine;->size:Ljava/lang/String; diff --git a/run.sh b/run.sh index 34c64ec..ad9e3f2 100755 --- a/run.sh +++ b/run.sh @@ -6,7 +6,7 @@ rm -rf out &>/dev/null cp -a other/backup out first=$2 [ "$1" = "bashbot" ] && { - error() { cd /tmp; rm -rf /tmp/$first; echo "I'm sorry, it seems an error occurred ($*). Please type /start to restart the process."; } + error() { cd /tmp; rm -rf /tmp/$first; echo "I'm sorry, it seems an error occurred ($*). Please type /start to restart the process."; sleep 2;exit; } mktmpdir() { rm -rf /tmp/$1 &>/dev/null; cp -a $PWD /tmp/$1; cd /tmp/$1; } echo "Custom LWP 2.6 Thanks : andrew121 for the app this script modifies @@ -16,6 +16,14 @@ Send me the app icon (preferrably square)." mktmpdir $2 || error "couldn't create tmp dir" read icon convert $icon placeimages/icon.png || error "couldn't download icon" + + echo "Send me a screenshot of this chat or your device's screen size." + read size + echo "$size" | grep -q http && { + screensize=$(identify $size | awk '{print $3}') + } || { + screensize=$size + } weird=y while [ "$weird" = "y" ];do echo "Do you want to create this live wallpaper using mykeyboardstartshere \"1. A video\" \"2. Multiple images\"" @@ -24,9 +32,10 @@ Send me the app icon (preferrably square)." "1. A video") echo "Send me the video itself or the video's url." read video + video=$(echo "$video" | sed 's/^\s*//g;s/\s*$//g') basename=$(basename $video) echo "Downloading the video..." - wget $video -qO $basename || error "couldn't download video" + wget "$video" -qO $basename || error "couldn't download video" echo "Getting frame number..." frames=$(ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 $basename -loglevel panic) @@ -62,10 +71,9 @@ Place images in the placeimages/images folder and place the app icon in placeima Make sure the images are the same resolution as your device for optimal results You can use up to 300 images (n01.png...n300.png) The images must be in png format. -Press enter when you're done." - read +Please enter your device's screen size (example: 1980x1280)." + read screensize } - echo "Enter the name for this live wallpaper. This is shown in the lwp choice menu. " read name name=$(printf "%q" "$name") @@ -81,20 +89,21 @@ pkgname=$(printf "%q" "$pkgname") n=0 p=0 -for f in placeimages/images/*;do n=$(($n+1)); [ "$n" = 10 ] && p=; cp $f "out/res/drawable-hdpi-v4/n"$p$n".png";done +for f in placeimages/images/*;do n=$(($n+1)); [ "$n" = 10 ] && p=; convert $f -resize $screensize "out/res/drawable-hdpi-v4/n"$p$n".png";done n=$(printf "%x" $n) counter=1 placeholder=0 +screensize="s/480, 854/$(echo "$screensize" | sed 's/x/, /g')/g" until [ $counter = 301 ]; do [ ! -f "out/res/drawable-hdpi-v4/n$placeholder"$counter".png" ] && cp "other/ph.png" "out/res/drawable-hdpi-v4/n$placeholder"$counter".png" counter=$(($counter + 1)) [ $counter = 10 ] && placeholder= done - -sed 's/suvbsib/'$pkgname'/g' -i out/smali/com/custom/lwp/suvbsib/*.smali out/res/xml/wallpaper.xml out/AndroidManifest.xml +sed -i 's/suvbsib/'$pkgname'/g' out/smali/com/custom/lwp/suvbsib/*.smali out/res/xml/*.xml out/AndroidManifest.xml out/res/values/*.xml +sed -i "$screensize" out/smali/com/custom/lwp/suvbsib/*.smali out/res/xml/*.xml out/AndroidManifest.xml out/res/values/*.xml mv out/smali/com/custom/lwp/suvbsib out/smali/com/custom/lwp/$pkgname sed -i 's/appname/'$name'/g' out/AndroidManifest.xml @@ -105,12 +114,12 @@ sed -i 's/const\/16 v1, 0x31/const\/16 v1, 0x'$n'/g' out/smali/com/custom/lwp/$p for f in out/res/drawable-*; do cp placeimages/icon.png $f;done echo " -Building Apk" +Building Apk..." cd other java -jar apktool.jar b ../out "$pkgname-unsigned.apk" echo " -Signing Apk" +Signing Apk..." java -jar signapk.jar -w testkey.x509.pem testkey.pk8 "$pkgname-unsigned.apk" "$pkgname-signed.apk" rm "$pkgname-unsigned.apk" @@ -126,8 +135,14 @@ Ur device must be connected to ur pc and adb must be in ur PATH (y/n). " -n 1 -r [[ $REPLY =~ ^[Yy]$ ]] && adb install -r $pkgname"-signed.apk" echo } || { - echo "myfilelocationstartshere $PWD/$pkgname"-signed.apk - sleep 3 + echo "Sending apk... +Thanks for having used mklwp! To restart the process type /start. +Remember to set the correct resolution of your lwp by going in the lwp settings and setting the default resultion. +This bot is based on https://github.com/topkecleon/telegram-bot-bash +You can also contribute to the development by sending a pull request @ https://github.com/danog/mklwp +There U go myfilelocationstartshere $PWD/$pkgname"-signed.apk + + sleep 10 };