gnump3d-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnump3d-devel] Playlist & Stream info


From: Ross Mohn
Subject: Re: [Gnump3d-devel] Playlist & Stream info
Date: Tue, 22 Nov 2005 17:28:57 -0500

Here are the unified diffs for the two files. If it's easy to work from, I can send them as file attachments. Let me know! -Ross


File: /usr/bin/gnump3d2
Version: $Id: gnump3d2,v 1.109 2005/10/28 14:07:55 skx Exp $
diff --unified gnump3d2.000 gnump3d2.001
--- gnump3d2.000        2005-11-21 08:54:50.000000000 -0500
+++ gnump3d2.001        2005-11-21 12:03:53.000000000 -0500
@@ -2376,10 +2376,7 @@
                #
                # Build up the text to insert into the file lists.
                #
-               my $link = $path ."/" . $file;
-
-               # URL Encode link to playlist.
-               $link = &urlEncode( $file );
+               my $link = &urlEncode( "$path/$file" );

                #
                # Do the interpolation.
@@ -2394,6 +2391,7 @@
                  $output = $file_format2;
                }
                $output    =~ s/\$LINK/$link/g;
+               $output    =~ s/\$PLAINLINK/$link/g;
                $output    =~ s/\$SONG_FORMAT/$display/g;

                #


File: /usr/lib/gnump3d/gnump3d/plugins/info.pm
Version: $Id: info.pm,v 1.7 2005/08/12 04:25:54 pizza Exp $
diff --unified info.000.pm info.pm
--- info.000.pm 2005-11-21 08:54:50.000000000 -0500
+++ info.pm     2005-11-22 16:53:40.000000000 -0500
@@ -136,23 +136,66 @@
        exit 1;
     }

+    # Link to the parent directory.
+    my $dir = "/";
+    if ( $play =~ /(.*)\/(.*)/ )
+    {
+      $dir = $1 . "/";
+    }
+
     my %TAGS = &main::getTags($track);

     my $output = "";
-    $output .= "<table>\n";
+    $output .= "<table width='100%'>\n";

-    foreach my $key ( sort keys( %TAGS ) )
+    if ( &isPlaylist( $track ) )
     {
-       $output .= "<tr><td><b>$key</b></td><td>" . $TAGS{$key} . "</td></tr>\n";
+        open( FILY, "<$track" );
+        while (defined(my $line = <FILY>) )
+        {
+            chomp $line;
+            if ($line =~ s/^#EXTINF:(-1|\d+),([^:]+)(:(.+)?)?$//)
+            {
+                my $time = $1;
+                my $name = $2;
+                my $site = $4 if defined ($4);
+
+                my $streamtext = "more info";
+                if ($time eq "-1")
+                {
+                    $time="$streamtext";
+                } else
+                {
+                    my $s = $time % 60;
+                    my $m = ($time - $s) / 60;
+                    $time = sprintf("%d:%02d", $m, $s);
+                }
+
+                my $tune = <FILY>;
+                chomp $tune;
+
+                $output .= "<tr><td width='10%'>&nbsp;</td>";
+                $output .= "<td>$name</td><td align='right'>";
+                if (defined( $site ) && $time eq "$streamtext")
+                {
+                    $output .= "<a href='' target='_blank'>[$time]</a>";
+                } elsif ($time eq "$streamtext")
+                {
+                    $output .= "&nbsp;";
+                } else
+                {
+                    $output .= "[$time]";
+                }
+                $output .= "</td></tr>\n";
+            }
+        }
+        close( FILY );
     }
-    $output .= "</table>\n";
-
-
-    # Link to the parent directory.
-    my $dir = "/";
-    if ( $play =~ /(.*)\/(.*)/ )
+    else
     {
-      $dir = $1 . "/";
+    foreach my $key ( sort keys( %TAGS ) )
+    {
+    $output .= "<tr><td><b>$key</b></td><td>" . $TAGS{$key} . "</td></tr>\n";
     }

     # Link to the song.
@@ -160,6 +203,10 @@
     {
       $play .= ".m3u";
     }
+    }
+
+    $output .= "</table>\n";
+

     # Escape the filename and directory names correctly.
     $play = &urlEncode( $play );




On Tue, 2005-11-22 at 17:09 +0000, Steve Kemp wrote:
On Tue, Nov 22, 2005 at 10:25:30AM -0500, Ross Mohn wrote:
>    I have a submission that makes the "info" link work for *.m3u style
>    playlists. I also use it to provide a "more info" link for Streaming Media
>    playlists.

  Sounds good.

>    I'd like to submit diff files for /usr/bin/gnump3d2 and
>    /usr/lib/gnump3d/gnump3d/plugins/info.pm unless others feel these are
>    inappropriate features. Shall I attach them to an email to this list, or
>    is there a better way?

  Mail them here if they are short diffs (<200 lines, give or take).
 Otherwise mail me.

  I *massively* prefer '--unified' diffs to 'context diffs' ..
 If the code looks good I'll commit it, as it seems like it shouldnt
 cause any problems to people not using the files as you are.

  (I've been watching discussion on the -users mailing list and its
 probably about time I committed some code ;)

Steve
--

-- 
Ross Mohn
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]