only complain about missing albums if $verbose, complain about artists always
[id3fs.git] / lib / ID3FS / AudioFile / Ogg.pm
index ed6c17a..649b450 100644 (file)
@@ -1,4 +1,4 @@
-package ID3FS::File::Ogg;
+package ID3FS::AudioFile::Ogg;
 
 use strict;
 use warnings;
@@ -19,7 +19,7 @@ sub new
 
 sub get
 {
-    my ($self, $tag, $complain)=@_;
+    my ($self, $tag)=@_;
     for my $commenttype (@{$self->{comments}})
     {
        if($commenttype =~ /$tag/i)
@@ -41,28 +41,15 @@ sub get
            }
        }
     }
-    warn("$self->{path}: no $tag defined in Ogg comments\n") if($complain);
     return undef;
 }
 
-sub artist    { shift->get("Artist", 1); }
-sub album     { shift->get("Album", 1);  }
-sub audiotype { return "ogg";            }
-sub haspic    { return undef;            } # FIXME
-sub v1genre   { return undef;            } # ID3 only
-
-# We don't care if year is not set
-sub year
-{
-    my ($self)=@_;
-    my $date=shift->get("Date", 0);
-    return undef unless($date);
-    if($date =~/(\d\d\d\d)/)
-    {
-       $date=$1;
-    }
-    return $date;
-}
+sub artist    { shift->get("Artist"); }
+sub album     { shift->get("Album");  }
+sub audiotype { return "ogg";         }
+sub haspic    { return undef;         } # FIXME
+sub v1genre   { return undef;         } # ID3 only
+sub year      { shift->get("Date");   }
 
 sub tags
 {
@@ -75,32 +62,7 @@ sub tags
            push(@comments,$self->{ogg}->comment($commenttype));
        }
     }
-    my $tags={};
-    if(@comments)
-    {
-       # filter for useful comments
-       @comments= grep { defined($_); } @comments;
-       @comments= grep { length($_); }  @comments;
-       @comments= grep { /\S+/; }       @comments;
-       # combine then split on commas
-       # so multiple comma-delimited tags will work
-       @comments=split(/\s*,\s*/, join(', ', @comments));
-       for my $comment (@comments)
-       {
-           if($comment=~/([^\/]+)\/(.*)/)
-           {
-               my $tagname=$1;
-               my $tagval=$2;
-               $tagval=~s/\//-/g;
-               $tags->{$tagname}=$tagval;
-           }
-           else
-           {
-               $tags->{$comment}=undef;
-           }
-       }
-    }
-    return $tags;
+    return(@comments);
 }
 
 1;