/[gnump3d]/gnump3d/lib/gnump3d/plugins/now.pm
ViewVC logotype

Diff of /gnump3d/lib/gnump3d/plugins/now.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by skx, Mon Jul 28 22:26:14 2003 UTC revision 1.2 by skx, Thu Oct 9 11:26:52 2003 UTC
# Line 35  Line 35 
35    
36    
37  use gnump3d::files;  use gnump3d::files;
38  use gnump3d::FreezeThaw qw(freeze thaw);  # For persisting info  
39    
40  #  #
41  #  Return the author of this plugin.  #  Return the author of this plugin.
# Line 76  sub handlePath( ) Line 76  sub handlePath( )
76      $output .= "<table>\n";      $output .= "<table>\n";
77    
78      my $count = 0;      my $count = 0;
79        my @serving = ( );
80    
81      # Read existing.      # Read existing.
82      if ( defined( $NOW_PLAYING_FILE ) && ( -e $NOW_PLAYING_FILE ) )      if ( defined( $NOW_PLAYING_PATH ) && ( -d $NOW_PLAYING_PATH ) )
83      {      {
84          print "Reading '$NOW_PLAYING_FILE'\n";          print "Reading directory '$NOW_PLAYING_PATH'\n";
         my @contents = &readFile( $NOW_PLAYING_FILE );  
         my $now      = join( '\n', @contents );  
         print "READ: $now\n";  
   
         eval  
         {  
             %NOW_PLAYING = thaw( $now );  
         };  
         if ( $@ )  
         {  
             my $text = "Error restoring currently playing database for /now/ - $!\n";  
             my $out = &createNowOutput( $text );  
85    
86              sendData( $data, $out );          opendir( NOW_PLAYING, $NOW_PLAYING_PATH );
87              close( $data );          @serving = grep(/\.txt$/, readdir NOW_PLAYING);
88              return 1;          closedir( NOW_PLAYING );
         }  
89      }      }
90    
91    
# Line 112  sub handlePath( ) Line 100  sub handlePath( )
100          $extension = ".m3u";          $extension = ".m3u";
101      }      }
102    
103      foreach my $key ( sort keys( %NOW_PLAYING ) )      foreach my $ip ( @serving )
104      {      {
105          my $file    = $NOW_PLAYING{$key};          my @files    = &readFile( $NOW_PLAYING_PATH . "/" . $ip );
106            my $file     = $files[0];
107          my $display = "";   # Tag info to display.          my $display = "";   # Tag info to display.
108          my $link    = "";   # Link to the file.          my $link    = "";   # Link to the file.
109          my $dir     = "";   # Link to the containing directory.          my $dir     = "";   # Link to the containing directory.
# Line 175  sub handlePath( ) Line 164  sub handlePath( )
164          #          #
165          # Lookup the hostname if we can.          # Lookup the hostname if we can.
166          #          #
167          $key = &ipToName( $key );          if ( $ip =~ /(.*)\.txt$/ )
168            {
169                $ip = $1;
170            }
171            my $host = &ipToName( $ip );
172    
173          if ( $count eq "1" )          if ( $count eq "1" )
174            {            {
175          $output .= "<tr><td><b>Client</b></td><td><b>Track</b></td><td><b>Directory</b></td></td>\n";          $output .= "<tr><td><b>Client</b></td><td><b>Track</b></td><td><b>Directory</b></td></td>\n";
176            }            }
177          $output .= "<tr><td>$key</td><td><a href='$link$extension'>$display</a></td><td><a href='$dir'>$dirDisplay</a></td></td>\n";          $output .= "<tr><td>$host</td><td><a href='$link$extension'>$display</a></td><td><a href='$dir'>$dirDisplay</a></td></td>\n";
178      }      }
179    
180      if ( $count eq 0 )      if ( $count eq 0 )

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26