2023-06-25 15:00:59 -07:00
|
|
|
#!/bin/bash
|
|
|
|
# 2023-06-13 Hyperling
|
|
|
|
# Compress a video to good-enough quality for high quality streaming.
|
|
|
|
|
2024-05-16 10:00:49 -07:00
|
|
|
## FFMpeg Notes ##
|
|
|
|
# 2024-02-08
|
|
|
|
# -af parameter comes from Cahlen Lee's recommendation:
|
|
|
|
# https://odysee.com/@HyperVegan:2/20240205_DesertSilence-Campfire:3?lc=a2439b26d9fe89a950e0a47ec1d110d7156f596843039b4b76a4a2f327afcd2f
|
|
|
|
|
2023-09-01 06:01:01 -07:00
|
|
|
## 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'."
|
2023-06-25 15:00:59 -07:00
|
|
|
|
2023-09-01 06:01:01 -07:00
|
|
|
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"
|
2023-09-01 06:01:01 -07:00
|
|
|
|
2023-07-04 16:07:54 +00:00
|
|
|
## Functions ##
|
|
|
|
|
2023-06-25 15:00:59 -07:00
|
|
|
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]"
|
2024-05-16 10:00:49 -07:00
|
|
|
echo " [-s size] [-r] [-f] [-d] [-A] [-m] [-V] [-x] [-h]"
|
2023-08-22 04:42:22 +00:00
|
|
|
cat <<- EOF
|
2023-07-04 16:07:54 +00:00
|
|
|
Reduce the filesize of a video file to make it stream well. It also
|
2023-06-25 15:00:59 -07:00
|
|
|
helps with the file size for placing the file into a backup system.
|
2023-07-04 16:07:54 +00:00
|
|
|
Currently only set up for mp4 files.
|
2023-08-22 04:42:22 +00:00
|
|
|
|
2023-06-25 15:00:59 -07:00
|
|
|
Parameters:
|
2023-08-22 04:42:22 +00:00
|
|
|
-i input : The input file or folder with which to search for video files.
|
2023-06-25 15:00:59 -07:00
|
|
|
If nothing is provided, current directory (.) is assumed.
|
2024-05-16 10:00:49 -07:00
|
|
|
-v bitrate : The video bitrate to convert to.
|
|
|
|
Defaults to '2000k'.
|
|
|
|
-a bitrate : The audio bitrate to convert to.
|
|
|
|
Defaults to '192k'.
|
2023-07-04 16:07:54 +00:00
|
|
|
-c vcodec : The video codec you'd like to use, such as libopenh264.
|
2024-05-16 10:00:49 -07:00
|
|
|
-s size : The video size such as 1080 or 720, or1280 for vertical 720p.
|
|
|
|
Defaults to '720'.
|
2023-06-26 06:58:09 -07:00
|
|
|
-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.
|
2024-05-16 10:00:49 -07:00
|
|
|
-A : Recursively Force and Delete.
|
2023-07-04 16:07:54 +00:00
|
|
|
-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.
|
2023-06-25 15:00:59 -07:00
|
|
|
-h : Display this help messaging.
|
|
|
|
EOF
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
2023-07-04 16:07:54 +00:00
|
|
|
## Parameters ##
|
|
|
|
|
2024-05-16 10:00:49 -07:00
|
|
|
while getopts ":i:v:a:c:s:rfdAmVxh" opt; do
|
2023-06-25 15:00:59 -07:00
|
|
|
case $opt in
|
2023-06-26 06:58:09 -07:00
|
|
|
i) input="$OPTARG"
|
2023-06-25 15:00:59 -07:00
|
|
|
;;
|
2023-06-26 06:58:09 -07:00
|
|
|
v) video_bitrate="$OPTARG"
|
2023-06-25 15:00:59 -07:00
|
|
|
;;
|
2023-06-26 06:58:09 -07:00
|
|
|
a) audio_bitrate="$OPTARG"
|
2023-06-25 15:00:59 -07:00
|
|
|
;;
|
2024-05-16 10:00:49 -07:00
|
|
|
c) codec="$OPTARG"
|
|
|
|
;;
|
|
|
|
s) size="$OPTARG"
|
2023-07-04 16:07:54 +00:00
|
|
|
;;
|
|
|
|
r) search_command="find"
|
2023-06-26 06:58:09 -07:00
|
|
|
;;
|
|
|
|
f) force="Y"
|
2023-07-04 16:07:54 +00:00
|
|
|
;;
|
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"
|
|
|
|
;;
|
2024-05-16 10:00:49 -07:00
|
|
|
A) search_command="find" && force="Y" && delete="Y"
|
|
|
|
;;
|
|
|
|
m) time_command="`which time`"
|
2023-07-04 16:07:54 +00:00
|
|
|
;;
|
|
|
|
V) verbose="Y"
|
|
|
|
;;
|
|
|
|
x) set_x="Y"
|
2023-06-26 06:58:09 -07:00
|
|
|
;;
|
|
|
|
h) usage 0
|
2023-06-25 15:00:59 -07:00
|
|
|
;;
|
2023-07-04 16:07:54 +00:00
|
|
|
*) echo "ERROR: Option '$OPTARG' not recognized." >&2
|
|
|
|
usage 1
|
|
|
|
;;
|
2023-06-25 15:00:59 -07:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ "$set_x" == "Y" ]]; then
|
2023-07-04 16:07:54 +00:00
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
2023-06-26 06:58:09 -07:00
|
|
|
if [[ -z "$input" ]]; then
|
2024-05-16 10:00:49 -07:00
|
|
|
echo "WARNING: Program was not passed an input. Using current directory." >&2
|
2023-07-04 16:07:54 +00:00
|
|
|
input="."
|
2023-06-25 15:00:59 -07:00
|
|
|
fi
|
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ -z "$video_bitrate" ]]; then
|
2023-07-04 16:07:54 +00:00
|
|
|
video_bitrate="2000k"
|
2023-06-25 15:00:59 -07:00
|
|
|
fi
|
2024-05-16 10:00:49 -07:00
|
|
|
video_bitrate="-maxrate $video_bitrate"
|
2023-06-25 15:00:59 -07:00
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ -z "$audio_bitrate" ]]; then
|
2024-05-16 10:00:49 -07:00
|
|
|
audio_bitrate="192k"
|
2023-07-04 16:07:54 +00:00
|
|
|
fi
|
2024-05-16 10:00:49 -07:00
|
|
|
audio_bitrate="-b:a $audio_bitrate"
|
2023-07-04 16:07:54 +00:00
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ -z "$codec" ]]; then
|
2023-07-04 16:07:54 +00:00
|
|
|
codec=""
|
2024-05-16 10:00:49 -07:00
|
|
|
else
|
|
|
|
codec="-vcodec $codec"
|
2023-06-25 15:00:59 -07:00
|
|
|
fi
|
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ -z "$search_command" ]]; then
|
2023-07-04 16:07:54 +00:00
|
|
|
search_command="ls"
|
2023-06-26 06:58:09 -07:00
|
|
|
fi
|
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ -z "$time_command" ]]; then
|
2023-07-04 16:07:54 +00:00
|
|
|
time_command=""
|
2024-05-16 10:00:49 -07:00
|
|
|
else
|
|
|
|
time_command="$time_command -p"
|
2023-07-04 16:07:54 +00:00
|
|
|
fi
|
|
|
|
|
2024-05-16 10:00:49 -07:00
|
|
|
if [[ -z $size ]]; then
|
|
|
|
size="720"
|
|
|
|
fi
|
|
|
|
size="-filter:v scale=-1:$size"
|
|
|
|
|
2023-07-04 16:07:54 +00:00
|
|
|
## Main ##
|
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ "$verbose" == "Y" ]]; then
|
2023-07-04 16:07:54 +00:00
|
|
|
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'
|
2023-07-04 16:07:54 +00:00
|
|
|
time_command='$time_command'
|
|
|
|
verbose='$verbose'
|
|
|
|
set_x='$set_x'
|
|
|
|
filename_flag='$filename_flag'
|
|
|
|
date_YYYYMMDD='$date_YYYYMMDD'
|
|
|
|
SECONDS='$SECONDS'
|
|
|
|
EOF
|
|
|
|
fi
|
2023-06-25 15:00:59 -07:00
|
|
|
|
2023-07-04 16:07:54 +00:00
|
|
|
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
|
2023-06-26 06:58:09 -07:00
|
|
|
echo -e "\n$file"
|
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ -n "$time_command" ]]; then
|
2023-07-04 16:07:54 +00:00
|
|
|
date
|
|
|
|
fi
|
|
|
|
|
2024-05-16 10:00:49 -07:00
|
|
|
typeset -l extension_lower
|
|
|
|
extension="${file##*.}"
|
|
|
|
extension_lower="$extension"
|
|
|
|
|
2023-06-26 06:58:09 -07:00
|
|
|
# Exception checks for the existing file.
|
2024-05-16 10:00:49 -07:00
|
|
|
if [[ "$extension_lower" != "mp4" ]]; then
|
2023-06-26 06:58:09 -07:00
|
|
|
echo "SKIP: Not an MP4."
|
|
|
|
continue
|
|
|
|
fi
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ "$file" == *"$filename_flag"* ]]; then
|
2023-06-26 06:58:09 -07:00
|
|
|
echo "SKIP: Input is already compressed."
|
2023-06-25 15:00:59 -07:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2023-08-22 04:42:22 +00:00
|
|
|
# Build the new filename to signify it is different than the original.
|
2024-05-16 10:00:49 -07:00
|
|
|
newfile="${file//$extension/$filename_flag-$date_YYYYMMDD.$extension_lower}"
|
2023-08-22 04:42:22 +00:00
|
|
|
|
2024-05-16 10:00:49 -07:00
|
|
|
if [[ $newfile == $file ]]; then
|
|
|
|
echo "ERROR: The new calculated filename matches the old, skipping." >&2
|
|
|
|
continue
|
|
|
|
fi
|
2023-06-25 15:00:59 -07:00
|
|
|
|
2023-06-26 06:58:09 -07:00
|
|
|
# More exception checks based on the new file.
|
2023-08-22 04:42:22 +00:00
|
|
|
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'."
|
2024-05-16 10:00:49 -07:00
|
|
|
if [[ -d ~/TRASH ]]; then
|
|
|
|
mv -v "$newfile" ~/TRASH/
|
|
|
|
else
|
|
|
|
rm -v "$newfile"
|
|
|
|
fi
|
2023-06-26 06:58:09 -07:00
|
|
|
else
|
|
|
|
echo "SKIP: Already has a compressed version ($newfile)."
|
|
|
|
continue
|
|
|
|
fi
|
2023-06-25 15:00:59 -07:00
|
|
|
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'."
|
2024-05-16 10:00:49 -07:00
|
|
|
echo "*** `date` ***"
|
|
|
|
set -x
|
2023-07-04 16:07:54 +00:00
|
|
|
$time_command bash -c "ffmpeg -nostdin -hide_banner -loglevel quiet \
|
2024-05-16 10:00:49 -07:00
|
|
|
-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="$?"
|
2024-05-16 10:00:49 -07:00
|
|
|
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
|
2023-09-01 06:01:01 -07:00
|
|
|
|
|
|
|
# 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
|
2024-01-23 09:43:42 -07:00
|
|
|
smaller_file=`ls -sh "$file" "$newfile" | sort -h | cut -f 2- -d ' ' | head -n 1`
|
2023-09-01 06:01:01 -07:00
|
|
|
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
|
2023-09-01 06:01:01 -07:00
|
|
|
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
|
2024-05-16 10:00:49 -07:00
|
|
|
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
|
2023-09-01 06:01:01 -07:00
|
|
|
fi
|
2023-06-25 15:00:59 -07:00
|
|
|
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
|
|
|
|
|
2023-09-01 06:01:01 -07:00
|
|
|
echo -e "\nDone!"
|
2023-07-04 16:07:54 +00:00
|
|
|
|
|
|
|
# Display elapsed time
|
2023-08-22 04:42:22 +00:00
|
|
|
if [[ -n "$time_command" ]]; then
|
2023-09-01 06:01:01 -07:00
|
|
|
date
|
2023-07-04 16:07:54 +00:00
|
|
|
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
|
|
|
|
|
2023-06-25 15:00:59 -07:00
|
|
|
exit 0
|