소스 검색

More subtle case folding, to support UIDs (which are case sensitive) in addition to channel names (which are not and YT capitalizes more or less randomly across the interaces)

Zachary Kotlarek 11 년 전
부모
커밋
d62689e2f8
1개의 변경된 파일과 7개의 추가작업 그리고 7개의 파일을 삭제
  1. 7 7
      yt/subscribe.pl

+ 7 - 7
yt/subscribe.pl

@@ -624,23 +624,23 @@ sub saveSubscriptions($$) {
 		if (!-d $folder . '/' . $file) {
 			next;
 		}
-
-		# YT has case issues
-		$file = lc($file);
-
+		
+		# YT has some trouble with case
+		my $lcFile = lc($file);
+		
 		# Anything else should be in the list
-		if (!$subs->{$file}) {
+		if (!$subs->{$file} && !$subs->{$lcFile}) {
 			print STDERR 'Missing YT subscription for: ' . $file . "\n";
 		}
 
 		# Note local subscriptions
-		$locals{$file} = 1;
+		$locals{$lcFile} = 1;
 	}
 	closedir($fh);
 
 	# Check for YT subscriptions missing locally
 	foreach my $sub (keys(%{$subs})) {
-		if (!exists($locals{$sub})) {
+		if (!exists($locals{lc($sub)})) {
 			print STDERR 'Adding local subscription for: ' . $sub . ' (' . $subs->{$sub} . ")\n";
 			mkdir($folder . '/' . $sub);
 		}