@@ -133,6 +133,10 @@ sub getTag {
133
133
# suck in metadata for all these tags
134
134
my $items = $class -> _getSubFileTags($s , $tracks );
135
135
136
+ foreach (values %$tracks ) {
137
+ Slim::Formats::sanitizeTagValues($_ , $file );
138
+ }
139
+
136
140
# fallback if we can't parse metadata
137
141
if ( $items < 1 ) {
138
142
logWarning(" Unable to find metadata for tracks referenced by cuesheet: [$file ]" );
@@ -217,13 +221,13 @@ sub _getStandardTag {
217
221
my $tags = $s -> {tags } || {};
218
222
219
223
$class -> _addInfoTags($s , $tags );
220
- $class -> _doTagMapping ($tags );
224
+ $class -> doTagMapping ($tags );
221
225
$class -> _addArtworkTags($s , $tags );
222
226
223
227
return $tags ;
224
228
}
225
229
226
- sub _doTagMapping {
230
+ sub doTagMapping {
227
231
my ($class , $tags ) = @_ ;
228
232
229
233
# Map ID3 tags first, so FLAC tags win out
@@ -349,10 +353,6 @@ sub _getSubFileTags {
349
353
$items = $class -> _getCUEinVCs($s , $tracks );
350
354
return $items if $items > 0;
351
355
352
- # try parsing stacked vorbis comments
353
- $items = $class -> _getStackedVCs($s , $tracks );
354
- return $items if $items > 0;
355
-
356
356
# This won't yield good results - but without it, we regress from 6.0.2
357
357
my $tags = $class -> _getStandardTag($s );
358
358
@@ -532,7 +532,7 @@ sub _getXMLTags {
532
532
533
533
%{$tracks -> {$cuesheetTrack }} = (%{$defaultTags }, %{$tracks -> {$cuesheetTrack }});
534
534
535
- $class -> _doTagMapping ($tracks -> {$cuesheetTrack });
535
+ $class -> doTagMapping ($tracks -> {$cuesheetTrack });
536
536
}
537
537
}
538
538
@@ -627,7 +627,7 @@ sub _getNumberedVCs {
627
627
628
628
%{$tracks -> {$num }} = (%{$defaultTags }, %{$tracks -> {$num }});
629
629
630
- $class -> _doTagMapping ($tracks -> {$num });
630
+ $class -> doTagMapping ($tracks -> {$num });
631
631
632
632
$tracks -> {$num }-> {TRACKNUM } = $num unless exists $tracks -> {$num }-> {TRACKNUM };
633
633
}
@@ -726,7 +726,7 @@ sub _getCDDBTags {
726
726
727
727
%{$tracks -> {$key }} = (%{$tags }, %{$tracks -> {$key }});
728
728
729
- $class -> _doTagMapping ($tracks -> {$key });
729
+ $class -> doTagMapping ($tracks -> {$key });
730
730
}
731
731
732
732
return $items ;
@@ -783,115 +783,14 @@ sub _getCUEinVCs {
783
783
}
784
784
}
785
785
786
- $class -> _doTagMapping ($tracks -> {$key });
786
+ $class -> doTagMapping ($tracks -> {$key });
787
787
788
788
$items ++;
789
789
}
790
790
791
791
return $items ;
792
792
}
793
793
794
- sub _getStackedVCs {
795
- my ($class , $s , $tracks ) = @_ ;
796
-
797
- my $items = 0;
798
-
799
- # XXX: can't support this using Audio::Scan, this is a stupid tag scheme anyway!
800
- return 0;
801
-
802
- =pod
803
- # parse "stacked" vorbis comments
804
- # this is tricky when it comes to matching which groups belong together
805
- # particularly for various artist, or multiple album compilations.
806
- # this as also not terribly efficent, so it's not our first choice.
807
-
808
- # here's a simple example of the sort of thing we're trying to work with
809
- #
810
- # ARTIST=foo
811
- # ALBUM=bar
812
- # TRACKNUMBER=1
813
- # TITLE=baz
814
- # TRACKNUMBER=2
815
- # TITLE=something
816
-
817
- # grab the raw comments for parsing
818
- my $rawTags = $flac->{'rawTags'};
819
-
820
- # grab the cuesheet for reference
821
- my $cuesheet = $flac->cuesheet();
822
-
823
- # validate number of TITLE tags against number of
824
- # tracks in the cuesheet
825
- my $titletags = 0;
826
- my $cuetracks = 0;
827
-
828
- for my $tag (@$rawTags) {
829
- $titletags++ if $tag =~ /^\s*TITLE=/i;
830
- }
831
-
832
- for my $track (@$cuesheet) {
833
- $cuetracks++ if $track =~ /^\s*TRACK/i;
834
- }
835
-
836
- return 0 unless $titletags == $cuetracks;
837
-
838
-
839
- # ok, let's see which tags apply to which tracks
840
-
841
- my $tempTags = {};
842
- my $defaultTags = {};
843
-
844
- $class->_addInfoTags($flac, $defaultTags);
845
-
846
- for my $tag (@$rawTags) {
847
-
848
- # Match the key and value
849
- if ($tag =~ /^(.*?)=(.*?)[\r\n]*$/) {
850
-
851
- # Make the key uppercase
852
- my $tkey = uc($1);
853
- my $value = $2;
854
-
855
- # use duplicate detection to find track boundries
856
- # retain file wide values as defaults
857
- if (defined $tempTags->{$tkey}) {
858
- $items++;
859
- my %merged = (%{$defaultTags}, %{$tempTags});
860
- $defaultTags = \%merged;
861
- $tempTags = {};
862
-
863
- # set the tags on the track
864
- %{$tracks->{$items}} = (%{$tracks->{$items}}, %{$defaultTags});
865
-
866
- $class->_doTagMapping($tracks->{$items});
867
-
868
- if (!exists $tracks->{$items}->{'TRACKNUM'}) {
869
- $tracks->{$items}->{'TRACKNUM'} = $items;
870
- }
871
-
872
- }
873
-
874
- $tempTags->{$tkey} = $value;
875
-
876
- main::DEBUGLOG && logger('formats.playlists')->debug(" $tkey: $value");
877
- }
878
- }
879
-
880
- # process the final track
881
- $items++;
882
-
883
- %{$tracks->{$items}} = (%{$tracks->{$items}}, %{$defaultTags}, %{$tempTags});
884
-
885
- $class->_doTagMapping($tracks->{$items});
886
-
887
- if (!exists $tracks->{$items}->{'TRACKNUM'}) {
888
- $tracks->{$items}->{'TRACKNUM'} = $items;
889
- }
890
-
891
- return $items;
892
- =cut
893
- }
894
-
895
794
=head2 findFrameBoundaries( $fh, $offset, $time )
896
795
897
796
Returns offset to audio frame containing $time.
0 commit comments