Compare commits

...

6 Commits
main ... dev

3 changed files with 36 additions and 13 deletions

View File

@ -7,7 +7,7 @@ Hyperling's scripts for a productive Termux environment.
1. Download the repository.
```sh
git clone https://github.com/Hyperling/Termux termux
git clone https://git.hyperling.com/me/env-termux env-termux
```
1. Dive into the directory.

View File

@ -48,21 +48,38 @@ alias mv="mv -v"
alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'"
# Quickies
alias update="pkg update && pkg upgrade"
alias upgrade="update"
alias bye="exit"
alias goodbye="update -y && bye"
alias install="pkg install"
## Functions ##
function update {
params="$1"
echo "******* Apt *******" &&
echo "*** Update Cache ***" &&
apt update &&
echo -e "\n*** Auto Remove ***" &&
apt autoremove $params &&
echo -e "\n*** Clean ***" &&
apt clean $params &&
echo -e "Cleaned!\n\n*** Fix Broken/Missing ***" &&
apt --fix-broken --fix-missing install &&
echo -e "\n*** Upgrade ***" &&
apt dist-upgrade --allow-downgrades --fix-broken --fix-missing $params &&
echo -e "\n******* Mission Complete!! *******"
}
# Optimize the bitrate and audio levels for an edited video.
function process-video-usage {
echo "USAGE: process-video oldFile newFile [videoBitrate] [audioBitrate] [sizeRating]"
echo "USAGE: process-video oldFile newFile [videoBitrate] [audioBitrate] [sizeRating] [numPasses] [forceBitrate]"
echo -n "Purpose: Call ffmpeg with preferred video posting settings. "
echo -n "Bitrates default to 2000k and 192k, size is 720. "
echo -n "Bitrates default to 2000k and 192k, size is 720, passes is 1, and force is N."
echo "These work well on Odysee and are fairly small as backups."
echo "Examples:"
echo "- Create a small file for quick streaming."
echo "- Create a small file for quick streaming."
echo " process-video youcut.mp4 20240210.mp4 1200k 128k 480"
echo "- Create a larger file for something like YouTube."
echo " process-video youcut.mp4 20240210_1080p.mp4 5000k 256k 1080"
@ -75,6 +92,7 @@ function process-video {
audio="$4"
size="$5"
passes="$6"
force="$7"
# Validations
if [[ -z $file || ! -e $file ]]; then
@ -93,13 +111,17 @@ function process-video {
process-video-usage
return 1
fi
echo "`date` - Converting '$file' to '$newfile'."
if [[ -z $video ]]; then
video="2000k"
fi
video="-maxrate $video"
if [[ $force == "Y" ]]; then
video="-b:v $video"
else
video="-b:v $video -minrate 0 -maxrate $video -bufsize $video"
fi
if [[ -z $audio ]]; then
audio="192k"
@ -110,7 +132,7 @@ function process-video {
size="720"
fi
size="-filter:v scale=-1:$size"
if [[ -z $passes ]]; then
passes=1
fi
@ -138,7 +160,7 @@ function process-video {
return 1
fi
fi
set -x &&
ffmpeg -nostdin -hide_banner -loglevel quiet \
-i "$file" $size $video $audio \
@ -148,7 +170,7 @@ function process-video {
status="$?"
set +x
echo "`date` - Done with the final pass."
if [[ $passes == 2 && $status == 0 ]]; then
mv -v ffmpeg2pass*.log* ~/TRASH/
fi
@ -184,7 +206,8 @@ function commit {
# Otherwise can just source this file unless testing setup.sh.
function test-termux {
sh -c "rm -rf ~/termux-deleteme ~/TRASH/termux-deleteme" 2>/dev/null
git clone https://github.com/Hyperling/Termux ~/termux-deleteme --branch=dev
git clone https://git.hyperling.com/me/env-termux \
--branch=dev ~/termux-deleteme
chmod 755 ~/termux-deleteme/*.sh
~/termux-deleteme/setup.sh
}

View File

@ -29,7 +29,7 @@ fi
echo -e "\n`date` - Install Software"
pkg install -y \
openssh tsu vim htop git cronie man \
openssh tsu vim htop git cronie man zip \
nmap traceroute wget \
ffmpeg imagemagick \
kotlin php nodejs python libllvm
@ -64,7 +64,7 @@ ln -s ~/storage/shared/TRASH ~/TRASH
if [[ -n $DIR && $DIR != "/" && -d .git ]]; then
echo "We are in a git clone, remove the project."
cd ..
mv -v $DIR ~/TRASH/termux-"`date +'%Y%m%d%H%M%S'`" |
mv -v $DIR ~/TRASH/termux-"`date +'%Y%m%d%H%M%S'`" |
grep -v '/.git/'
else
echo "File was used individually, remove it."