Bläddra i källkod

Allow user and global media paths

Zachary Kotlarek 13 år sedan
förälder
incheckning
3bfd804c54
8 ändrade filer med 40 tillägg och 12 borttagningar
  1. 2 2
      findRecode
  2. 1 1
      findTorrent.sh
  3. 1 1
      folderFixup.sh
  4. 0 6
      isMediaMounted
  5. 1 0
      isMediaMounted
  6. 21 0
      mediaPath
  7. 13 1
      torrentMonitored.pl
  8. 1 1
      transmission.pl

+ 2 - 2
findRecode

@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Parameters
-FOLDER="/mnt/media/TV"
+FOLDER="`~/bin/video/mediaPath`"
 MIN_RATE=275000
 MIN_SIZE="425M"
 MIN_HEIGHT=500
@@ -55,7 +55,7 @@ for i in ${FILES}; do
 	STRINGS="`head -c 10000000 "${i}" | strings -n 100`"
 	if echo "${STRINGS}" | grep -q HandBrake; then
 		HANDBRAKE=1
-	elif echo "${STRINGS}" | grep -E '^x264 - core (79|112|120|125|129)' | grep -E 'threads=(12|24)' | grep -Eq 'crf=2[05].0'; then
+	elif echo "${STRINGS}" | grep -E '^x264 - core (79|112|120|125|129)' | grep -E 'threads=(12|24)' | grep -Eq 'crf=2[0-5]\.[0-9]'; then
 		HANDBRAKE=1
 	fi
 	if [ $HANDBRAKE -eq 1 ]; then

+ 1 - 1
findTorrent.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-BASE_DIR="/mnt/media/TV"
+BASE_DIR="`~/bin/video/mediaPath`"
 
 SERIES="${1}"
 SEASON="${2}"

+ 1 - 1
folderFixup.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Parameters
-inFolder="/mnt/media/TV"
+inFolder="`~/bin/video/mediaPath`"
 
 # Command line
 if [ -n "${1}" ]; then

+ 0 - 6
isMediaMounted

@@ -1,6 +0,0 @@
-#!/bin/bash
-
-if [ -d /mnt/media/TV ]; then
-	exit 0
-fi
-exit 1

+ 1 - 0
isMediaMounted

@@ -0,0 +1 @@
+mediaPath

+ 21 - 0
mediaPath

@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Run silent, run deep
+SILENT=0
+if [ "`basename "${0}"`" == 'isMediaMounted' ]; then
+	SILENT=1
+fi
+
+# Check the possible paths
+for i in "${HOME}/media/TV" "/mnt/media/TV"; do
+	if [ -d "${i}" ]; then
+		if [ $SILENT -le 0 ]; then
+			dir="`dirname "${i}"`"
+			echo -n "${dir}"
+		fi
+		exit 0
+	fi
+done
+
+# Return false if we don't find anything
+exit 1

+ 13 - 1
torrentMonitored.pl

@@ -6,11 +6,23 @@ use warnings;
 use File::Basename;
 
 # Parameters
-my @BASE_DIRS = ('/mnt/media/TV', '/mnt/media/Download');
+my @BASE_DIRS = ();
 my @skipped   = ();
 my @monitored = ();
 my @done      = ();
 
+# Media path(s)
+{
+	my $path = `~/bin/video/mediaPath`;
+	if (-d $path) {
+		push(@BASE_DIRS, $path);
+	}
+	$path = dirname($path) . '/Downloads';
+	if (-d $path) {
+		push(@BASE_DIRS, $path);
+	}
+}
+
 # Command-line parameters
 my ($prg) = @ARGV;
 

+ 1 - 1
transmission.pl

@@ -27,7 +27,7 @@ sub runAndCheck(@);
 
 # Parameters
 my $maxAge        = 2.5 * 86400;
-my $tvDir         = '/mnt/media/TV';
+my $tvDir         = `~/bin/video/mediaPath`;
 my $monitoredExec = '/Users/profplump/bin/video/torrentMonitored.pl';
 my $host          = 'http://localhost:9091';
 my $url           = $host . '/transmission/rpc';