diff --git a/createmmdb b/createmmdb index 559f4658..22c6da13 100755 --- a/createmmdb +++ b/createmmdb @@ -84,7 +84,7 @@ echo "Please enter the name of user to be created" read -r USER_NAME echo "Please enter the password for the new user" read -r USER_PASSWORD -echo "Please enter the location of user to be created" +echo "Please enter the location (IP address) of user to be created. To create a user on a locally installed database type: localhost" read -r USER_HOST echo "Please enter mysql root password" mysql_config_editor set --login-path=tempsetting --host=localhost --user=root --password diff --git a/mmfunctions b/mmfunctions index aeaa902e..9d3f66e8 100755 --- a/mmfunctions +++ b/mmfunctions @@ -12,6 +12,15 @@ elif [ ! "${CONFIG}" = "Y" -a "${REQUIRECONFIG}" = "Y" ] ; then exit 1 fi +#Setup differences for systems +if [[ "$(uname -s)" = "Darwin" ]] ; then + FFMPEGFONTPATH='/Library/Fonts/Andale Mono.ttf' +elif [[ "$(uname -s)" = "Linux" ]] ; then + FFMPEGFONTPATH='/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf' +else + echo "Warning: Unsupported system detected. Certain configurations not set. This may cause errors for some scripts." +fi + _cleanup_mount_dir(){ if [ -d "${MOUNT_DIR}" ] ; then echo calling umount @@ -86,7 +95,7 @@ _report_schema_db(){ if [ -z "${xmlschema}" ] ; then xmlschema="$LTO_LOGS/${TAPE_SERIAL}.schema" fi - schema_sorted=$(xml sel -t -m ".//file" -v "concat(name,'|',length, '|', modifytime)" -o "|" -m "ancestor-or-self::directory" -v "name" -o "/" -b -n "${xmlschema}") + schema_sorted=$(xmlstarlet sel -t -m ".//file" -v "concat(name,'|',length, '|', modifytime)" -o "|" -m "ancestor-or-self::directory" -v "name" -o "/" -b -n "${xmlschema}") schema_tape=$(basename "${xmlschema}" | cut -d'.' -f1) IFS=$(echo -en "\n\b") (for i in ${schema_sorted}; do LINE=$i; @@ -236,7 +245,7 @@ _db_error_check(){ } _fingerprint_to_db(){ -VIDEOFINGERPRINT=$(xml sel -N "m=urn:mpeg:mpeg7:schema:2001" -t -m "m:Mpeg7/m:DescriptionUnit/m:Descriptor/m:VideoSignatureRegion/m:VSVideoSegment" -v m:StartFrameOfSegment -o ':' -v m:EndFrameOfSegment -o ':' -m m:BagOfWords -v "translate(.,' ','')" -o ':' -b -n "${FINGERPRINT_XML}") +VIDEOFINGERPRINT=$(xmlstarlet sel -N "m=urn:mpeg:mpeg7:schema:2001" -t -m "m:Mpeg7/m:DescriptionUnit/m:Descriptor/m:VideoSignatureRegion/m:VSVideoSegment" -v m:StartFrameOfSegment -o ':' -v m:EndFrameOfSegment -o ':' -m m:BagOfWords -v "translate(.,' ','')" -o ':' -b -n "${FINGERPRINT_XML}") } _premis_event_list(){ @@ -991,10 +1000,10 @@ _find_input (){ fi elif [[ "${SOURCEFILE#*.}" = "mkv" ]] ; then # if the sorucefile is an mkv, then check if it has a Presentation Chapter Edition - if [[ -n $(mkvextract tags "${SOURCEFILE}" | xml sel -t -m "/Tags/Tag/Simple[String='Presentation']" -v String) ]] ; then + if [[ -n $(mkvextract tags "${SOURCEFILE}" | xmlstarlet sel -t -m "/Tags/Tag/Simple[String='Presentation']" -v String) ]] ; then _report -dt "The input file ($(basename "${SOURCEFILE}")) contains a Chapter Edition called 'Presentation', will use that for transcoding." - LISTCHAPTERS=$(mkvextract chapters "${SOURCEFILE}" | xml sel -t -m Chapters/EditionEntry[EditionFlagDefault='1']/ChapterAtom -v ChapterTimeStart -o "-" -v ChapterTimeEnd -o "-" -v ChapterSegmentUID -n -) - SegmentUIDs=$(mkvextract chapters "${SOURCEFILE}" | xml sel -t -m Chapters/EditionEntry[EditionFlagDefault='1']/ChapterAtom/ChapterSegmentUID -v . -n | sort -u) + LISTCHAPTERS=$(mkvextract chapters "${SOURCEFILE}" | xmlstarlet sel -t -m Chapters/EditionEntry[EditionFlagDefault='1']/ChapterAtom -v ChapterTimeStart -o "-" -v ChapterTimeEnd -o "-" -v ChapterSegmentUID -n -) + SegmentUIDs=$(mkvextract chapters "${SOURCEFILE}" | xmlstarlet sel -t -m Chapters/EditionEntry[EditionFlagDefault='1']/ChapterAtom/ChapterSegmentUID -v . -n | sort -u) if [[ -n "${LISTCHAPTERS}" ]]; then _report -d "Found this chapter list:" _report -d "${LISTCHAPTERS}" diff --git a/searchfingerprint b/searchfingerprint index 7971d438..702ae412 100755 --- a/searchfingerprint +++ b/searchfingerprint @@ -40,8 +40,16 @@ while [ "${*}" != "" ] ; do shift #Confirm input is a video file - if [[ -z $(file -Ib "${INPUT}" | grep video) ]] ; then - echo "Input is not a video file" && continue + unset VIDEOCHECK + if [[ "$(uname -s)" = Darwin ]] ; then + VIDEOCHECK='file -Ib' + elif [[ "$(uname -s)" = Linux ]] ; then + VIDEOCHECK='file -i' + fi + if ! [[ -z ${VIDEOCHECK} ]] ; then + if [[ -z $(${VIDEOCHECK} "${INPUT}" | grep video) ]] ; then + echo "Input is not a video file" && continue + fi fi IO=$(mktemp) @@ -75,7 +83,7 @@ while [ "${*}" != "" ] ; do #Create Fingerprint ffmpeg -f concat -safe 0 -i "${IO}" -vf signature=format=xml:filename="${TEMPFINGERPRINT}" -map 0:v -f null - - xml sel -N "m=urn:mpeg:mpeg7:schema:2001" -t -m "m:Mpeg7/m:DescriptionUnit/m:Descriptor/m:VideoSignatureRegion/m:VSVideoSegment" -v m:StartFrameOfSegment -o ':' -v m:EndFrameOfSegment -o ':' -m m:BagOfWords -v "translate(.,' ','')" -o ':' -b -n "${TEMPFINGERPRINT}" > "${TEMPFINGERPRINT_SORTED}" + xmlstarlet sel -N "m=urn:mpeg:mpeg7:schema:2001" -t -m "m:Mpeg7/m:DescriptionUnit/m:Descriptor/m:VideoSignatureRegion/m:VSVideoSegment" -v m:StartFrameOfSegment -o ':' -v m:EndFrameOfSegment -o ':' -m m:BagOfWords -v "translate(.,' ','')" -o ':' -b -n "${TEMPFINGERPRINT}" > "${TEMPFINGERPRINT_SORTED}" #Sort extract relevant values from fingerprint and sort for parsing (IFS=$'\n' @@ -174,5 +182,5 @@ while [ "${*}" != "" ] ; do done #Play footage from input for which possible matches were found if ! [ "${MODE}" = 'text' ] ; then - ffplay -hide_banner -loglevel panic -f concat -safe 0 -i "${VISUALRESULTS}" -vf drawtext=fontcolor=white:box=1:boxcolor=black@.4:fontsize=20:fontfile="/Library/Fonts/Andale Mono.ttf":textfile="${DRAWTEXT}" + ffplay -hide_banner -loglevel panic -f concat -safe 0 -i "${VISUALRESULTS}" -vf drawtext=fontcolor=white:box=1:boxcolor=black@.4:fontsize=20:fontfile="${FFMPEGFONTPATH}":textfile="${DRAWTEXT}" fi