projects
/
id3fs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
id3fs-tag: -V: summarize tags in directories
[id3fs.git]
/
lib
/
ID3FS
/
AudioFile
/
Mp3.pm
diff --git
a/lib/ID3FS/AudioFile/Mp3.pm
b/lib/ID3FS/AudioFile/Mp3.pm
index
2b90b5d
..
8ec87ef
100644
(file)
--- a/
lib/ID3FS/AudioFile/Mp3.pm
+++ b/
lib/ID3FS/AudioFile/Mp3.pm
@@
-18,6
+18,7
@@
package ID3FS::AudioFile::Mp3;
use strict;
use warnings;
use strict;
use warnings;
+use ID3FS::AudioFile;
use MP3::Tag;
use MP3::Info;
use MP3::Tag;
use MP3::Info;
@@
-145,7
+146,7
@@
sub add_tags
my($self, @tags)=@_;
my $existing=$self->tags();
my @existing=split(/\s*,\s*/, $existing) if($existing);
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));
}
my $genre=join(', ', @merged);
return($self->set("genre", $genre));
}
@@
-204,14
+205,24
@@
sub delete_genre { shift->delete("genre"); }
sub delete_tags
{
sub delete_tags
{
- my($self,
@tag
s)=@_;
+ my($self,
$tags, $delval
s)=@_;
my $current=$self->tags();
my @current=split(/\s*,\s*/, $current);
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}));
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);
}
my @tagsout=sort keys(%hash);
my $genre=join(', ', @tagsout);
@@
-291,13
+302,6
@@
sub delete
}
}
}
}
-sub uniq
-{
- my ($self, @things)=@_;
- my %hash=();
- @hash{@things}=();
- return(sort keys(%hash));
-}
sub channels
{
sub channels
{