private static Map < Integer , LinkedList < MetadataCache > > gatherCandidateAttachmentGroups ( ) { Map < Integer , LinkedList < MetadataCache > > candidateGroups = new TreeMap < Integer , LinkedList < MetadataCache > > ( ) ; final Iterator < File > iterator = MetadataFinder . getInstance ( ) . getAutoAttachCacheFiles ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { final File file = iterator . next ( ) ; try { final MetadataCache candidate = new MetadataCache ( file ) ; if ( candidateGroups . get ( candidate . sourcePlaylist ) == null ) { candidateGroups . put ( candidate . sourcePlaylist , new LinkedList < MetadataCache > ( ) ) ; } candidateGroups . get ( candidate . sourcePlaylist ) . add ( candidate ) ; } catch ( Exception e ) { logger . error ( "Unable to open metadata cache file " + file + ", discarding" , e ) ; iterator . remove ( ) ; } } return candidateGroups ; }
Groups all of the metadata cache files that are candidates for auto - attachment to player slots into lists that are keyed by the playlist ID used to create the cache file . Files that cache all tracks have a playlist ID of 0 .