Enhancements + Fixes (#41)
* Signal does seem good after all. * Add alias `here` which shows details of everything in the current location. * Move instant messengers to consistently be at the end of the favorites bar. * Change to single quotes so that the pwd is per-call instead of per-source. * Specify the video codec so that the command works on openSUSE. * Refactor so that there is a shared/common fact list. * Add ffmpeg as a package variable. * Reformat long comment. * New file for installing package manager apps for workstations. * Call the workstation package manager tasks. * Change to parenthesis to look better. * Explicitly add a video flag, add recursive searching, fix a bug with -f ignoring input. * Add ability to "force" the compression, deletes old files and regenerates them. Input is now passed with i rather than f for file/folder. f is now used for force. * Fix skipping the file if it's already compressed. Enhance readability of log text.
This commit is contained in:
parent
6d2b20aafe
commit
b47183af76
@ -2,6 +2,11 @@
|
|||||||
# Define program names for package builtin.
|
# Define program names for package builtin.
|
||||||
# This file is for ALL systems and should not include UI components.
|
# This file is for ALL systems and should not include UI components.
|
||||||
|
|
||||||
|
- name: General | Facts | Packages | Shared Defaults
|
||||||
|
set_fact:
|
||||||
|
sshfs: sshfs
|
||||||
|
tar: tar
|
||||||
|
|
||||||
- name: General | Facts | Packages | Parrot OS Fixes
|
- name: General | Facts | Packages | Parrot OS Fixes
|
||||||
set_fact:
|
set_fact:
|
||||||
ansible_pkg_mgr: "apt"
|
ansible_pkg_mgr: "apt"
|
||||||
@ -10,10 +15,8 @@
|
|||||||
|
|
||||||
- name: General | Facts | Package | apt
|
- name: General | Facts | Package | apt
|
||||||
set_fact:
|
set_fact:
|
||||||
sshfs: sshfs
|
|
||||||
locate: locate
|
locate: locate
|
||||||
opensshd: openssh-server
|
opensshd: openssh-server
|
||||||
tar: tar
|
|
||||||
microcode_amd: amd64-microcode
|
microcode_amd: amd64-microcode
|
||||||
microcode_intel: intel-microcode
|
microcode_intel: intel-microcode
|
||||||
cron: cron
|
cron: cron
|
||||||
@ -21,10 +24,8 @@
|
|||||||
|
|
||||||
- name: General | Facts | Package | pacman
|
- name: General | Facts | Package | pacman
|
||||||
set_fact:
|
set_fact:
|
||||||
sshfs: sshfs
|
|
||||||
locate: mlocate
|
locate: mlocate
|
||||||
opensshd: openssh
|
opensshd: openssh
|
||||||
tar: tar
|
|
||||||
microcode_amd: linux-firmware
|
microcode_amd: linux-firmware
|
||||||
microcode_intel: intel-ucode
|
microcode_intel: intel-ucode
|
||||||
cron: cronie
|
cron: cronie
|
||||||
@ -46,7 +47,6 @@
|
|||||||
sshfs: fuse-sshfs
|
sshfs: fuse-sshfs
|
||||||
locate: mlocate
|
locate: mlocate
|
||||||
opensshd: openssh
|
opensshd: openssh
|
||||||
tar: tar
|
|
||||||
microcode_amd: microcode_ctl
|
microcode_amd: microcode_ctl
|
||||||
microcode_intel: microcode_ctl
|
microcode_intel: microcode_ctl
|
||||||
cron: cronie
|
cron: cronie
|
||||||
@ -54,10 +54,8 @@
|
|||||||
|
|
||||||
- name: General | Facts | Package | zypper
|
- name: General | Facts | Package | zypper
|
||||||
set_fact:
|
set_fact:
|
||||||
sshfs: sshfs
|
|
||||||
locate: mlocate
|
locate: mlocate
|
||||||
opensshd: openssh
|
opensshd: openssh
|
||||||
tar: tar
|
|
||||||
microcode_amd: ucode-amd
|
microcode_amd: ucode-amd
|
||||||
microcode_intel: ucode-intel
|
microcode_intel: ucode-intel
|
||||||
cron: cronie
|
cron: cronie
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
font_awesome: fonts-font-awesome
|
font_awesome: fonts-font-awesome
|
||||||
dmenu: dmenu
|
dmenu: dmenu
|
||||||
sassc: sassc
|
sassc: sassc
|
||||||
|
ffmpeg: ffmpeg
|
||||||
|
|
||||||
|
|
||||||
- name: Workstation | Facts | Package | Pop_OS!
|
- name: Workstation | Facts | Package | Pop_OS!
|
||||||
|
@ -14,42 +14,53 @@ function usage {
|
|||||||
cat <<- EOF
|
cat <<- EOF
|
||||||
Reduce the filesize of a video file to make it stream well. It also
|
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.
|
helps with the file size for placing the file into a backup system.
|
||||||
|
Currently only set up for libopenh264 and mp4 files.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
-f input : The input file or folder with which to search for video files.
|
-i input : The input file or folder with which to search for video files.
|
||||||
If nothing is provided, current directory (.) is assumed.
|
If nothing is provided, current directory (.) is assumed.
|
||||||
-v bitrate : The video bitrate to convert to, defaults to 2000k.
|
-v bitrate : The video bitrate to convert to, defaults to 2000k.
|
||||||
-a bitrate : The audio bitrate to convert to, defaults to 128k.
|
-a bitrate : The audio bitrate to convert to, defaults to 128k.
|
||||||
|
-r : Recurse the entire directory structure, compressing all video files.
|
||||||
|
-f : Force recompressing any files by deleting it if it already exists.
|
||||||
-h : Display this help messaging.
|
-h : Display this help messaging.
|
||||||
EOF
|
EOF
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
## Parse Input
|
## Parse Input
|
||||||
while getopts ":f:v:a:h" opt; do
|
while getopts ":i:v:a:rfh" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
f)
|
i) input="$OPTARG"
|
||||||
input="$OPTARG"
|
echo "input='$input'"
|
||||||
;;
|
;;
|
||||||
v)
|
v) video_bitrate="$OPTARG"
|
||||||
video_bitrate="$OPTARG"
|
echo "video_bitrate='$video_bitrate'"
|
||||||
;;
|
;;
|
||||||
a)
|
a) audio_bitrate="$OPTARG"
|
||||||
audio_bitrate="$OPTARG"
|
echo "audio_bitrate='$audio_bitrate'"
|
||||||
;;
|
;;
|
||||||
h)
|
r) recurse="Y"
|
||||||
usage 0
|
search_command=find
|
||||||
|
echo "recurse='$recurse', search_command='$search_command'"
|
||||||
|
;;
|
||||||
|
f) force="Y"
|
||||||
|
echo "force='$force'"
|
||||||
|
;;
|
||||||
|
h) usage 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z $input && ! -z $1 ]]; then
|
if [[ -z "$input" ]]; then
|
||||||
echo "WARNING: Program was not passed a file. Using input 1."
|
if [[ ! -z "$1" ]]; then
|
||||||
|
echo "WARNING: Program was not passed a file. Using input $1."
|
||||||
input=$1
|
input=$1
|
||||||
else
|
else
|
||||||
echo "WARNING: Program was not passed a file. Using current directory."
|
echo "WARNING: Program was not passed a file. Using current directory."
|
||||||
input='.'
|
input='.'
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z $video_bitrate ]]; then
|
if [[ -z $video_bitrate ]]; then
|
||||||
video_bitrate='2000k'
|
video_bitrate='2000k'
|
||||||
@ -59,14 +70,24 @@ if [[ -z $audio_bitrate ]]; then
|
|||||||
audio_bitrate='128k'
|
audio_bitrate='128k'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z $recurse ]]; then
|
||||||
|
search_command=ls
|
||||||
|
fi
|
||||||
|
|
||||||
## Other Variables
|
## Other Variables
|
||||||
filename_flag='compressed.'
|
filename_flag='compressed.'
|
||||||
|
|
||||||
## Main Loop
|
## Main Loop
|
||||||
ls $input | while read file; do
|
$search_command $input | while read file; do
|
||||||
## Exception Checks
|
echo -e "\n$file"
|
||||||
if [[ $file != *'.mp4' && $file != *'.mpeg' ]]; then
|
|
||||||
echo "Skipping $file, not an MP4 or MPEG."
|
# Exception checks for the existing file.
|
||||||
|
if [[ $file != *'.mp4' ]]; then
|
||||||
|
echo "SKIP: Not an MP4."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ $file == *"$filename_flag"* ]]; then
|
||||||
|
echo "SKIP: Input is already compressed."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -74,16 +95,22 @@ ls $input | while read file; do
|
|||||||
extension=${file##*.}
|
extension=${file##*.}
|
||||||
newfile=${file//$extension/$filename_flag$extension}
|
newfile=${file//$extension/$filename_flag$extension}
|
||||||
|
|
||||||
if [[ $file == *"$filename_flag"* || -e $newfile ]]; then
|
# More exception checks based on the new file.
|
||||||
echo "Skipping $file, already compressed."
|
if [[ -e $newfile ]]; then
|
||||||
|
if [[ $force == "Y" ]]; then
|
||||||
|
echo "FORCE: Removing $newfile."
|
||||||
|
rm -vf $newfile
|
||||||
|
else
|
||||||
|
echo "SKIP: Already has a compressed version ($newfile)."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Convert the file.
|
# Convert the file.
|
||||||
echo "Converting $file to $newfile."
|
echo "Converting to $newfile."
|
||||||
ffmpeg -nostdin -hide_banner -loglevel quiet \
|
ffmpeg -nostdin -hide_banner -loglevel quiet \
|
||||||
-i $file -b:v $video_bitrate -b:a $audio_bitrate \
|
-i $file -b:v $video_bitrate -b:a $audio_bitrate \
|
||||||
$newfile
|
-vcodec libopenh264 -movflags +faststart $newfile
|
||||||
done
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -66,6 +66,9 @@
|
|||||||
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
|
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
|
||||||
when: ansible_system == "Linux" and flatpak_distro
|
when: ansible_system == "Linux" and flatpak_distro
|
||||||
|
|
||||||
|
- include_tasks: tasks/workstation/linux/software/packages.yml
|
||||||
|
when: ansible_system == "Linux"
|
||||||
|
|
||||||
- include_tasks: tasks/workstation/linux/software/brave.yml
|
- include_tasks: tasks/workstation/linux/software/brave.yml
|
||||||
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
|
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
|
||||||
|
|
||||||
|
@ -279,6 +279,7 @@
|
|||||||
echo "ERROR: Something went wrong while removing Flatpak apps!"
|
echo "ERROR: Something went wrong while removing Flatpak apps!"
|
||||||
}
|
}
|
||||||
alias_vim: alias vi=vim
|
alias_vim: alias vi=vim
|
||||||
|
alias_here: alias here='ls -lh `pwd`/*'
|
||||||
|
|
||||||
- name: General | Account Management | Users | Files | Common Variable
|
- name: General | Account Management | Users | Files | Common Variable
|
||||||
set_fact:
|
set_fact:
|
||||||
@ -305,6 +306,7 @@
|
|||||||
{{ function_flatpak_usage }}
|
{{ function_flatpak_usage }}
|
||||||
{{ function_flatpak_purge }}
|
{{ function_flatpak_purge }}
|
||||||
{{ alias_vim }}
|
{{ alias_vim }}
|
||||||
|
{{ alias_here }}
|
||||||
|
|
||||||
- name: General | Account Management | Users | Files | .bashrc
|
- name: General | Account Management | Users | Files | .bashrc
|
||||||
blockinfile:
|
blockinfile:
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
shell: exit 1
|
shell: exit 1
|
||||||
when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed
|
when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed
|
||||||
|
|
||||||
# More Parrot OS junk. They have a command called update in /usr/bin. Doesn't have sudo or anything in it either.
|
# More Parrot OS junk. They have a command called update in /usr/bin. Doesn't
|
||||||
# Hide it in preference for .bashrc update function.
|
# have sudo or anything in it. Hide it in preference for .bashrc update function.
|
||||||
- name: General | Software | Packages | Fix Parrot OS 2 (update)
|
- name: General | Software | Packages | Fix Parrot OS 2 (update)
|
||||||
shell: "mv `which update` `which update`.zz.`date +%Y%m%d`"
|
shell: "mv `which update` `which update`.zz.`date +%Y%m%d`"
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
- { app: "io.lbry.lbry-app", name: "lbry", extra: "dbus-launch" }
|
- { app: "io.lbry.lbry-app", name: "lbry", extra: "dbus-launch" }
|
||||||
- { app: "io.gitlab.librewolf-community", name: "librewolf", extra: "" }
|
- { app: "io.gitlab.librewolf-community", name: "librewolf", extra: "" }
|
||||||
- { app: "chat.delta.desktop", name: "deltachat", extra: "" }
|
- { app: "chat.delta.desktop", name: "deltachat", extra: "" }
|
||||||
|
- { app: "org.signal.Signal", name: "signal", extra: "" }
|
||||||
flatpaks_coding:
|
flatpaks_coding:
|
||||||
- { app: "com.vscodium.codium", name: "codium", extra: "" }
|
- { app: "com.vscodium.codium", name: "codium", extra: "" }
|
||||||
- { app: "com.google.AndroidStudio", name: "android-studio", extra: "" }
|
- { app: "com.google.AndroidStudio", name: "android-studio", extra: "" }
|
||||||
@ -63,7 +64,6 @@
|
|||||||
- { app: "com.discordapp.Discord", name: "discord", extra: "" } # Stopped working, just spins and says Starting.
|
- { app: "com.discordapp.Discord", name: "discord", extra: "" } # Stopped working, just spins and says Starting.
|
||||||
# 2022-11-20 No longer using any of these and they're taking up a lot of space. #
|
# 2022-11-20 No longer using any of these and they're taking up a lot of space. #
|
||||||
- { app: "im.riot.Riot", name: "element", extra: "" }
|
- { app: "im.riot.Riot", name: "element", extra: "" }
|
||||||
- { app: "org.signal.Signal", name: "signal", extra: "" }
|
|
||||||
- { app: "org.telegram.desktop", name: "telegram", extra: "" }
|
- { app: "org.telegram.desktop", name: "telegram", extra: "" }
|
||||||
- { app: "com.jetbrains.PyCharm-Community", name: "pycharm", extra: "" }
|
- { app: "com.jetbrains.PyCharm-Community", name: "pycharm", extra: "" }
|
||||||
# End 2022-11-20 #
|
# End 2022-11-20 #
|
||||||
|
9
tasks/workstation/linux/software/packages.yml
Normal file
9
tasks/workstation/linux/software/packages.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
# Packages specific to workstations.
|
||||||
|
|
||||||
|
- name: Workstation | Software | Packages | Install Software (Editing)
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- "{{ ffmpeg }}"
|
||||||
|
state: present
|
||||||
|
when: editing == true
|
@ -171,11 +171,10 @@
|
|||||||
, 'org.gnome.Nautilus.desktop'
|
, 'org.gnome.Nautilus.desktop'
|
||||||
, 'io.gitlab.librewolf-community.desktop', '{{ browser }}'
|
, 'io.gitlab.librewolf-community.desktop', '{{ browser }}'
|
||||||
, 'org.gnome.Evolution.desktop', 'chat.delta.desktop.desktop'
|
, 'org.gnome.Evolution.desktop', 'chat.delta.desktop.desktop'
|
||||||
, 'org.signal.Signal.desktop'
|
|
||||||
, 'com.vscodium.codium.desktop', 'org.shotcut.Shotcut.desktop'
|
, 'com.vscodium.codium.desktop', 'org.shotcut.Shotcut.desktop'
|
||||||
, 'org.telegram.desktop.desktop', 'com.discordapp.Discord.desktop'
|
|
||||||
, 'im.riot.Riot.desktop'
|
|
||||||
, 'io.lbry.lbry-app.desktop'
|
, 'io.lbry.lbry-app.desktop'
|
||||||
|
, 'org.signal.Signal.desktop', 'im.riot.Riot.desktop'
|
||||||
|
, 'org.telegram.desktop.desktop', 'com.discordapp.Discord.desktop'
|
||||||
, 'com.valvesoftware.Steam.desktop'
|
, 'com.valvesoftware.Steam.desktop'
|
||||||
]"
|
]"
|
||||||
state: present
|
state: present
|
||||||
|
Loading…
x
Reference in New Issue
Block a user