Awesome
AutoPie
Create your own Commands and Run them on your Android without wasting time.
Lets you run Python scripts with or without included binaries on Android.
AutoPie is your own power tool-kit for android.
<div style="display:flex;flex-direction:row;justify-content:space-between"> <img src="https://github.com/user-attachments/assets/ee74f114-2d02-4c6f-8429-68398764c006" alt="AutoPie extras config" width="47%" height="auto"> <img src="https://github.com/user-attachments/assets/1e996b5f-02e5-46bd-9ff4-78bb886bd410" alt="AutoPie extras config" width="47%" height="auto"> </div>Installation
- Build from source yourself or get the prebuilt APK from the releases section.
- Install the APK and accept Play Protect Dialogs if any.
- Wait for the Python Binaries to get installed.
- Grant necessary permissions.
- AutoPie will try to download an init binary & configuration archive and extract it into the
AutoSec
directory. If it fails, you can download theautosec.tar.xz
file and extract to theAutoSec
folder. - Optional: Disable Battery Optimization for AutoPie.
Usage
- Open AutoPie App
- There are currently two types of commands.
Share Sheet Commands
,Folder Observer Commands
andCron Commands
. - Add your desired Commands in the AutoPie App by clicking on Add Button or Edit an already existing command.
Troubleshooting
- Check that the
AutoSec
folder containsobservers.json
for Folder Observation Automation,shares.json
for Share Sheet Configuration andcron.json
for Cron Configuration. And abin
folder with the binaries likeffmpeg
.
Command Format
PLACEHOLDER | DESCRIPTION |
---|---|
${INPUT_FILE} | Use it to pass input file path or url in the command |
${INPUT_FILES} | If multiple files are needed as input to the command<br/> Example : magick combine two images |
${FILENAME} | Filename without path |
${DIRECTORY} | Parent Directory of file |
${FILENAME_NO_EXT} | Filename without path and extension |
${FILE_EXT} | File extension |
${RAND} | Random 4 digit number |
${HOST} | URL host (Only available if the input is a URL) |
Example Commands
USE | COMMAND |
---|---|
Ffmpeg Extract Audio from Video | -i ${INPUT_FILE} -b:a 192K -vn ${INPUT_FILE}.mp3 |
ImageMagick combine horizontal | ${INPUT_FILES} +append ${INPUT_FILE}-horiz-${RAND}.jpeg |
This configuration enables you to automatically convert each screenshot you take into webp.
<div style="display:flex; flex-direction:row; width:100%; justify-content:center; align-items:center"> <img src="https://github.com/user-attachments/assets/af5a7cb2-0953-4886-97fb-d64a06289677" alt="AutoPie file observer example command" style="width:55%; height:auto"> </div>Custom Defined Command Arguments for Customization.
With AutoPie, you can define custom arguments called (extras) for commands.
This will show a card where you can input details to customize the behaviour of the command.
For Example,
Defining extra items such as options for codecs etc will look like this.
<div style="display:flex;flex-direction:row;justify-content:space-between"> <img src="https://github.com/user-attachments/assets/cb7c3010-5270-49a8-9854-1f19b17a6a27" alt="AutoPie extras config" width="47%" height="auto"> <img src="https://github.com/user-attachments/assets/25e2d5a9-bf40-4c23-85ae-8c4dfebe917a" alt="AutoPie extras how to" width="47%" height="auto"> </div>Commands and Package Repository
A repository where users can search and add pre-made AutoPie command snippets and install packages is in the works.
How do I create binaries for AutoPie.
AutoPie binaries are just thin python wrappers around binaries like ffmpeg
magick
etc.
Using Shiv to package the binaries, dependencies and python files is strongly recommended.
This is an example for how to include the ffmpeg
binaries and libraries in a single file with shiv.
A more detailed docs is in WIP.
import subprocess
import sys
import os
import shlex
script_dir = os.path.dirname(__file__)
# Set the path to the ImageMagick binary and library directories
bin_path = os.path.join(script_dir, 'usr', 'bin')
lib_path = os.path.join(script_dir, 'usr', 'lib')
# Update PATH environment variable
os.environ['PATH'] = bin_path + os.pathsep + os.environ['PATH']
# Update LD_LIBRARY_PATH environment variable
os.environ['LD_LIBRARY_PATH'] = lib_path + os.pathsep + os.environ.get('LD_LIBRARY_PATH', '')
def main():
"""Console script for ffmpeg wrapper"""
input_command = sys.argv[1]
commands_list = shlex.split(input_command)
runner(commands_list)
def runner(commands_list: list[str]):
try:
commands_list= ["ffmpeg"] + commands_list
print(f"shlex command list: {commands_list}")
result = subprocess.run(commands_list)
if result.returncode == 0:
print(f"Successfully executed {commands_list}")
else:
print(f"Subprocess failed with exit code {result.returncode} : {commands_list}")
sys.exit(result.returncode)
except Exception as e:
print(f"Unexpected error: {e}")
sys.exit(e.returncode)
if __name__ == "__main__":
main()
Build Instructions
You can build the app with prebuilt binaries by opening the project with Android Studio and then run build task.
If you want to build your own python and busybox binaries
- Set Environment Variable
ANDROID_NDK_ROOT
to your Android NDK installation folder. - Run the
./build-all.sh
script to build all dependencies and store them in the Assets folder.
Support
- Supports only aarch64/arm-v8 as of now. It should run on most newer phones.
Why
- Makes it easier to automate and run any task.
- Termux will be constrained in the future by Android Platform limitations.
- Needed to find an alternative method to Termux by including a whole Python installation in the APK itself that enables us to run scripts and binaries from anywhere on the storage.