소스 검색

Allow seperate recoding and remuxing

Zachary Kotlarek 11 년 전
부모
커밋
000ef5518d
3개의 변경된 파일과 34개의 추가작업 그리고 16개의 파일을 삭제
  1. 9 0
      canRecode.sh
  2. 17 13
      folderToMKV.sh
  3. 8 3
      toMKV.sh

+ 9 - 0
canRecode.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Only OS X machines can recode currently
+if [ "`uname`" == "Darwin" ]; then
+	exit 0
+fi
+
+# Everything else cannot
+exit 1

+ 17 - 13
folderToMKV.sh

@@ -18,19 +18,23 @@ if [ `ps auwx | grep -v grep | grep "${me}" | wc -l` -gt 10 ]; then
 	exit 0
 fi
 
-# Prefer recoding to rewrapping if the file is overrate
-~/bin/video/findRecode0 "${inFolder}" | xargs -0 -n1 ~/bin/video/recode
-
-# MPEGs must be recoded, not just re-wrapped
-for i in "${inFolder}/"*.[mM][pP][gG] "${inFolder}/"*.[mM][pP][eE][gG]; do
-	# Make sure the file is reasonable
-	if [ ! -e "${i}" ]; then
-		continue
-	fi
-
-	# Recode
-	~/bin/video/recode "${i}"
-done
+# Skip recoding if the host is not capable
+if ~/bin/video/canRecode.sh; then
+
+	# Prefer recoding to rewrapping if the file is overrate
+	~/bin/video/findRecode0 "${inFolder}" | xargs -0 -n1 ~/bin/video/recode
+
+	# MPEGs must be recoded, not just re-wrapped
+	for i in "${inFolder}/"*.[mM][pP][gG] "${inFolder}/"*.[mM][pP][eE][gG]; do
+		# Make sure the file is reasonable
+		if [ ! -e "${i}" ]; then
+			continue
+		fi
+
+		# Recode
+		~/bin/video/recode "${i}"
+	done
+fi
 
 # Move to the input folder
 inFolder="`cd "${inFolder}" && pwd`"

+ 8 - 3
toMKV.sh

@@ -64,9 +64,14 @@ if [ ! -e "${tmpFile}" ] || [ `stat -f '%z' "${tmpFile}"` -lt 1000 ]; then
 	echo "`basename "${0}"`: Error creating output file for input: ${inFile}" 1>&2
 
 	# Try to recode (with Handbrake/ffmpeg) if mkvmerge fails
-	echo "`basename "${0}"`: Attempting recode instead..." 1>&2
-	~/bin/video/recode "${inFile}"
-	exit "${?}"
+	if ~/bin/video/canRecode.sh; then
+		echo "`basename "${0}"`: Attempting recode instead..." 1>&2
+		~/bin/video/recode "${inFile}"
+		exit "${?}"
+	else
+		echo "`basename "${0}"`: Unable to recode." 1>&2
+		exit 1
+	fi
 fi
 
 # Move into place, dropping the original