tags hierarchy schema change: change add
[id3fs.git] / lib / ID3FS / AudioFile.pm
index 4086f63..59e0dfa 100644 (file)
@@ -83,34 +83,21 @@ sub year
 sub tags
 {
     my $self=shift;
-    my @tags=$self->{audiofile}->tags();
-    return({}) unless(@tags);
-    my $tags={};
-    if(@tags)
+    my @intags=$self->{audiofile}->tags();
+    my @outtags=();
+    return() unless(@intags);
+    @intags = grep { defined($_); } @intags;
+    # combine then split on commas
+    # so multiple comma-delimited tags will work
+    @intags=split(/\s*,\s*/, join(', ', @intags));
+    for my $tag (@intags)
     {
-       @tags = grep { defined($_); } @tags;
-       # combine then split on commas
-       # so multiple comma-delimited tags will work
-       @tags=split(/\s*,\s*/, join(', ', @tags));
-       for my $tag (@tags)
-       {
-           next unless(length($tag));
-           next unless($tag =~ /\S+/);
-           $tag=$self->sanitise($tag);
-
-           if($tag=~/([^\/]+)\/(.*)/)
-           {
-               my $tagname = $1;
-               my $tagval  = $self->stripslashes($2);
-               $tags->{$tagname}=$tagval;
-           }
-           else
-           {
-               $tags->{$tag}=undef;
-           }
-       }
+       next unless(length($tag));
+       next unless($tag =~ /\S+/);
+       $tag=$self->sanitise($tag);
+       push(@outtags, [ split(/\s*\/\s*/, $tag) ]);
     }
-    return $tags;
+    return @outtags;
 }
 
 sub sanitise