Пример #1
0
        public List<ITunesTrack> GetLibrary()
        {
            trackList = new List<ITunesTrack>();

            var musicLibrary = this.iTunes.LibraryPlaylist;

            // note: iTunes index starts at 1 not 0
            for (int i = 1; i <= musicLibrary.Tracks.Count; i++)
            {
                IITTrack track = musicLibrary.Tracks[i];
                // Only audio tracks are added
                if (track != null && track.KindAsString.Contains("audio"))
                {
                    ITunesTrack iTrack = new ITunesTrack
                    {
                        Index = i,
                        Artist = track.Artist,
                        Name = track.Name
                    };

                    trackList.Add(iTrack);
                }
            }

            return trackList;
        }
Пример #2
0
        private ITunesTrack Play(IITTrack track)
        {
            ITunesTrack result = null;

            if (track != null)
            {
                result = new ITunesTrack
                {
                    Artist = track.Artist,
                    Album = track.Album,
                    Name = track.Name,
                    Index = track.Index
                };

                track.Play();
            }

            return result;
        }