#!/bin/bash
##################################################################################
#                                                                                #
#  Action script for Nemo filenmanager and shows image metadata.                 #
#  Depends on: exif, yad                                                         #
#                                                                                #
#  Made by Koentje.        lowrida007@gmail.com                                  #
#                                                                  version 1.1   #
##################################################################################

tmpfile="/tmp/ffprobelog.tmp"

if [ "$1" = "" ]; then
  text=" This is an action script for nemo and can't be started from the terminal.  \n"
  b="Error"
else
  b=$(basename "$1")
  ffprobe "$1" 2> $tmpfile
  text=$(cat $tmpfile | grep -m 1 -A 50 'Input #0,')
fi

yad --text="\n<span font='Ubuntu Mono 14'> $text </span>" --title="$b" --image="video" --center --fixed --on-top --width=550 --height=70 --button="OK" &
