File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed
src/plugins/synced-lyrics/renderer/lyrics Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -132,23 +132,12 @@ export const getLyricsList = async (
132132 const artists = artist . split ( / [ & , ] / g) . map ( ( i ) => i . trim ( ) ) ;
133133 const itemArtists = artistName . split ( / [ & , ] / g) . map ( ( i ) => i . trim ( ) ) ;
134134
135- const permutations = [ ] ;
136- for ( const artistA of artists ) {
137- for ( const artistB of itemArtists ) {
138- permutations . push ( [ artistA . toLowerCase ( ) , artistB . toLowerCase ( ) ] ) ;
139- }
140- }
141-
142- for ( const artistA of itemArtists ) {
143- for ( const artistB of artists ) {
144- permutations . push ( [ artistA . toLowerCase ( ) , artistB . toLowerCase ( ) ] ) ;
145- }
146- }
135+ const permutations = artists . flatMap ( ( artistA ) =>
136+ itemArtists . map ( ( artistB ) => [ artistA . toLowerCase ( ) , artistB . toLowerCase ( ) ] )
137+ ) ;
147138
148139 const ratio = Math . max ( ...permutations . map ( ( [ x , y ] ) => jaroWinkler ( x , y ) ) ) ;
149-
150- if ( ratio <= 0.9 ) continue ;
151- filteredResults . push ( item ) ;
140+ if ( ratio > 0.9 ) filteredResults . push ( item ) ;
152141 }
153142
154143 const duration = songData . songDuration ;
You can’t perform that action at this time.
0 commit comments