#!/bin/bash # Autor: Alexandre Dumont # http://adumont.serveblog.net/?p=130 function extrae_numero { while read TITULO do set -- $( echo "$TITULO" | sed -e "s/.*\([0-9]\)[x]\?\([0-9][0-9]\).*/\1 \2/" ) if [ $# -eq 2 ] then echo ${1}x${2} continue fi set -- $( echo "$TITULO" | sed -e "s/.*[Ss]0\?\([0-9]*\)[Ee]\([0-9]*\).*/\1 \2/" ) if [ $# -eq 2 ] then echo ${1}x${2} continue fi echo "?x??" done | sort } DIR=/data/share/public/movies cd $DIR LISTA_SERIES=$( find . -type d 2>/dev/null | cut -c3- | grep -v /| grep -v lost+found | grep -v "^$" | sort ) echo "$LISTA_SERIES" | while read SERIE do cd $DIR/$SERIE LISTA_EPISODES=$( ls | grep -i -e ".avi$" | extrae_numero ) if [ -z "$LISTA_EPISODES" ] then continue fi LISTA_SUBS=$( ls -b | grep -i -e ".srt$" -e ".sub$" -e ".txt$" | sed -e "s/[Ee]spa.*[oal]//g" | extrae_numero ) printf "%15s: " "$SERIE" for EP in $LISTA_EPISODES do echo -n $EP if echo "${LISTA_SUBS}" | grep -qx $EP then echo -n " " else echo -n "* " fi done echo done