Home

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

  1. Build from source yourself or get the prebuilt APK from the releases section.
  2. Install the APK and accept Play Protect Dialogs if any.
  3. Wait for the Python Binaries to get installed.
  4. Grant necessary permissions.
  5. AutoPie will try to download an init binary & configuration archive and extract it into the AutoSec directory. If it fails, you can download the autosec.tar.xz file and extract to the AutoSec folder.
  6. Optional: Disable Battery Optimization for AutoPie.

Usage

  1. Open AutoPie App
  2. There are currently two types of commands. Share Sheet Commands, Folder Observer Commands and Cron Commands.
  3. Add your desired Commands in the AutoPie App by clicking on Add Button or Edit an already existing command.

Troubleshooting

Command Format

PLACEHOLDERDESCRIPTION
${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

USECOMMAND
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

Support

Why

Thanks To

Jared Drummler