2021-08-01 11:56:00 +02:00
|
|
|
#! /bin/bash
|
|
|
|
|
2022-04-19 18:34:54 +02:00
|
|
|
if [ ! $(which zenity) ];then
|
|
|
|
echo "Zenity n'est pas installé, installer zenity et relancer le script.";exit
|
|
|
|
fi
|
2022-04-19 09:13:12 +02:00
|
|
|
|
2021-08-01 11:56:00 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Variables
|
|
|
|
#---------------------------------------------------------
|
2022-04-19 09:13:12 +02:00
|
|
|
binarypath="$HOME/bin/yt-dlp"
|
|
|
|
url="https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp"
|
2021-08-01 11:56:00 +02:00
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Fonctions
|
|
|
|
#---------------------------------------------------------
|
|
|
|
f_TouchePourContinuer () {
|
|
|
|
read -p "Presser une touche pour continuer ou ctrl+C pour arrêter." CONT
|
|
|
|
}
|
|
|
|
|
|
|
|
f_youtubedlinstall () {
|
|
|
|
echo "Installation de la version autonome."
|
2022-04-19 09:13:12 +02:00
|
|
|
mkdir -p $HOME/bin/
|
2021-08-01 11:56:00 +02:00
|
|
|
wget --quiet $url -O $binarypath
|
|
|
|
}
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Désinstallation
|
|
|
|
#---------------------------------------------------------
|
|
|
|
if [ "$1" = "--delete" ]; then
|
|
|
|
echo "Suppression des fichiers youtube-dl"
|
|
|
|
echo ""
|
|
|
|
f_TouchePourContinuer
|
2022-04-19 18:34:54 +02:00
|
|
|
rm -v $HOME/.local/share/applications/youtube-dl-update.desktop
|
|
|
|
rm -v $HOME/.local/share/applications/youtube-dl-gui.desktop
|
|
|
|
rm -v $HOME/bin/youtube-dl-pseudogui.sh
|
|
|
|
rm -v $HOME/bin/youtube-dl-update.sh
|
|
|
|
rm -v $binarypath
|
2021-08-01 11:56:00 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Intro
|
|
|
|
#---------------------------------------------------------
|
|
|
|
echo ""
|
2022-04-19 09:13:12 +02:00
|
|
|
echo "youtube-dl-installs.sh"
|
2021-08-01 11:56:00 +02:00
|
|
|
cat << "EOF"
|
|
|
|
par Djan GICQUEL (https://djan-gicquel.fr)
|
|
|
|
Script mono-utilisateur
|
|
|
|
Pour supprimmer les fichiers créé par ce script, ajouter --delete en option.
|
|
|
|
----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Ce que fait ce script :
|
|
|
|
- créer le dossier ~/bin/
|
2022-04-19 09:13:12 +02:00
|
|
|
- télécharger le binaire de yt-dlp dans ~/bin
|
|
|
|
- ajouter des alias pour yt-dlp dans le .bashrc
|
2021-08-01 11:56:00 +02:00
|
|
|
- créer les scripts bash dans ~/bin
|
|
|
|
- ajouter les lanceurs dans le menu principal
|
|
|
|
|
2022-04-19 09:13:12 +02:00
|
|
|
Pour télécharger une ou plusieurs vidéos lancer "youtubedl-pseudogui" et coller l'url.
|
|
|
|
Valider, le téléchargement des vidéos commence.
|
2021-08-01 11:56:00 +02:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
f_TouchePourContinuer
|
|
|
|
clear
|
|
|
|
|
2022-07-26 21:34:29 +02:00
|
|
|
if ! which ffmpeg ; then
|
|
|
|
echo "ffmpeg n'est pas installé, mais est requis.";exit
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-08-01 11:56:00 +02:00
|
|
|
#---------------------------------------------------------
|
|
|
|
# Installation youtube-dl
|
|
|
|
#---------------------------------------------------------
|
|
|
|
f_youtubedlinstall
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Ajout bashrc
|
|
|
|
#---------------------------------------------------------
|
|
|
|
echo "Ajout dans bashrc...";sleep 2
|
|
|
|
|
|
|
|
cat << "EOF" >> $HOME/.bashrc
|
2022-07-26 21:34:29 +02:00
|
|
|
### YOUTUBE-DL ###
|
2022-04-19 09:13:12 +02:00
|
|
|
alias dl_video="~/bin/yt-dlp -f 'bestvideo[height<=480]+bestaudio/best[height<=480]' --restrict-filenames --output \"%(title)s\""
|
|
|
|
alias dl_video_original="~/bin/yt-dlp --restrict-filenames --output \"%(title)s\""
|
|
|
|
alias dl_musique="~/bin/yt-dlp --extract-audio --audio-format mp3 --restrict-filenames --output \"%(title)s.%(ext)s\""
|
|
|
|
alias dl_playlist="~/bin/yt-dlp --yes-playlist --restrict-filenames --output \"%(title)s\""
|
|
|
|
alias dl_playlistmp3="~/bin/yt-dlp --yes-playlist --extract-audio --audio-format mp3 --restrict-filenames --output \"%(title)s.%(ext)s\""
|
|
|
|
alias youtube-dl-update="~/bin/yt-dlp -U"
|
2021-08-01 11:56:00 +02:00
|
|
|
EOF
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Création des fichiers dans $HOME/bin
|
|
|
|
#---------------------------------------------------------
|
|
|
|
echo "Création des scripts...";sleep 2
|
|
|
|
|
2022-04-19 09:13:12 +02:00
|
|
|
# Creation Fichier YoutubeDlPseudoGui
|
2022-06-26 10:08:58 +02:00
|
|
|
cp youtube-dl-pseudogui.sh $HOME/bin/youtube-dl-pseudogui.sh
|
2021-08-01 11:56:00 +02:00
|
|
|
|
|
|
|
# Droits des scripts
|
|
|
|
chmod a+x $HOME/bin/youtube-dl-pseudogui.sh
|
2022-04-19 09:13:12 +02:00
|
|
|
chmod a+x $binarypath
|
2021-08-01 11:56:00 +02:00
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Ajout des lanceurs
|
|
|
|
#---------------------------------------------------------
|
|
|
|
echo "Création des lanceurs...";sleep 2
|
|
|
|
mkdir -p $HOME/.local/share/applications/
|
|
|
|
|
|
|
|
cat << "EOF" > $HOME/.local/share/applications/youtube-dl-gui.desktop
|
|
|
|
[Desktop Entry]
|
|
|
|
Encoding=UTF-8
|
|
|
|
Type=Application
|
|
|
|
Categories=Utility;
|
2022-05-19 16:56:57 +02:00
|
|
|
Name=youtubedl-video
|
2021-08-01 11:56:00 +02:00
|
|
|
Comment=Télécharger des vidéos sur Youtube ou d'autres sites
|
|
|
|
Exec=sh bin/youtube-dl-pseudogui.sh
|
|
|
|
Icon=youtube
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
# Ajout des icones
|
|
|
|
#---------------------------------------------------------
|
|
|
|
echo "Ajout des icones...";sleep 2
|
|
|
|
mkdir -p $HOME/.icons/
|
2022-06-29 19:53:41 +02:00
|
|
|
mv youtube.png $HOME/.icons/
|
2021-08-01 11:56:00 +02:00
|
|
|
|
2022-06-26 10:29:46 +02:00
|
|
|
# Suppression des anciens fichiers
|
|
|
|
rm -f $HOME/bin/youtube-dl-audio.sh
|
|
|
|
rm -f $HOME/bin/youtube-dl-update.sh
|
|
|
|
rm -f $HOME/.local/share/applications/youtube-dl-update.desktop
|
|
|
|
rm -f $HOME/.local/share/applications/youtube-dl-update.desktop
|
2021-08-01 11:56:00 +02:00
|
|
|
|
|
|
|
echo "Installation terminée."
|