gnump3d-devel
[Top][All Lists]
Advanced

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

[Gnump3d-devel] [Patch] Various tag fixes for OGG files


From: John Yeates
Subject: [Gnump3d-devel] [Patch] Various tag fixes for OGG files
Date: Sat, 10 Apr 2004 12:27:10 +0100

This patch adds date and size support for OGG files, and fixes the issue where OGG lengths are displayed as total number of seconds, while MP3 lengths are displayed as mm:ss. You'll need to reindex to see the benefit, of course. (Bonus: fixed a typo in an error message, too :)

Hope unified diffs are OK...

--
John Yeates
No beer 'til you finish your tequila!

diff -urbE -x CVS gnump3d-orig/bin/gnump3d-index gnump3d/bin/gnump3d-index
--- gnump3d-orig/bin/gnump3d-index      2004-04-04 09:59:07.000000000 +0100
+++ gnump3d/bin/gnump3d-index   2004-04-10 11:49:05.000000000 +0100
@@ -116,7 +118,7 @@
#
if ( ! -e $CONFIG_FILE )
{
- print "The configuration file which I've tried to raad doesn't exist:\n"; + print "The configuration file which I've tried to read doesn't exist:\n";
    print "'$CONFIG_FILE'\n";
    print "Aborting.\n";
    exit;
@@ -418,6 +420,7 @@
          elsif( $file =~ /ogg$/i )
            {
              %TAGS = &getOGGDisplay($file);
+              $TAGS{'SIZE'} = $size unless $TAGS{'SIZE'};
            }
 @@ -581,11 +584,19 @@
    if ( keys( %tags ) )
    {
        $TAGS{'ARTIST'} = $tags{'artist'}  || "";
-       $TAGS{'COMMENT'}= $tags{'comment'} || "";
+        $TAGS{'COMMENT'}      = $tags{'comment'} || "";
        $TAGS{'GENRE'}  = $tags{'genre'}   || "";
        $TAGS{'TRACK'}  = $tags{'track'}   || "";
        $TAGS{'ALBUM'}  = $tags{'album'}   || "";
        $TAGS{'TITLE'}  = $tags{'title'}   || "";
+        $TAGS{'YEAR'}         = $tags{'year'} || "";
+        $TAGS{'SIZE'}         = $tags{'size'} || "";
+        if ($TAGS{'LENGTH'}) # Ogg returns in sss format vice mm:ss
+        {
+          my $s = $TAGS{'LENGTH'} % 60;
+          my $m = ($TAGS{'LENGTH'} - $s) / 60;
+          $TAGS{'LENGTH'} = sprintf("%d:%02d", $m, $s);
+        }
     }
     return( %TAGS );
diff -urbE -x CVS gnump3d-orig/lib/gnump3d/oggtagreader.pm gnump3d/lib/gnump3d/oggtagreader.pm --- gnump3d-orig/lib/gnump3d/oggtagreader.pm 2004-04-04 09:59:07.000000000 +0100
+++ gnump3d/lib/gnump3d/oggtagreader.pm 2004-04-04 11:23:55.000000000 +0100
@@ -68,6 +68,7 @@
    $TAGS{'comment'}  = getTag( $buff, "comment" );
    $TAGS{'genre'}    = getTag( $buff, "genre" );
    $TAGS{'track'}    = getTag( $buff, "tracknumber" );
+    $TAGS{'year'}     = getTag( $buff, "date" );
     return( %TAGS );
}
diff -urbE -x CVS gnump3d-orig/lib/gnump3d/tagcache.pm gnump3d/lib/gnump3d/tagcache.pm
--- gnump3d-orig/lib/gnump3d/tagcache.pm        2004-04-04 09:59:07.000000000 
+0100
+++ gnump3d/lib/gnump3d/tagcache.pm     2004-04-10 11:49:05.000000000 +0100
@@ -326,11 +326,12 @@
            if ( keys( %tags ) )
            {
                $TAGS{'ARTIST'} = $tags{'artist'}  || "";
-               $TAGS{'COMMENT'}= $tags{'comment'} || "";
+                $TAGS{'COMMENT'}      = $tags{'comment'} || "";
                $TAGS{'GENRE'}  = $tags{'genre'}   || "";
                $TAGS{'TRACK'}  = $tags{'track'}   || "";
                $TAGS{'ALBUM'}  = $tags{'album'}   || "";
                $TAGS{'TITLE'}  = $tags{'title'}   || "";
+                $TAGS{'YEAR'}         = $tags{'year'} || "";
            }
        }

reply via email to

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