Kaynağa Gözat

Merge branch 'master' of github.com:profplump/UberZach-Video

Zachary Kotlarek 12 yıl önce
ebeveyn
işleme
90b6c88c91
2 değiştirilmiş dosya ile 25 ekleme ve 8 silme
  1. 1 1
      mountMedia
  2. 24 7
      transmission.pl

+ 1 - 1
mountMedia

@@ -55,7 +55,7 @@ if [ -z "${MEDIA}" ]; then
 	fi
 	if [ $LOCKED -eq 0 ]; then
 		echo $$ > "${LOCK}"
-		osascript -e 'tell application "Finder" to mount volume "smb://'"${REMOTE_USER}@${HOST}/${SHARE}"'"'
+		~/bin/video/timeout -t 30 osascript -e 'tell application "Finder" to mount volume "smb://'"${REMOTE_USER}@${HOST}/${SHARE}"'"'
 		sleep 5
 		rm -f "${LOCK}"
 	fi

+ 24 - 7
transmission.pl

@@ -368,14 +368,31 @@ sub getDest($$$$) {
 				next;
 			}
 
-			# Bail if we find more than one matching series
+			# If we find more than one matching series
 			if (length($series) > 0) {
-				print STDERR 'Matched both ' . $series . ' and ' . $show . "\n";
-				return;
-			}
 
-			# If we're still around this is the first series title match
-			$series = $show;
+				# If the old match is a subset of the new match, prefer the new match
+				# If the new match is a subet of the old match, prefer the old match
+				# Bail if the matches do not overlap
+				if ($show =~ m/^${series}\b/) {
+					if ($DEBUG) {
+						print STDERR 'Using longer match (' . $showsCan{$show} . ') in place of shorter match (' . $showsCan{$series} . ")\n";
+					}
+					$series = $show;
+				} elsif ($series =~ m/^${show}\b/) {
+					if ($DEBUG) {
+						print STDERR 'Using longer match (' . $showsCan{$series} . ') in place of shorter match (' . $showsCan{$show} . ")\n";
+					}
+					$series = $series;
+				} else {
+					print STDERR 'Matched both ' . $showsCan{$series} . ' and ' . $showsCan{$show} . "\n";
+					return;
+				}
+			} else {
+
+				# If we're still around this is the first series title match
+				$series = $show;
+			}
 		}
 	}
 	if (length($series) < 1) {
@@ -620,7 +637,7 @@ sub unrar($$) {
 sub seriesCleanupLocal($) {
 	my ($name) = @_;
 	$name =~ s/\.//g;
-	return seriesCleanup($name);
+	return seriesCleanupCore($name);
 }
 
 sub seriesCleanupCore($) {