public void Add(Track track)
        {
            lock (_tracks)
            {
                string artist = null;

                _tracks.Add(track);

                if (!IsEmpty(track.Artist))
                {
                    artist = track.Artist;
                    if (!_artists.Contains(artist)) _artists.Add(artist);
                }

                if (!IsEmpty(track.AlbumArtist))
                {
                    artist = track.AlbumArtist;
                    if (!_artists.Contains(artist)) _artists.Add(artist);
                }

                if (!IsEmpty(track.Album) && !IsEmpty(artist))
                {
                    Album album = new Album();
                    album.Artist = artist;
                    album.Title = track.Album;
                    track.AlbumKey = album.Key;

                    if (_albummap.ContainsKey(album.Key)) album = _albummap[album.Key];
                    else
                    {
                        _albummap[album.Key] = album;
                        _albums.Add(album);
                    }
                    album.Tracks.Add(track);
                }
            }
        }
        public static Track CreateTrack(IWMPMedia item)
        {
            var mediatype = item.getItemInfo("MediaType");
            if (!mediatype.Equals("audio")) return null;

            var track = new Track {Title = item.name};

            ushort index;
            if (ushort.TryParse(item.getItemInfo("WM/TrackNumber"),out index)) track.TrackNo = index;

            track.Artist = item.getItemInfo("Author");
            track.AlbumArtist = item.getItemInfo("WM/AlbumArtist");
            if (IsEmpty(track.AlbumArtist)&&!IsEmpty(track.Artist)) track.AlbumArtist = track.Artist;
            if (IsEmpty(track.Artist)&&!IsEmpty(track.AlbumArtist)) track.Artist = track.AlbumArtist;
            track.Album = item.getItemInfo("WM/AlbumTitle");
            if (IsEmpty(track.Album)) track.Album = "Unknown";
            track.Duration = item.duration;
            track.URL = item.sourceURL;

            if (IsEmpty(track.Title)||IsEmpty(track.Artist)||IsEmpty(track.AlbumArtist)||IsEmpty(track.Album))
            {
                Console.WriteLine("Found empty string");
            }

            return track;
        }
 private void PlayNext()
 {
     _currenttrack = GetNext();
     if (_currenttrack == null)
     {
         MessageBox.Show("Couldn't find any tracks to play");
         return;
     }
     Player.URL = _currenttrack.URL;
     Player.Ctlcontrols.play();
     trackControl.Track = _currenttrack;
     UpdateQueueDisplay();
 }
 private void trackListControl_TrackSelected(Track selectedtrack)
 {
     _requests.Enqueue(selectedtrack);
 }
 private void Player_StatusChange(object sender, EventArgs e)
 {
     var status = Player.status.Trim();
     if (!status.Equals(STOPPEDSTATUS)) return;
     _currenttrack = null;
     UpdateTime();
     timerStartSong.Enabled = true;
 }