env-ansible/files/scripts/compress_video.sh

275 lines
6.9 KiB
Bash
Raw Normal View History

#!/bin/bash
# 2023-06-13 Hyperling
# Compress a video to good-enough quality for high quality streaming.
## FFMpeg Notes ##
# 2024-02-08
# -af parameter comes from Cahlen Lee's recommendation:
# https://odysee.com/@HyperVegan:2/20240205_DesertSilence-Campfire:3?lc=a2439b26d9fe89a950e0a47ec1d110d7156f596843039b4b76a4a2f327afcd2f
## Setup ##
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
echo "Running '$DIR/$PROG'."
filename_flag='compressed'
date_YYYYMMDD="`date "+%Y%m%d"`"
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
large_extension='DoNotUse-LargerThanOriginal'
large_created=".$PROG.large_created.true"
## Functions ##
function usage {
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
echo -n "Usage: $PROG [-i file/folder] [-v bitrate] [-a bitrate] [-c vcodec]"
echo " [-s size] [-r] [-f] [-d] [-A] [-m] [-V] [-x] [-h]"
cat <<- EOF
Reduce the filesize of a video file to make it stream well. It also
helps with the file size for placing the file into a backup system.
Currently only set up for mp4 files.
Parameters:
-i input : The input file or folder with which to search for video files.
If nothing is provided, current directory (.) is assumed.
-v bitrate : The video bitrate to convert to.
Defaults to '2000k'.
-a bitrate : The audio bitrate to convert to.
Defaults to '192k'.
-c vcodec : The video codec you'd like to use, such as libopenh264.
-s size : The video size such as 1080 or 720, or1280 for vertical 720p.
Defaults to '720'.
-r : Recurse the entire directory structure, compressing all video files.
-f : Force recompressing any files by deleting it if it already exists.
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
-d : Delete the original video if the compressed version is smaller.
-A : Recursively Force and Delete.
-m : Measure the time it takes to compress each video and do the loop.
-V : Add verbosity, such as printing all the variable values.
-x : Set the shell's x flag to display every action which is taken.
-h : Display this help messaging.
EOF
exit $1
}
## Parameters ##
while getopts ":i:v:a:c:s:rfdAmVxh" opt; do
case $opt in
i) input="$OPTARG"
;;
v) video_bitrate="$OPTARG"
;;
a) audio_bitrate="$OPTARG"
;;
c) codec="$OPTARG"
;;
s) size="$OPTARG"
;;
r) search_command="find"
;;
f) force="Y"
;;
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
d) delete="Y"
;;
A) search_command="find" && force="Y" && delete="Y"
;;
m) time_command="`which time`"
;;
V) verbose="Y"
;;
x) set_x="Y"
;;
h) usage 0
;;
*) echo "ERROR: Option '$OPTARG' not recognized." >&2
usage 1
;;
esac
done
if [[ "$set_x" == "Y" ]]; then
set -x
fi
if [[ -z "$input" ]]; then
echo "WARNING: Program was not passed an input. Using current directory." >&2
input="."
fi
if [[ -z "$video_bitrate" ]]; then
video_bitrate="2000k"
fi
video_bitrate="-maxrate $video_bitrate"
if [[ -z "$audio_bitrate" ]]; then
audio_bitrate="192k"
fi
audio_bitrate="-b:a $audio_bitrate"
if [[ -z "$codec" ]]; then
codec=""
else
codec="-vcodec $codec"
fi
if [[ -z "$search_command" ]]; then
search_command="ls"
fi
if [[ -z "$time_command" ]]; then
time_command=""
else
time_command="$time_command -p"
fi
if [[ -z $size ]]; then
size="720"
fi
size="-filter:v scale=-1:$size"
## Main ##
if [[ "$verbose" == "Y" ]]; then
cat <<- EOF
VERBOSE: Full list of variables.
input='$input'
video_bitrate='$video_bitrate'
audio_bitrate='$audio_bitrate'
codec='$codec'
search_command='$search_command'
force='$force'
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
delete='$delete'
time_command='$time_command'
verbose='$verbose'
set_x='$set_x'
filename_flag='$filename_flag'
date_YYYYMMDD='$date_YYYYMMDD'
SECONDS='$SECONDS'
EOF
fi
SECONDS=0
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
$search_command "$input" | sort | while read file; do
echo -e "\n$file"
if [[ -n "$time_command" ]]; then
date
fi
typeset -l extension_lower
extension="${file##*.}"
extension_lower="$extension"
# Exception checks for the existing file.
if [[ "$extension_lower" != "mp4" ]]; then
echo "SKIP: Not an MP4."
continue
fi
if [[ "$file" == *"$filename_flag"* ]]; then
echo "SKIP: Input is already compressed."
continue
fi
# Build the new filename to signify it is different than the original.
newfile="${file//$extension/$filename_flag-$date_YYYYMMDD.$extension_lower}"
if [[ $newfile == $file ]]; then
echo "ERROR: The new calculated filename matches the old, skipping." >&2
continue
fi
# More exception checks based on the new file.
if [[ -e "$newfile" ]]; then
if [[ "$force" == "Y" ]]; then
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
echo "FORCE: Removing '$newfile'."
if [[ -d ~/TRASH ]]; then
mv -v "$newfile" ~/TRASH/
else
rm -v "$newfile"
fi
else
echo "SKIP: Already has a compressed version ($newfile)."
continue
fi
fi
# Convert the file.
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
echo "Converting to '$newfile'."
echo "*** `date` ***"
set -x
$time_command bash -c "ffmpeg -nostdin -hide_banner -loglevel quiet \
-i '$file' $size $video_bitrate $audio_bitrate \
-af 'dynaudnorm=f=33:g=65:p=0.66:m=33.3' \
$vcodec -movflags +faststart \
'$newfile'"
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
status="$?"
set +x
echo "*** `date` ***"
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
if [[ "$status" != 0 ]]; then
echo "SKIP: ffmpeg returned a status of '$status'."
continue
fi
# Check the filesize compared to the original and note if it is larger.
echo "Checking file sizes:"
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
ls -sh "$file" "$newfile" | sort -hr
Fixes and Enhancements (#48) * Fix metasplot install if /usr/local/bin is not active in path yet. Also use variables. * Use plocate on openSUSE. Supposed to be faster. Cannot have both m and p installed at the same time and p comes with the base system. * Include wheel group for user as well. * Finalize GNOME settings, go with RC commands instead of dconf module. * Add hostname to report files. * Add TBD for shared home situation. * Fix cron service for Fedora. * Disable the power button. * Fix Fedora ffmpeg issues. Move package modules from flatpak playbook. Uninstall firefox from package manager. * Enhance update function to handle shared home between multiple distributions. * Allow keeping local backups of files. * Replace flatpak repair check with accept flag instead of battery so that any automated update runs do the cleanup. * Begin hoarding settings files. * Start building out a FireFox profile. * Fix extra comment command in comment. * Add an All option to completely compress the entire directory. * Codium is still broken on all tested systems, hide from Favorites. * Add scipt to handle audio files. Also can convert to 432Hz. * Use cut instead of awk to get rid of first parameter. Fixes bugs when spaces are allowed in the filenames. * Enhancements and bugfix for "$freq". * Add playbook for desktop VPN clients. Start with Mullvad. * Add website to the seeded projects. * Add firmware updates to the update function. * Allow `fwupdmgr` to fail and have `update` still continue. * Shorten lines. * Uninstall DeltaChat. * Separate the firmware update into its own function. * Add alias for cloning one folder to another without using rm/cp. * Fix typo in rsync. * Go ahead and add extra options. * Make the files human readable size descriptions. * Remove unnecessary v, P does good enough.
2024-01-23 09:43:42 -07:00
smaller_file=`ls -sh "$file" "$newfile" | sort -h | cut -f 2- -d ' ' | head -n 1`
if [[ "$smaller_file" == "$file" ]]; then
echo -n "Conversion had the opposite effect, original was likely lesser "
echo "quality. Adding a suffix to the file to signify that it grew."
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
mv -v "$newfile" "$newfile.$large_extension"
continue
fi
if [[ -e "$newfile" ]]; then
echo "Conversion succeeded, file has been compressed."
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
else
echo "ERROR: Converted file '$newfile' could not be found. Aborting." >&2
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
break
fi
if [[ -n "$delete" ]]; then
echo -n "Original has been deleted: "
if [[ -d ~/TRASH ]]; then
mv -v "$file" ~/TRASH/
else
rm -v "$file"
fi
fi
done
General Enhancements, NixOS Support (#47) * Begin adding Nix. * Install LBRY from Nix since its Flatpak is no longer supported.. * Got the global install to work, now just figuring out why LBRY won't work. * Add alias to blow away dev branch and start back up from remote or main. * Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems. * Start working on having a path for NixOS. * Add NixOS. * Skip the installer portion if using NixOS. * Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix. * This should have never been added. Was an accident if it snuck though. * Test using env rather than hard-coded bash path. * Use variables, start thinking about future. * Add file to manage setting up NixOS for the first or any subsequent times. * Use the new nixos.sh script. * Ensure /usr/local/bin is in PATH. * Do not use * inside of "" for ls. * Add filename cleanup shortcut. * Add a clean option as well as a few bugfixes and checking that convert is installed. * Use underscores in filenames and remove plurality. * Bring the file into better column compliance. * Stop running the dconf psutil failures against NixOS for now. * Ensure the old names of scripts are removed from bin. * Clean filename fixes as well as a traversing version. * Remove extra spacing. * Begin adding swapfile creation. * Add dangerous code reset command. * Add some cleaning for NixOS package manager. * The ~ was being taken literally and created as a new folder. * More work on swap files, and a new ansible.nix file. * Fix the swap confuration line. * Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence. * Reorder and enhance the update function for NixOS. * Add comment. * Start working on dconf for NixOS since don't have home-manager working yet in configration.nix. * Add notes. * If the file was created, make sure the user owns it and can edit by default. * Favorites are working and only need maintained in one place! :) * Add .zshrc for GNOME settings on NixOS. * Add most other settings that are done manually post-install. Report any failures with their placement. * FINALLY! Keyboard shortcuts and some final Gnome Tweak settings! * Add night light settings. * Move around some comments. * Pull first then deal with any merge issues, rather than trying to push when there are things to pull. * Test removing the dconf commands for non-NixOS. * Alter output; remove extra newlines and add cache verbosity. * dconf in rc files is working on Ubuntu! * Add delete. Fix filename quotes. Other enhancements. * Create new folder chain if clean changed directory names. * Add TBD about changing the directory structure. * Only say success if the file really exists. Skip if conversion fails. * Only say success if the file really exists. Skip if conversion fails. * Add quotes around dirname. * Add quotes around the entire directory tree. * Add quotes to comment in case it ever gets used. * Add a bittorrent client. * Disable Bluetooth on all devices, it's normally off anyways. * Fix comments, this enables not disables. * Create new services report. * Add services report to main area and move all reports to NixOS area. * Fix swap file variable name for non-NixOS distros. * Add godot editor. * Re-add extra programs Geary and OpenShot for variety. * Shorten the output for 80 char terminals. * Add Code-OSS for when Codium is having issues. * Allow code-oss to be installed. * Add the full desktop entry for Code-OSS. * Ansible handles the newlines, prevent the -e from getting into the file. * Enhance newlines in nmap report. * Add NixOS.
2023-10-17 04:30:36 -07:00
# If large files do end up being created, allow the user to bulk delete them.
if [[ -e "$large_created" ]]; then
echo -e "\n*********************************************************"
echo -e "WARNING: The files below are larger than their originals!\n"
find "$input" -name "*"$large_extension
echo -e "*********************************************************"
echo -en "\nWould you like to delete them? (Y/n): "
typeset -u confirm_delete
read confirm_delete
if [[ -z "$confirm_delete" || "$confirm_delete" == "Y"* ]]; then
echo ""
find "$input" -name "*"$large_extension -exec rm -v {} \;
else
echo -e "\nKeeping files. Please use this if you change your mind:"
echo " find \"$input\" -name \"*\"$large_extension -exec rm -v {} \;"
fi
rm "$large_created"
fi
echo -e "\nDone!"
# Display elapsed time
if [[ -n "$time_command" ]]; then
date
typeset -i hours minutes seconds
hours=$(( SECONDS / 3600 ))
minutes=$(( (SECONDS % 3600) / 60 ))
seconds=$(( SECONDS % 60 ))
echo "Loop Performance: ${hours}h ${minutes}m ${seconds}s"
fi
exit 0