public void SendProgressUpdate(Song song, QueryTrackProgress progress) { foreach (var obj in _pcqList) { var prog = new QueryProgress() { Song = new QuerySong() { Artist = song.Artist, Album = song.Album, Title = song.SongTitle, Meta = song.GetMetaObject(obj) }, Progress = progress }; obj.ProgressUpdateReciever(prog); } }
private void SetSong(Song song) { CurrentSong.Content = song; CurrentSong.Visibility = Visibility.Visible; WaitScreen.Visibility = Visibility.Collapsed; }
public Station CreateStationFromSong(Song song) { return CreateStation(song, "song"); }
public void CallFeedbackUpdateEvent(Song song, bool success) { if (FeedbackUpdateEvent != null) FeedbackUpdateEvent(this, song, success); }
private void _playlist_PlayedSongDequeued(object sender, Song oldSong) { if (PlayedSongRemoved != null) PlayedSongRemoved(this, oldSong); }
private void RateSong(Song song, SongRating rating) { if (_isRating) return; _isRating = true; SongRating oldRating = song.Rating; song.Rate(rating); _cqman.SendRatingUpdate(song.Artist, song.Album, song.SongTitle, oldRating, rating); _isRating = false; }
public void SongThumbUp(Song song) { if (!IsStationLoaded) return; RunTask(() => RateSong(song, SongRating.love)); }
public void SongDeleteFeedback(Song song) { if (!IsStationLoaded) return; RunTask(() => RateSong(song, SongRating.none)); }
private void btnMenu_Click(object sender, RoutedEventArgs e) { _currMenuSong = GetItemSong(sender); ShowMenu(sender); }
public void SendProgressUpdate(Song song, TimeSpan TotalTime, TimeSpan ElapsedTime) { SendProgressUpdate(song, new QueryTrackProgress() { TotalTime = TotalTime, ElapsedTime = ElapsedTime }); }
public ControlQueryManager() { _lastQuerySong = null; _pcqList = new List<IPlayerControlQuery>(); }
public void SendSongUpdate(Song song) { lock (_lastQuerySongLock) { _lastQuerySong = song; } Log.O("Song Update: {0} | {1} | {2}", song.Artist, song.Album, song.SongTitle); foreach (var obj in _pcqList) { obj.SongUpdateReceiver(new QuerySong() { Artist = song.Artist, Album = song.Album, Title = song.SongTitle, Meta = song.GetMetaObject(obj) }); } }
private List<Song> ParseSongXml(string xml) { try { List<Song> songs = new List<Song>(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); XmlNodeList songNodes = xmlDoc.SelectNodes("/methodResponse/params/param/value/array/data/value"); foreach (XmlNode songNode in songNodes) { XmlNode albumTitleNode = songNode.SelectSingleNode("struct/member[name='albumTitle']/value"); XmlNode artistSummaryNode = songNode.SelectSingleNode("struct/member[name='artistSummary']/value"); XmlNode artRadioNode = songNode.SelectSingleNode("struct/member[name='artRadio']/value"); XmlNode audioUrlNode = songNode.SelectSingleNode("struct/member[name='audioURL']/value"); XmlNode songTitleNode = songNode.SelectSingleNode("struct/member[name='songTitle']/value"); XmlNode ratingNode = songNode.SelectSingleNode("struct/member[name='rating']/value"); XmlNode stationIdNode = songNode.SelectSingleNode("struct/member[name='stationId']/value"); XmlNode musicIdNode = songNode.SelectSingleNode("struct/member[name='musicId']/value"); XmlNode userSeedNode = songNode.SelectSingleNode("struct/member[name='userSeed']/value"); XmlNode songTypeNode = songNode.SelectSingleNode("struct/member[name='songType']/value/int"); Song song = new Song(); song.AlbumTitle = albumTitleNode.InnerText; song.ArtistSummary = artistSummaryNode.InnerText; song.ArtRadio = artRadioNode.InnerText; song.AudioUrl = audioUrlNode.InnerText; song.SongTitle = songTitleNode.InnerText; song.Like = ratingNode.InnerText == "1" ? true : false; song.StationId = stationIdNode.InnerText; song.MusicId = musicIdNode.InnerText; song.UserSeed = userSeedNode.InnerText; song.SongType = int.Parse(songTypeNode.InnerText); songs.Add(song); } return songs; } catch (Exception exception) { throw new Exception("Unable to parse Song XML.", exception); } }
public void SubmitFeedbackAsync(Song song, Ratings rating) { try { WebClient client = new WebClient(); client.Headers.Add("content-type", "text-xml"); client.UploadDataCompleted += new UploadDataCompletedEventHandler(SubmitFeedback_UploadDataCompleted); Uri uri = new Uri(String.Format(BASE_URL_LID, _rid, _lid, "addFeedback")); List<object> parameters = new List<object>(); parameters.Add(GetTimestamp()); parameters.Add(_authenticationToken); parameters.Add(song.StationId); parameters.Add(song.MusicId); parameters.Add(song.UserSeed); parameters.Add(String.Empty);//TestStrategy--wtf? parameters.Add(rating == Ratings.Like); parameters.Add(false); //IsCreatorQuickMix parameters.Add(song.SongType); string xml = GetXml("station.addFeedback", parameters); string encryptedXml = EncryptionHelper.EncryptString(xml); client.UploadDataAsync(uri, "POST", System.Text.Encoding.ASCII.GetBytes(encryptedXml)); } catch (Exception exception) { if (ExceptionReceived != null) ExceptionReceived(this, new EventArgs<Exception>(exception)); } }
public void CreateStationFromSong(Song song) { RunTask(() => { Station station = _pandora.CreateStationFromSong(song); if (StationCreated != null) StationCreated(this, station); }); }
private void PlayedSongAdd(Song song) { var songControl = new ContentControl(); RoutedEventHandler loadEvent = AnimateListAdd(lstOldSongs.Items.Count == 0); songControl.Loaded += loadEvent; songControl.Tag = loadEvent; songControl.ContentTemplate = (DataTemplate) Resources["SongTemplate"]; songControl.Content = song; lstOldSongs.Items.Insert(0, songControl); }
public void SongBookmarkArtist(Song song) { if (!IsStationLoaded) return; RunTask(song.BookmarkArtist); }
private void PlayedSongRemove(Song song) { ContentControl result = null; foreach (ContentControl sc in lstOldSongs.Items) { if (song == sc.Content) { result = sc; break; } } if (result != null) { bool last = lstOldSongs.Items.IndexOf(result) == (lstOldSongs.Items.Count - 1); Dispatcher.Invoke(AnimateListRemove(result, last)); } }
public void SongThumbDown(Song song) { if (!IsStationLoaded) return; RunTask(() => RateSong(song, SongRating.ban)); }
private void SetSong(Song song) { CurrentSong.Content = song; CurrentSong.Visibility = Visibility.Visible; WaitScreen.Visibility = Visibility.Collapsed; this.BeginDispatch(() => { String[] stat = txtStationName.Text.Split('-'); if (stat[0].Equals("Quick Mix")) { txtStationName.Text = stat[0]+"-"+song.Station.Name; } }); }
public void SongTired(Song song) { if (!IsStationLoaded) return; RunTask(song.SetTired); }
private void SongMenu_Closed(object sender, RoutedEventArgs e) { _currMenuSong = null; }
private void _pandora_FeedbackUpdateEvent(object sender, Song song, bool success) { if (FeedbackUpdateEvent != null) FeedbackUpdateEvent(this, song, success); }
private void _player_FeedbackUpdateEvent(object sender, Song song, bool success) { this.BeginDispatch(() => { if (_feedbackMap.ContainsKey(song)) { //bit of a hack, but avoids putting INotify in lower level classes or making wrappers foreach (ImageButton button in _feedbackMap[song]) { var spinner = button.FindParent<ContentSpinner>(); BindingExpression bind = button.GetBindingExpression(ImageButton.IsActiveProperty); if (bind != null) bind.UpdateTarget(); spinner.StopAnimation(); } _feedbackMap.Remove(song); if (song.Banned && song == _player.CurrentSong) _player.Next(); } }); }
private void _playlist_PlayedSongQueued(object sender, Song newSong) { if (PlayedSongAdded != null) PlayedSongAdded(this, newSong); }
private void _player_PlayedSongRemoved(object sender, Song song) { this.BeginDispatch(() => PlayedSongRemove(song)); }
public Station CreateStationFromArtist(Song song) { return CreateStation(song, "artist"); }
private void _player_SongStarted(object sender, Song song) { lock (_currSongLock) { _currSong = song; } }
private Station CreateStation(Song song, string type) { JObject req = new JObject(); req["trackToken"] = song.TrackToken; req["musicType"] = type; var result = CallRPC("station.createStation", req); var station = new Station(this, result.Result); Stations.Add(station); return station; }
private void SubmitFeedback(Song song, Ratings rating) { WriteLog(); if (_clientIsBusy) return; if (!EnsureAuthenticated("SubmitFeedback")) return; if (song == null) return; if (rating == Ratings.Dislike) { CFDialogParams dialogParams = new CFDialogParams(); dialogParams.displaytext = "Are you sure you want to dislike this song?"; DialogResult dialogResult = CF_displayDialog(CF_Dialogs.YesNo, dialogParams); if (dialogResult != DialogResult.OK) return; } _clientIsBusy = true; _songToRate = song; _ratingToSubmit = rating; _pandoraClient.SubmitFeedbackAsync(song, rating); }