by Alex Stoyanov
📢This flow starts a termux session and runs a command.
To easily setup Termux from a clean install, run the setup flow. If there is an error with the update, use "pkg upgrade -y" in the first variable.
The defaults show off a very smooth setup process with good examples of how Termux can be utilized from AutoMate, without the use of the tasker plugin. Almost every part of the flow is extremely reusable. I have also shown 2 ways of inputting commands and arguments to Termux. I prefer the method in the setup flow, since it can be used to pass entire scripts to Termux.
The default command is the yt-dlp (youtube-dlp) command, which takes a URL to a YouTube video, downloads the video, and extracts the audio at the best possible quality in "flac" format. The default URL is for the song "Opiate²" by Tool.
The default music_folder is set to a folder named "Music" on an SD card. You can change that path to any editable storage location. The path itself is specified via a relative path from the home folder to avoid any inconsistencies in SD card naming. For this to work, the termux-setup-storage command must have been run in advance.
✴️Any command can be specified instead of yt-dlp.
• Latest version of Termux from F-Droid
• allow-external-apps permission set to true:
echo "allow-external-apps = true" >> ~/.termux/termux.properties
• "Run commands in Termux environment" permission set to true in automate permissions
• display over other apps turned on for termux
❕OPTIONAL (required for default code, covered in setup flow):
pkg install python ffmpeg
pip install yt-dlp
• storage access:
• battery saver turned off for termux
❤️Huge thanks to Micha on discord (leaving out the full tag for their privacy) for helping me figure out the syntax on the start service block
(PS paste the contents of the clipboard set block after the args in the run service block to run the command in the background. Not recommended if you want to be able to see the progress or results of the command)
Rate and review within the app in the Community section.