Przeglądaj źródła

Resume the transfer if the NFO does not exist

Zachary Kotlarek 12 lat temu
rodzic
commit
6852ed14e4
1 zmienionych plików z 4 dodań i 8 usunięć
  1. 4 8
      yt/ytList.pl

+ 4 - 8
yt/ytList.pl

@@ -90,8 +90,11 @@ foreach my $id (keys(%{$videos})) {
 		$safeTitle =~ s/[^\w\-\.\?\!\&\,\; ]/_/g;
 		$safeTitle =~ s/[^\w\-\.\?\!\&\,\; ]/_/g;
 		$basePath = $dir . '/' . sprintf('%02d', $videos->{$id}->{'number'}) . ' - ' . $safeTitle . ' (' . $id . ').';
 		$basePath = $dir . '/' . sprintf('%02d', $videos->{$id}->{'number'}) . ' - ' . $safeTitle . ' (' . $id . ').';
 	}
 	}
+	my $nfo = $basePath . 'nfo';
 
 
-	if (!exists($files->{$id})) {
+	# If we haven't heard of the file, or don't have an NFO for it
+	# Checking for the NFO allows use to resume failed downloads
+	if (!exists($files->{$id}) || !-e $nfo) {
 		if ($DEBUG) {
 		if ($DEBUG) {
 			print STDERR 'Fetching video: ' . $id . "\n";
 			print STDERR 'Fetching video: ' . $id . "\n";
 		}
 		}
@@ -118,13 +121,6 @@ foreach my $id (keys(%{$videos})) {
 				system(@cmd);
 				system(@cmd);
 			}
 			}
 		}
 		}
-	}
-
-	if (!exists($files->{$id}) || !-e $files->{$id}->{'nfo'}) {
-		my $nfo = $basePath . 'nfo';
-		if ($DEBUG) {
-			print STDERR 'Creating NFO: ' . $nfo . "\n";
-		}
 
 
 		# Build the XML document
 		# Build the XML document
 		my $xml = buildNFO($videos->{$id});
 		my $xml = buildNFO($videos->{$id});