Exemple #1
0
        public override bool Equals(object obj)
        {
            if (!(obj is RPMusicArtist))
            {
                return(false);
            }

            RPMusicArtist objArtist = (RPMusicArtist)obj;

            return(this.GetHashCode() == objArtist.GetHashCode());
        }
        public List<RPMusicArtist> GetAllArtists()
        {
            if (!Settings.Default.EnableMusicLibrary) return new List<RPMusicArtist>();

            WindowsMediaPlayer WMPlayer = new WindowsMediaPlayer();

            List<RPMusicArtist> output = new List<RPMusicArtist>();
            List<RPMusicArtist> outputList = new List<RPMusicArtist>();
            IWMPStringCollection scArtists = WMPlayer.mediaCollection.getAttributeStringCollection("Author", "Audio");

            for (int i = 0; i < scArtists.count; i++)
            {
                string strArtistName = scArtists.Item(i);
                if (string.IsNullOrEmpty(strArtistName)) continue; // Believe it or not WMP sometimes returns an empty artist name

                RPMusicArtist artist = new RPMusicArtist(strArtistName);
                output.Add(artist);
            }

            WMPlayer.close();

            // Sort output A-Z
            CommonEPG.Comparers.RPMusicArtistNameComparer myComparer = new CommonEPG.Comparers.RPMusicArtistNameComparer();
            output.Sort(myComparer);

            return output;
        }