view TOOLS/subsearch.sh @ 36328:9af6f39eab61

vo png: Error handling and clean up Simplify error path; returning 1 is obfuscated and not different from returning VO_TRUE. We do not want to fatally error out anyway, so printing a warning should be enough and not different from the current behaviour. Use av_free_packet, it is the counter part for av_init_packet . It could e.g. potentially free side data. The buffer itself will not be freed as is intended for our custom buffer which we will try to re-use.
author al
date Wed, 14 Aug 2013 10:21:30 +0000
parents 4d8489f21983
children
line wrap: on
line source

#!/bin/sh
#
# Collects all the appropriate subtitle files in a given directory and
# its subdirectories, no matter what the filename is.
# Use this together as: mplayer -sub `subsearch.sh` movie
# Author: Alex
#

[ $1 ] && cd `dirname $1`

_sub_names=""

one_dir_search() {
    for i in $dir/*
    do
	case "`echo $i | tr [:upper:] [:lower:]`" in
		*.sub|*.srt|*.mps|*.txt) _sub_names="$i,$_sub_names" ;;
		*) ;;
	esac
    done
}

dir="."
one_dir_search

# add subdirectories too
for dir in *
do
    [ -d $dir ] && one_dir_search
done

_len="`echo $_sub_names | wc -c`"
_len=$((_len-2))
echo $_sub_names | cut -b -"$_len"