by jsmiddleton4 » July 28th, 2012, 12:21 am
I have no idea if I'm right or not but it appears to me the symptom I'm seeing is somehow related to these lines of code from SRJG.cgi. Again it appears to me, and I could be 100% off base, something in the MOVIEPATH, MOVIEFILE, MOVIENAME and MOVIEEXT is the problem. SRJG doesn't know how to find the list of movies and where nfo's, etc., live to both the NAS and the Internal HDD. If I knew what the grammar was the first thing I'd look at is the MOVIEPATH line. Something about Shell builtins instead of dirname raises an eyebrow. If the AIOS can't keep track of the two drives, NAS and HDD, with its builtin shell (again whatever that is) then SRJG is setting itself up to fail by relying on the Shell.
GenerateMovieList()
# Find the movies based on movie extension and path provided. Remove movies
# that contains the string(s) specified in $Movie_Filter
{
# Replace the comma in Movie_Filter to pipes |
Movie_Filter=`echo $Movie_Filter | sed 's/,/|/ g'`
find "$Movies_Path" \
| egrep -i '\.(asf|avi|dat|divx|flv|img|iso|m1v|m2p|m2t|m2ts|m2v|m4v|mkv|mov|mp4|mpg|mts|qt|rm|rmp4|rmvb|tp|trp|ts|vob|wmv)$' \
| egrep -iv "$Movie_Filter" > $MoviesList
}
GenerateInsDelFiles()
# Generate insertion and deletion files
{
sed -i -e 's/\[/\[/g' -e 's/\]/\]/g' $MoviesList # Conversion of [] for grep
if [ -s "${PreviousMovieList}" ] ; then # because the grep -f don't work with empty file
grep -vf $MoviesList "${PreviousMovieList}" | sed -e 's/\[/\[/g' -e 's/\]/\]/g' > $DeleteList
grep -vf "${PreviousMovieList}" $MoviesList | sed -e 's/\[/\[/g' -e 's/\]/\]/g' > $InsertList
else
cat $MoviesList | sed -e 's/\[/\[/g' -e 's/\]/\]/g' > $InsertList
fi
mv $MoviesList "${PreviousMovieList}"
}
DBMovieDelete()
# Delete records from the movies.db database.
{
echo "Removing movies from the Database ...."
while read LINE
do
MOVIEPATH="${LINE%/*}" # Shell builtins instead of dirname
MOVIEFILE="${LINE##*/}" # Shell builtins instead of basename
MOVIEEXT="${MOVIEFILE##*.}" # only ext
MOVIEFILE="${MOVIEFILE%.*}" # Strip off .ext
${Sqlite} "${Database}" "DELETE from t1 WHERE file='<file>${MOVIEFILE}</file>' AND path='<path>${MOVIEPATH}</path>' AND ext='<ext>${MOVIEEXT}</ext>'";
done < $DeleteList
${Sqlite} "${Database}" "VACUUM";
}
DBMovieInsert()
# Add movies to the Database and extract movies posters/folders
{
rm "${UpdateLog}" 2>/dev/null
while read LINE
do
MOVIEPATH="${LINE%/*}" # Shell builtins instead of dirname
MOVIEFILE="${LINE##*/}" # Shell builtins instead of basename
MOVIENAME="${MOVIEFILE%.*}" # Strip off .ext
MOVIEEXT="${MOVIEFILE##*.}" # only ext
if [ "${Nfo_Path}" = "MoviesPath" ]; then NFOPATH="${MOVIEPATH}";
elif [ "${Nfo_Path}" = "SRJG" ]; then NFOPATH="${FSrjg_Path}"
else NFOPATH="${Nfo_Path}"; fi
# Initialize defaults, replace later
MOVIETITLE="$MOVIENAME</title>"
GENRE="<name>Unknown</name>"
MovieYear=""
if [ -e "$NFOPATH/MovieInfo.nfo" ]; then INFONAME=MovieInfo.nfo;
else INFONAME=$MOVIENAME.nfo; fi
[ -e "$NFOPATH/$INFONAME" ] && Infoparsing
if [ -z "$GENRE" ]; then dbgenre="<name>Unknown</name>"; else dbgenre="$GENRE"; fi
dbtitle=`echo "<title>$MOVIETITLE" | sed "s/'/''/g"`
dbpath=`echo "<path>$MOVIEPATH</path>" | sed "s/'/''/g"`
dbfile=`echo "<file>$MOVIENAME</file>" | sed "s/'/''/g"`
dbext=`echo "<ext>$MOVIEEXT</ext>" | sed "s/'/''/g"`
dbYear=$MovieYear
if [ "$Force_DB_Update" = "y" ]; then
dbdateStamp=`date -r "$MOVIEPATH/$MOVIENAME.$MOVIEEXT" '+%Y-%m-%d %H:%M:%S'`
${Sqlite} "${Database}" \
"insert into t1 (genre,title,year,path,file,ext,dateStamp) \
values ('$dbgenre','$dbtitle','$dbYear','$dbpath','$dbfile','$dbext','$dbdateStamp');";
else
${Sqlite} "${Database}" \
"insert into t1 (genre,title,year,path,file,ext) \
values ('$dbgenre','$dbtitle','$dbYear','$dbpath','$dbfile','$dbext');";
fi
done < $InsertList
}