public void Refresh() { lock (this) { if (refreshing || lastfm.Connection.Station != Station) { return; } refreshing = true; } if (TracksLeft == 0) { SetStatus(Catalog.GetString("Getting new songs for {0}."), false); } ThreadAssist.Spawn(delegate { Media.Playlists.Xspf.Playlist playlist = lastfm.Connection.LoadPlaylistFor(Station); if (playlist != null) { if (playlist.TrackCount == 0) { SetStatus(Catalog.GetString("No new songs available for {0}."), true); } else { List <TrackInfo> new_tracks = new List <TrackInfo> (); foreach (Media.Playlists.Xspf.Track track in playlist.Tracks) { TrackInfo ti = new LastfmTrackInfo(track, this, track.GetExtendedValue("trackauth")); new_tracks.Add(ti); lock (track_model) { track_model.Add(ti); } } HideStatus(); ThreadAssist.ProxyToMain(delegate { //OnTrackAdded (null, new_tracks); track_model.Reload(); OnUpdated(); if (playback_requested) { if (this == ServiceManager.PlaybackController.Source) { ((IBasicPlaybackController)this).Next(false); } playback_requested = false; } }); } } else { SetStatus(Catalog.GetString("Failed to get new songs for {0}."), true); } refreshing = false; }); }
private void OnLoved(object sender, EventArgs args) { LastfmTrackInfo track = ServiceManager.PlayerEngine.CurrentTrack as LastfmTrackInfo; if (track == null) { return; } track.Love(); }
private void OnHated(object sender, EventArgs args) { LastfmTrackInfo track = ServiceManager.PlayerEngine.CurrentTrack as LastfmTrackInfo; if (track == null) { return; } track.Ban(); ServiceManager.PlaybackController.Next(); }