2024-11-17 16:01:05 +01:00
|
|
|
#!/bin/bash
|
2024-11-17 16:05:24 +01:00
|
|
|
if [ -z "${HOME}" ]; then
|
|
|
|
if [ "$(whoami)" == "root" ]; then
|
|
|
|
HOME="/root"
|
|
|
|
else
|
|
|
|
HOME=$(grep "$(whoami)" /etc/passwd | awk 'BEGIN {FS=":"} {print($6)}')
|
|
|
|
fi
|
|
|
|
fi
|
2024-11-17 16:01:05 +01:00
|
|
|
CONFIG_FILE="${HOME}/.config/get_youtube_videos.conf"
|
|
|
|
cd "__src_folder__" || exit 1
|
|
|
|
if [ -r "${CONFIG_FILE}" ]; then
|
|
|
|
perms=$(stat -c %A "${CONFIG_FILE}")
|
|
|
|
if [ "${perms:4:6}" != '------' ]; then
|
|
|
|
echo "Permissions too open for config file '${CONFIG_FILE}' ($perms). Remove all permissions to group and others."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
config=(--config "${CONFIG_FILE}")
|
|
|
|
else
|
|
|
|
config=()
|
|
|
|
fi
|
|
|
|
"__src_folder__/get_youtube_videos.sh" "${config[@]}" "${@}"
|
|
|
|
|
2024-11-17 16:10:49 +01:00
|
|
|
download_dir="$(grep download_dir "${CONFIG_FILE}" | awk 'BEGIN {FS="="} {print($2)}' | sed 's/"//g')"
|
|
|
|
if [ "${download_dir}" == "" ]; then
|
|
|
|
download_dir="${HOME}/downloaded_youtube_videos"
|
|
|
|
fi
|
2024-11-17 16:01:05 +01:00
|
|
|
chmod 0777 "${download_dir}" -R
|
2024-11-20 10:43:46 +01:00
|
|
|
"__src_folder__/fix_dir_dates.sh"
|