#!/bin/bash
# - bof - #



<<'comment'

# - Configured - #


rm -rf ~/.bashrc;
vim ~/.bashrc;

rm -rf ~/.zshrc;
vim ~/.zshrc;

ssh-keygen -R 192.168.1.1

# - On client - #
cd ~/.ssh;
ssh-keygen -t rsa;

cat ~/.ssh/id_rsa.pub;

# - On server - #
vim ~/.ssh/authorized_keys;



xdg-user-dirs-update;
sudo apt install dialog duf curl figlet git lolcat neovim pv webapp-manager -y;
sudo apt install dialog duf curl figlet git htop inxi lolcat net-tools neovim pv webapp-manager -y;

# -  - #
# - Timezone setting - #
sudo timedatectl set-timezone America/New_York;
timedatectl;



cd ~/; rm -rf ~/clipGrab.sh; vim ~/clipGrab.sh;
Copy & paste this content
chmod +x ~/clipGrab.sh; ~/./clipGrab.sh;

comment



# -  - #
# - AdditionalSoftware_ - #
function AdditionalSoftware_(){
  sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt clean;
  sudo apt install libfuse2t64 ffmpeg -y;
}



# -  - #
# - VariablesDefinition_ - #
function VariablesDefinition_(){
  sU_=$USER;
  sDwn_=~/Downloads/
  oD_=$sDwn_'ClipGrab.Ins/';
  dD_=/home/$sU_/.AppImages/ClipGrab/;
  ytoD_=$oD_'home/user/dot-local/share/ClipGrab/ClipGrab/';
  sLs_=/home/$sU_/.local/share/;
  ytdD_=$sLs_'ClipGrab/ClipGrab/';
  dSa_=$sLs_'applications/';
  dCf_=$dSa_'ClipGrab.desktop';
  ytF_=yt-dlp;
  eF_=ClipGrab-3.9.14-x86_64.AppImage;
  iF_=ClipGrabIcon1.png;
}



# -  - #
# - CopyingClipGrabFiles_ - #
function CopyingClipGrabFiles_(){
  mkdir -p $dSa_ $dD_;
  cp -p $oD_$eF_ $dD_;
  cp -p $oD_$iF_ $dD_;
}



# -  - #
# - CreateDesktopConfigurationFile_ - #
function CreateDesktopConfigurationFile_(){
rm -rf $dCf_;
cat <<EOF >> $dCf_;
[Desktop Entry]
Type=Application
Name=ClipGrab
Comment=Download YouTube, Dailymotion, etc. Video Clips
Exec=$dD_$eF_
Icon=$dD_$iF_
Terminal=false
StartupWMClass=ClipGrab
Categories=Network;
StartupNotify=false
EOF
}



# -  - #
# - Configuring_ytdlp_File_ - #
function Configuring_ytdlp_File_(){
  # -  - #
  # - Eliminate these files - #
  mkdir -p $ytdD_
  rm -rf $ytdD_$ytF_*;

  # -  - #
  # - Copy new file from ClipGrab.tar.bz2 - #
  cp -pv $ytoD_$ytF_ $ytdD_$ytF_;
}



# -  - #
# - CleaningUp_ - #
function CleaningUp_(){
  local dFiles_=$sDwn_'ClipGrab*';
  # -  - #
  # - Cleaning up ~/Downloads folder - #
  rm -rf $dFiles_ ~/clipGrab.sh;
}



clear;

AdditionalSoftware_;
VariablesDefinition_;
CopyingClipGrabFiles_;
CreateDesktopConfigurationFile_;
Configuring_ytdlp_File_;
CleaningUp_;

echo -e  "\n\n\nClipGrab installed & configured successfully...\n\n";



<<'comment'

cd ~/; rm -rf ~/clipGrab.sh; vim ~/clipGrab.sh;
Copy & paste this content
chmod +x ~/clipGrab.sh; ~/./clipGrab.sh;

# -  - #
# - Documentation - #
https://stackoverflow.com/questions/66253521/clipgrab-error-downloading-youtube-dl-ssl-handshake-failed

comment



# - eof - #