Add scriptto create conference video on Kdenlive
This commit is contained in:
parent
d376bcfd1c
commit
4e852db2e2
2 changed files with 80 additions and 0 deletions
77
home-manager/hosts/files/create_conf
Executable file
77
home-manager/hosts/files/create_conf
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
error() {
|
||||
>&2 printf "\e[31mE\e[0m %s\n" "$1"
|
||||
}
|
||||
|
||||
die() {
|
||||
error "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
process_args() {
|
||||
while :; do
|
||||
case $1 in
|
||||
-l|--label)
|
||||
key_label="$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
test=""
|
||||
base_dir="${HOME}/medias/videos/sambab"
|
||||
|
||||
conf="$*"
|
||||
key_label=${key_label:-SAMBAB}
|
||||
|
||||
|
||||
printf "Creation de la conférence de %s\n" "$conf"
|
||||
cd ~/medias/videos/sambab || exit 1
|
||||
|
||||
#Get las friday date for creating folder
|
||||
friday=$(date --date='last Friday' +"%Y.%m.%d")
|
||||
|
||||
#Add basedir, then I have my directory
|
||||
folder="${base_dir}/${friday}-${conf// /_}"
|
||||
|
||||
#create it
|
||||
mkdir "${folder}"/{rushes,audio,titles} -p || die "folder creation failed"
|
||||
|
||||
|
||||
cp "${base_dir}/logo_amis.svg" "${folder}/titles" || die "SVG copy failed!"
|
||||
cp "${base_dir}/template.kdenlive" "${folder}/montage.kdenlive" || dir "Template copy failed!" }
|
||||
|
||||
inkscape_date=$(LANG=fr_FR.UTF-8 date --date='last Friday' +"%A %d %B %Y")
|
||||
|
||||
printf "Put Name on title\n"
|
||||
sed -i "s/\[\[conf\]\]/${conf//_/ }/g" ${folder}/titles/logo_amis.svg || die "Change text on credits screen failed!"
|
||||
|
||||
printf "Put date on title\n"
|
||||
sed -i "s/\[\[date\]\]/${inkscape_date}/g" ${folder}/titles/logo_amis.svg || die "Change date failed!"
|
||||
|
||||
printf "Importing PNG File in %s/montage.kdenlive \n" "$folder"
|
||||
sed -i "s#\[\[logo\]\]#${folder}/titles/logo_amis.png#g" "${folder}"/montage.kdenlive || die "Import failed!"
|
||||
|
||||
printf "Export SVG title \n"
|
||||
inkscape --export-type="png" "${folder}/titles/logo_amis.svg" || die "Export failed"
|
||||
|
||||
echo "Mount USBkey with Label $key_label"
|
||||
usb_key="/dev/$(lsblk -o KNAME,LABEL | grep ${key_label} | awk '{print $1}')"
|
||||
[[ ! $usb_key = "/dev/" ]] || die "Can't getting device name, is USB key plugged? $usb_key"
|
||||
|
||||
|
||||
disk="$(udisksctl mount -b ${usb_key} | awk '{print $4}')"
|
||||
sleep 1
|
||||
[[ -n $disk ]] || die " -> Error mounting device $usb_key"
|
||||
|
||||
echo "Copy files from USB key"
|
||||
mv ${disk}/$(date --date='last Friday' +'%Y-%m-%d')\ *.mkv "${folder}/rushes/" || die "Moving video file failed!"
|
||||
|
||||
mv ${disk}/RECORD/EXREC/*.MP3 "${folder}/audio/" || die "Moving audio file!"
|
||||
|
||||
udisksctl unmount -b ${usb_key}
|
||||
exit 0
|
|
@ -31,8 +31,11 @@ xkb_symbols "us-intl-winmax" {
|
|||
|
||||
home.packages = with pkgs; [
|
||||
kdenlive
|
||||
inkscape
|
||||
];
|
||||
|
||||
|
||||
home.file.".local/bin/create_conf".source = ./files/create_conf;
|
||||
imports = [
|
||||
../qutebrowser
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue