Przeglądaj źródła

Support both size specifications

Zachary Kotlarek 14 lat temu
rodzic
commit
0c61062774
1 zmienionych plików z 8 dodań i 5 usunięć
  1. 8 5
      findTorrent.pl

+ 8 - 5
findTorrent.pl

@@ -422,15 +422,18 @@ foreach my $tr (@trs) {
 		$leaches = $2;
 		$leaches = $2;
 	}
 	}
 
 
-	# Extract the size
+	# Extract the size (from separate column or inline)
 	my $size = 0;
 	my $size = 0;
 	my $unit = 'M';
 	my $unit = 'M';
-	if ($tr =~ m/(\d+(?:\.\d+)?)\&nbsp\;(G|M)iB\<\/[tT][dD]\>/) {
+	if ($tr =~ m/Size (\d+(?:\.\d+)?)\&nbsp\;(G|M)iB/) {
 		$size = $1;
 		$size = $1;
 		$unit = $2;
 		$unit = $2;
-		if ($unit eq 'G') {
-			$size *= 1024;
-		}
+	} elsif ($tr =~ m/(\d+(?:\.\d+)?)\&nbsp\;(G|M)iB\<\/[tT][dD]\>/) {
+		$size = $1;
+		$unit = $2;
+	}
+	if ($unit eq 'G') {
+		$size *= 1024;
 	}
 	}
 	$size = int($size);
 	$size = int($size);