logging fixed
This commit is contained in:
parent
d1bce790df
commit
1eb0f24925
@ -128,11 +128,10 @@ namespace NadekoBot.Classes.Music {
|
|||||||
logTimer.Interval = 5000;
|
logTimer.Interval = 5000;
|
||||||
logTimer.Start();
|
logTimer.Start();
|
||||||
}
|
}
|
||||||
logTimer.Elapsed += LogTimer_Elapsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LogTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
|
private void LogTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
|
||||||
if (cancelSource.IsCancellationRequested) {
|
if (cancelSource.IsCancellationRequested || State != StreamState.Playing) { //don't log if canceld or not playing
|
||||||
logTimer.Elapsed -= LogTimer_Elapsed;
|
logTimer.Elapsed -= LogTimer_Elapsed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -208,6 +207,7 @@ namespace NadekoBot.Classes.Music {
|
|||||||
|
|
||||||
internal Task StartPlayback() =>
|
internal Task StartPlayback() =>
|
||||||
Task.Run(async () => {
|
Task.Run(async () => {
|
||||||
|
logTimer.Elapsed += LogTimer_Elapsed; // start logging only when the song starts
|
||||||
Console.WriteLine("Starting playback.");
|
Console.WriteLine("Starting playback.");
|
||||||
State = StreamState.Playing;
|
State = StreamState.Playing;
|
||||||
if (parent.OnBuffering != null)
|
if (parent.OnBuffering != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user