MythTV  master
testsubtitlepngs.sh
Go to the documentation of this file.
1 #!/bin/sh
2 
3 if [ $# -ne 1 ]; then
4  echo "Usage: $0 </path/to/spumux.xml>"
5  exit 0
6 fi
7 
8 BADPNGS="n"
9 
10 DIR=`dirname $1`
11 rm -f "${DIR}/spumux.xml.bad"
12 
13 grep png $1 | awk -F'image="' '{print $2}' | awk -F'"' '{print $1}' | while read
14 do
15  pngtopnm <"${REPLY}" >/dev/null
16  RC=$?
17  if [ ${RC} -eq 1 ]; then
18  echo "Bad PNG: ${REPLY}"
19  if [ "${BADPNGS}" = "n" ]; then
20  BADPNGS="y"
21  /bin/echo -n >"${DIR}/spumux.xml.bad" "${REPLY}"
22  else
23  /bin/echo -n >>"${DIR}/spumux.xml.bad" "\\|${REPLY}"
24  fi
25  fi
26 done
27 
28 cat "${DIR}/spumux.xml.bad"
29 
30 if [ -e "${DIR}/spumux.xml.bad" ]; then
31  BADPNGS=`cat "${DIR}/spumux.xml.bad"`
32  grep -v "${BADPNGS}" "$1" >"${DIR}/spumux.xml.new"
33 # mv "${DIR}/spumux.xml" "${DIR}/spumux.xml.old"
34  mv "${DIR}/spumux.xml.new" "${DIR}/spumux.xml"
35  rm "${DIR}/spumux.xml.bad"
36 fi