Exemple #1
0
        private GenreFilteredAlbum GetOrCreateGenreFilteredAlbum(Album album, MPDSongResponseBlock block)
        {
            Genre genre = Genres[block.Genre ?? UnknownGenre];

            if (!m_GenreFilteredAlbumLookup.ContainsKey(genre))
            {
                m_GenreFilteredAlbumLookup[genre] = new SortedDictionary<Album, GenreFilteredAlbum>();
            }

            IDictionary<Album, GenreFilteredAlbum> albumList = m_GenreFilteredAlbumLookup[genre];

            if (!albumList.ContainsKey(album))
            {
                string directory = new Path(block.File).Directories.Last();
                GenreFilteredAlbum genreFilteredAlbum = new GenreFilteredAlbum(genre, album.Artist, album.Title, album.Date, directory);
                m_GenreFilteredAlbumLookup[genre][album] = genreFilteredAlbum;
                AddGenreExpansion(genre, genreFilteredAlbum);
            }

            return m_GenreFilteredAlbumLookup[genre][album];
        }
Exemple #2
0
        private void AddArtistExpansion(Artist parent, Album child)
        {
            if (!m_ArtistExpansion.ContainsKey(parent))
            {
                m_ArtistExpansion[parent] = new SortedSet<Album>(m_AlbumSortRule);
            }

            m_ArtistExpansion[parent].Add(child);
        }
Exemple #3
0
        private Album GetOrCreateAlbum(MPDSongResponseBlock block)
        {
            Artist artist = Artists[SelectArtistTag(block)];
            string albumKey = block.Album ?? UnknownAlbum;

            if (!m_AlbumLookup.ContainsKey(artist))
            {
                m_AlbumLookup[artist] = new SortedDictionary<string, Album>(StringComparer.Ordinal);
            }

            IDictionary<string, Album> albumList = m_AlbumLookup[artist];

            if (!albumList.ContainsKey(albumKey))
            {
                string date = null;

                if (block.Date != null)
                {
                    if (Path.IsSpotify(block.File))
                    {
                        date = m_DataModel.YearNormalizer.Normalize(block.Date);
                    }
                    else
                    {
                        date = m_DataModel.CustomDateNormalizer.Normalize(block.Date);
                    }
                }

                string directory = new Path(block.File).Directories.Last();
                Album album = new Album(artist, albumKey, date, directory);
                albumList[albumKey] = album;
                AddArtistExpansion(artist, album);
            }

            return albumList[albumKey];
        }
Exemple #4
0
        private void AddAlbumExpansion(Album parent, Song child)
        {
            if (!m_AlbumExpansion.ContainsKey(parent))
            {
                m_AlbumExpansion[parent] = new SortedSet<Song>();
            }

            m_AlbumExpansion[parent].Add(child);
        }