public void Update(SongInfoChanged newInfo) { var data = CurrentPlayData; if (data is null) { return; } if (newInfo.Title != null) { data.ResourceData.ResourceTitle = newInfo.Title; } // further properties... OnResourceUpdated?.Invoke(this, data); }
public void Update(SongInfoChanged newInfo) { lock (Lock) { Log.Info("Song info (title) updated"); var data = CurrentPlayData; if (data is null) { return; } if (newInfo.Title != null) { data.ResourceData = data.ResourceData.WithTitle(newInfo.Title); } // further properties... OnResourceUpdated?.Invoke(this, data); } }
private static SongInfoChanged ParseIcyMeta(string metaString) { var songInfo = new SongInfoChanged(); var match = IcyMetadataMacher.Match(metaString); if (match.Success) { for (int i = 0; i < match.Groups[1].Captures.Count; i++) { switch (match.Groups[2].Captures[i].Value.ToUpperInvariant()) { case "STREAMTITLE": songInfo.Title = match.Groups[3].Captures[i].Value; break; } } } return(songInfo); }
public async Task Update(SongInfoChanged newInfo) { var data = CurrentPlayData; if (data is null) { return; } if (newInfo.Title != null) { data.ResourceData.ResourceTitle = newInfo.Title; } // further properties... try { await OnResourceUpdated.InvokeAsync(this, data); } catch (AudioBotException ex) { Log.Warn(ex, "Error in OnResourceUpdated event."); } }
private void TriggerSongUpdated(object o, SongInfoChanged e) => OnSongUpdated?.Invoke(this, e);
private void TriggerSongUpdated(object?o, SongInfoChanged e) => scheduler.InvokeAsync(() => OnSongUpdated.InvokeAsync(this, e));