Zachary Kotlarek 12 лет назад
Родитель
Сommit
8a8129fc0b
3 измененных файлов с 25 добавлено и 12 удалено
  1. 1 1
      sync/recentlyUnwatched.sh
  2. 15 4
      sync/sync.sh
  3. 9 7
      sync/syncUnwatched.sh

+ 1 - 1
sync/recentlyUnwatched.sh

@@ -74,7 +74,7 @@ for i in $SERIES; do
 			continue
 		fi
 
-		# Print the name, decoding both hex encoding and XML entities
+		# Print the name, decoding both hex encoding and XML entities, and fixing SMB mapping
 		echo "${j}" | \
 			sed 's/%C3%A9/é/' | \
 			perl -pe 's/%([0-9a-f]{2})/sprintf("%s", pack("H2",$1))/eig' | \

+ 15 - 4
sync/sync.sh

@@ -1,14 +1,22 @@
 #!/bin/bash
 
-# Target path
+# Parameters
 TARGET="Heady"
-
-# Establish a base of operations
 BASE_DIR="`~/bin/video/mediaPath`"
 
-# We need an input directory
+# Environmental parameters
+if [ "${DEBUG}" ]; then
+        DEBUG=1
+else
+	DEBUG=0
+fi
+
+# Command-line parameters
 SUB_DIR="${1}"
 
+# Deal with SMB mappings
+SUB_DIR="`echo "${SUB_DIR}" | sed 's%\?%%g'`"
+
 # Allow absolute paths, or those relative to the media path
 if [ "`echo "${SUB_DIR}" | head -c 1`" == '/' ]; then
 	SUB_DIR="`echo "${SUB_DIR}" | sed "s%^${BASE_DIR}/%%"`"
@@ -82,6 +90,9 @@ for infile in $FILES; do
 
 	# Skip files that exist
 	if ls "${OUT_DIR}/${nobase}".* >/dev/null 2>&1; then
+		if [ $DEBUG -gt 0 ]; then
+			echo "Skipping: ${infile}" 1>&2
+		fi
 		continue
 	fi
 

+ 9 - 7
sync/syncUnwatched.sh

@@ -5,13 +5,15 @@ TARGET="Heady"
 BASE_DIR="`~/bin/video/mediaPath`/${TARGET}"
 
 # Environmental parameters
-DEBUG=0
-if [ -n "${DEBUG}" ]; then
+if [ "${DEBUG}" ]; then
 	DEBUG=1
+else
+	DEBUG=0
 fi
-NO_WRITE=0
-if [ -n "${NO_WRITE}" ]; then
-	NO_WRITE=1
+if [ "${NO_SYNC}" ]; then
+	NO_SYNC=1
+else
+	NO_SYNC=0
 fi
 
 # Command-line options
@@ -74,7 +76,7 @@ for i in $FILES; do
 	if [ $DEBUG -gt 0 ]; then
 		echo "Will encode: ${i}"
 	fi
-	if [ $NO_WRITE -eq 0 ]; then
+	if [ $NO_SYNC -eq 0 ]; then
 		~/bin/video/sync/sync.sh "${i}"
 	fi
 
@@ -88,7 +90,7 @@ for i in $OLD_FILES; do
 	if [ $DEBUG -gt 0 ]; then
 		echo "Will delete: ${BASE_DIR}/${i}"
 	fi
-	if [ $NO_WRITE -eq 0 ]; then
+	if [ $NO_SYNC -eq 0 ]; then
 		rm -f "${BASE_DIR}/${i}"
 	fi
 done