Kodi poster/thumbs generator

Kodi poster/thumbs generator 0.3

Brak uprawnień do pobrania
Co robi:
Tworzy miniaturki (jeśli są to pomija tworzenie) o rozmiarze 400px (na podstawie proporcji z filmu) z przypadkowego momentu w filmie wg standardów KODI. Jak minaturka jest nieodpowiednia to skasuj ją i włącz skrypt jeszcze raz.

Program:
Bash:
cat generate_thumbs.sh
#!/bin/bash
#check for required software
command -v shuf >/dev/null 2>&1 || { echo "I require shuf but it's not installed.  Aborting." >&2; exit 1; }
command -v ffmpegthumbnailer >/dev/null 2>&1 || { echo "I require ffmpegthumbnailer but it's not installed.  Aborting." >&2; exit 1; }

# check if crucial parameter is missing ...
if [ $# -eq 0 ]
  then
  echo "Usage: $0 /video/folder/to/scan/ > thumbs.sh ; bash thumbs.sh"
  exit 1;
fi
source_dir="${1}"
#function which creates commands to create pics ...
function create_commands()
{
#check if parameter is empty or so ...
if [ -z "$1" ]
then return 1
fi
#little bash magic here
Upload=False
SQL_User=root
SQL_Password=haslo123
generator=/usr/bin/ffmpegthumbnailer
fname="${1}"
#fname=$(echo $fname | sed "s/'/\\\'/g")
filename=$(basename "$1")
DIR=$(dirname "$1")
extension="${filename##*.}"
filename_o="${filename%.*}"
file1="$DIR/$filename_o-thumb.jpg"
file2="$DIR/$filename_o-poster.jpg"
#create thumb if is not present
if [ ! -f "${file1}" ]; then
echo $generator -i \"${fname}\" -o \"${file1}\" -q 10 -s 400 -t `shuf -i10-85 -n1`%
Upload=True
fi
#create poster if is not present
if [ ! -f "${file2}" ]; then
echo $generator -i \"${fname}\" -o \"${file2}\" -q 10 -s 400 -t `shuf -i10-85 -n1`%
Upload=True
fi
#Upload info to DB ..
#Uncomment to disable info upload to DB
#Upload=False
if [ "$Upload" == "True" ]; then
echo "INSERT INTO ThumbsInfo (ID, Filename, CreationDate) VALUES (NULL,"\"${fname}\"", '`date +"%Y-%m-%d %T"`');" | mysql -u$SQL_User -p$SQL_Password ThumbsInfo;
fi
return 0
}

input_file_types=(mkv mp4 avi)

#loop over the types and convert
for input_file_type in "${input_file_types[@]}"
do
  #let find do magic with -print0 to keep null char at end of line
  find "$source_dir" -name "*.$input_file_type" -print0 | while IFS= read -r -d $'\0' in_file
  do
  #create some commands from provided paths
  create_commands "${in_file}"
  done
done

Użycie:
Podgląd co się bedzie działo:
./generate_thumbs.sh /PC/anime/Seriale/
Bash:
$ ./generate_thumbs.sh /PC/anime/Seriale/
/usr/bin/ffmpegthumbnailer -i "/PC/anime/Seriale/Game of Thrones/Game of Thrones - 6x09 - Battle of the Bastards.mkv" -o "/PC/anime/Seriale/Game of Thrones/Game of Thrones - 6x09 - Battle of the Bastards-poster.jpg" -q 10 -s 400 -t 26%
/usr/bin/ffmpegthumbnailer -i "/PC/anime/Seriale/Game of Thrones/Game of Thrones - 6x10 - The Winds of Winter.mkv" -o "/PC/anime/Seriale/Game of Thrones/Game of Thrones - 6x10 - The Winds of Winter-poster.jpg" -q 10 -s 400 -t 67%

Wykonanie:
./generate_thumbs.sh /PC/anime/Seriale/ > thumbs.sh ; bash thumbs.sh &> /dev/null
Autor
Usunięty użytkownik pigers
Pobrano
7
Wyświetleń
412
Pierwsze wydanie
Ostatnia aktualizacja
Ocena
0,00 gwiazdka(i) Ocen: 0

Ostatnie aktualizacje

  1. SQL update fix #2

    W głownym poście, program nie krzyczy jak w nazwach sa znaki specjalne typu ' itp.
  2. SQL update fix

    w głownym poscie ..