use strict;
use warnings;
+use ID3FS::AudioFile;
use MP3::Tag;
use MP3::Info;
my($self, @tags)=@_;
my $existing=$self->tags();
my @existing=split(/\s*,\s*/, $existing) if($existing);
- my @merged=$self->uniq(@tags, @existing);
+ my @merged=ID3FS::AudioFile::uniq(@tags, @existing);
my $genre=join(', ', @merged);
return($self->set("genre", $genre));
}
sub delete_tags
{
- my($self, @tags)=@_;
+ my($self, $tags, $delvals)=@_;
my $current=$self->tags();
my @current=split(/\s*,\s*/, $current);
+ my @tags=split(/\s*,\s*/, $tags);
my %hash=();
@hash{@current}=();
for my $tag (@tags)
{
delete($hash{$tag}) if(exists($hash{$tag}));
+ if($delvals)
+ {
+ my $base=($tag =~ /(.*?)\//)[0];
+ $base=$tag unless($base);
+ for my $curtag (keys %hash)
+ {
+ delete($hash{$curtag}) if($curtag =~ /^$base\//);
+ }
+ }
}
my @tagsout=sort keys(%hash);
my $genre=join(', ', @tagsout);
}
}
-sub uniq
-{
- my ($self, @things)=@_;
- my %hash=();
- @hash{@things}=();
- return(sort keys(%hash));
-}
sub channels
{