Couple usability fixes.

Amos Hayes <[email protected]> Tue, 16 Oct 2001 10:38:51 -0400 (EDT)
Newsgroups gmane.music.equipment.slimp3.dev
Message-ID <[email protected]>

I submitted these changes to Sean a few days ago but not in the proper
diff format. I haven't seen them in CVS yet so here they are again.

- Small change to usage printout in server.pl
- Some more user friendly error catching in setup.pl. (Brought about after
seeing warnings about adding 0 to "".)


--
Amos Hayes
[email protected]




Index: server/server.pl
===================================================================
RCS file: /cvsroot/slimp3/slimp3/server/server.pl,v
retrieving revision 1.21
diff -u -p -B -r1.21 server.pl
--- server/server.pl	2001/10/16 01:52:07	1.21
+++ server/server.pl	2001/10/16 04:08:28
@@ -205,7 +205,7 @@ Usage: $0 [--mp3dir <dir>] [--httpport <
 	--mp3dir   => The location of your MP3 files.
 	--daemon   => Run the server in the background.
 		          This may only work on Unix-like systems.
-	--httpport => Run the server in the background.
+	--httpport => Activate the web interface on the specified port.

 	--d_d	 => Show what (should be) on the slimp3's display
 	--d_p	 => Show streaming protocol, buffer usage
Index: server/setup.pl
===================================================================
RCS file: /cvsroot/slimp3/slimp3/server/setup.pl,v
retrieving revision 1.6
diff -u -p -B -r1.6 setup.pl
--- server/setup.pl	2001/10/16 01:53:08	1.6
+++ server/setup.pl	2001/10/16 04:08:28
@@ -66,21 +66,32 @@ sub main {

 	my $httpon=<STDIN>;

-	if ($httpon=~/^y/i) {
-
-		print "\nWhich port would you like to use to access the server? [9000]";
-
-		my $httpport=<STDIN>;
-
-		chomp($httpport);
-
-		$httpport = $httpport +0;  # make sure it's a number
-
-		if ($httpport == 0) {
-			$httpport = 9000;
+	if ($httpon=~/^\s*y/i) {
+		my $httpport= 0;
+		my $httpportOk = 0;
+		while (!$httpportOk) {
+			print "\nWhich port would you like to use to access the server? [9000]: ";
+
+			$httpport=<STDIN>;
+
+			chomp($httpport);
+			if ($httpport =~ m/^\s*$/) {
+				$httpport = 9000;
+			}
+			if ($httpport =~ s/^\s*?(\d*)\s*$/$1/) {
+				if ($httpport > 0 && $httpport < 65536) {
+					$httpportOk = 1;
+					next;
+				}
+			}
+			print "\nOops - That does not appear to be a valid port number. Please try again.\n";
 		}

-		print "\n  The URL to access the SliMP3 player is: http://" . hostname . ":" . $httpport . "/\n\n";
+		if (hostname) {
+			print "\n  The URL to access the SliMP3 player will likely be:\n\thttp://" . hostname . ":" . $httpport . "/\n\n";
+		} else {
+			print "\n  The URL to access the SliMP3 player will be something like:\n\thttp://yoursystemname:" . $httpport . "/\n\n";
+		}
 		print PREFS '$main::httpport = ' . $httpport . "; #    http server port\n";

 	} else {
@@ -117,7 +128,7 @@ sub main {
 	# and return true
 	print PREFS "\n1;\n";

-	print "Setup is complete!";
+	print "\nSetup is complete!";
 	print "Press Apple-Q to quit." if $^O =~ /Mac/i;
 	print "\n\n";



To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/