コード例 #1
0
        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);
        }
コード例 #2
0
        public List<RPMusicArtist> GetAllArtists()
        {
            MusicHelper helper = new MusicHelper();
            bool failed = false;
            string txtError = "";
            List<RPMusicArtist> output = helper.RetrieveAllArtists(ref failed, ref txtError);
            if (failed)
                Functions.WriteLineToLogFile("Failed to get artists from music library: " + txtError);
            else
            {
                // Sort output A-Z
                CommonEPG.Comparers.RPMusicArtistNameComparer myComparer = new CommonEPG.Comparers.RPMusicArtistNameComparer();
                output.Sort(myComparer);
            }

            return output;
        }
コード例 #3
0
        public List <RPMusicArtist> GetAllArtists()
        {
            MusicHelper          helper   = new MusicHelper();
            bool                 failed   = false;
            string               txtError = "";
            List <RPMusicArtist> output   = helper.RetrieveAllArtists(ref failed, ref txtError);

            if (failed)
            {
                Functions.WriteLineToLogFile("Failed to get artists from music library: " + txtError);
            }
            else
            {
                // Sort output A-Z
                CommonEPG.Comparers.RPMusicArtistNameComparer myComparer = new CommonEPG.Comparers.RPMusicArtistNameComparer();
                output.Sort(myComparer);
            }

            return(output);
        }
コード例 #4
0
        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;
        }