Browse Source

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 năm trước cách đây
mục cha
commit
d62689e2f8
1 tập tin đã thay đổi với 7 bổ sung và 7 xóa
  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);
 		}