void AddTracks(SpotiFire.Playlist playlist, IEnumerable <SpotiFire.Track> tracks) { var toucheePlaylist = GetToucheePlaylist(playlist); foreach (var track in tracks) { lock (_trackUsage) { var toucheeTrack = Spotify.Media.Track.FindOrDefaultByAltID <Spotify.Media.Track>(track.GetLink().ToString()); // Track does not exist in Touchee yet, so we add save it and add it to the master container if (toucheeTrack == null) { toucheeTrack = new Spotify.Media.Track(track); _trackUsage[toucheeTrack] = 1; toucheeTrack.Save(); _masterPlaylist.Add(toucheeTrack); } // Track already exists, so we up the track usage counter else { _trackUsage[toucheeTrack] = _trackUsage[toucheeTrack] + 1; } // Add to the playlist if (toucheePlaylist != null) { toucheePlaylist.Add(toucheeTrack); } _trackCount++; if (_trackCount % 50 == 0) { Log(_trackCount.ToString() + " Spotify tracks found"); } } } }
void AddTracks(SpotiFire.Playlist playlist, IEnumerable<SpotiFire.Track> tracks) { var toucheePlaylist = GetToucheePlaylist(playlist); foreach (var track in tracks) { lock (_trackUsage) { var toucheeTrack = Spotify.Media.Track.FindOrDefaultByAltID<Spotify.Media.Track>(track.GetLink().ToString()); // Track does not exist in Touchee yet, so we add save it and add it to the master container if (toucheeTrack == null) { toucheeTrack = new Spotify.Media.Track(track); _trackUsage[toucheeTrack] = 1; toucheeTrack.Save(); _masterPlaylist.Add(toucheeTrack); } // Track already exists, so we up the track usage counter else _trackUsage[toucheeTrack] = _trackUsage[toucheeTrack] + 1; // Add to the playlist if (toucheePlaylist != null) toucheePlaylist.Add(toucheeTrack); _trackCount++; if (_trackCount % 50 == 0) Log(_trackCount.ToString() + " Spotify tracks found"); } } }