Bonjour à tous.
Je suis récemment tombé sur
cet article qui propose un script permettant de sauvegarder la dernière vidéo Flash© visionnée.
Comme ce script est un peu limité, je l'ai légèrement mis à ma sauce en ajoutant ce qui m'a semblé utile...
Je vous en fait part:
Téléchargement et sources:
Pour les flemmards, vous pouvez télécharger le script et le rendre exécutable en une seule ligne de commande:
wget http://wavemaker.free.fr/share/Last-Flash-Video-Saver.sh && chmod +x Last-Flash-Video-Saver.sh
Pour les autres, voici le script:
#!/bin/bash
#################################################################################
# Description: An easy way to save the latest Flash© video you've watched. #
# Depends: zenity; #
# Autors: Baz00 from the original work and idea of Blake. #
# Licence: GPL #
# Version: 0.1 #
#################################################################################
# Change the script name if you don't like that one:
SCRIPT_NAME="Last Flash Video Saver"
# Choose a destination folder for your videos:
DESTINATION="$HOME/Desktop"
#__________Begining of some functions__________
function cancel {
if [ "$?" != "0" ]; then
zenity --error --title="$SCRIPT_NAME" --height=100 --width=300 --text="Error: The video can not be saved."
exit 1
fi
}
function download {
# Check if the download is finished:
SIZE1=$(stat -c %s /tmp/Fla*)
cancel
sleep 2
SIZE2=$(stat -c %s /tmp/Fla*)
cancel
if [ "$SIZE1" -eq "$SIZE2" ]; then
cp /tmp/Fla* ""$DESTINATION/""$NAME".flv"
cancel
zenity --info --title="$SCRIPT_NAME" --height=100 --width=300 --text="Your video have been saved."
exit 0
else
zenity --info --title="$SCRIPT_NAME" --height=100 --width=300 \
--text="<span color=\"red\">You must wait until the video is fully downloaded to save it.\n(Press "OK" to try again)</span>"
cancel
download
fi
}
#__________Begining of the script__________
# Check if there is a video in /tmp folder:
test -e /tmp/Fla*
if [ "$?" != "0" ]; then
zenity --error --title="$SCRIPT_NAME" --height=100 --width=300 --text="Error: There is no video in your /tmp folder."
exit 1
else
NAME=$(zenity --entry --title="$SCRIPT_NAME" --height=100 --width=300 --text="Name your video:")
cancel
download
fi
Voilà... j'ai oublié de préciser que le script est écrit en anglais, vous pouvez donc le traduire si vous le souhaiter.
Si vous avez d'autres idées pour l'améliorer, n'hésitez pas.
A+
PS: Les remarques anti-flash sont mal venues dans ce sujet. Les topics anti-flash se trouve
ici 🙂