mirror of
https://github.com/danog/mklwp.git
synced 2024-11-26 20:15:26 +01:00
Let's do this
This commit is contained in:
parent
f88c11e6e2
commit
5e9272798b
@ -1 +1 @@
|
||||
27842
|
||||
26148
|
||||
|
@ -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
|
||||
|
@ -1,13 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<string-array name="size_names">
|
||||
<item>Big (Default)</item>
|
||||
<item>Medium</item>
|
||||
<item>Small</item>
|
||||
<item>Default size</item>
|
||||
</string-array>
|
||||
<string-array name="size_values">
|
||||
<item>480, 854</item>
|
||||
<item>480, 600</item>
|
||||
<item>320, 480</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -2,5 +2,5 @@
|
||||
<PreferenceScreen android:title="@string/settings_title"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<EditTextPreference android:title="@string/preference_fps_title" android:key="preference_fps" android:summary="@string/preference_fps_summary" android:defaultValue="20" />
|
||||
<ListPreference android:entries="@array/size_names" android:title="@string/preference_size_title" android:key="preference_size" android:summary="@string/preference_size_summary" android:defaultValue="320, 480" android:entryValues="@array/size_values" />
|
||||
</PreferenceScreen>
|
||||
<ListPreference android:entries="@array/size_names" android:title="@string/preference_size_title" android:key="preference_size" android:summary="@string/preference_size_summary" android:defaultValue="480, 854" android:entryValues="@array/size_values" />
|
||||
</PreferenceScreen>
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,13 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<string-array name="size_names">
|
||||
<item>Big (Default)</item>
|
||||
<item>Medium</item>
|
||||
<item>Small</item>
|
||||
<item>Default size</item>
|
||||
</string-array>
|
||||
<string-array name="size_values">
|
||||
<item>480, 854</item>
|
||||
<item>480, 600</item>
|
||||
<item>320, 480</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -2,5 +2,5 @@
|
||||
<PreferenceScreen android:title="@string/settings_title"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<EditTextPreference android:title="@string/preference_fps_title" android:key="preference_fps" android:summary="@string/preference_fps_summary" android:defaultValue="20" />
|
||||
<ListPreference android:entries="@array/size_names" android:title="@string/preference_size_title" android:key="preference_size" android:summary="@string/preference_size_summary" android:defaultValue="320, 480" android:entryValues="@array/size_values" />
|
||||
</PreferenceScreen>
|
||||
<ListPreference android:entries="@array/size_names" android:title="@string/preference_size_title" android:key="preference_size" android:summary="@string/preference_size_summary" android:defaultValue="480, 854" android:entryValues="@array/size_values" />
|
||||
</PreferenceScreen>
|
||||
|
@ -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;
|
||||
|
||||
|
39
run.sh
39
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
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user