Revert "Error logging"

This reverts commit 2d1cfad07f.
This commit is contained in:
Kwoth 2017-01-05 21:45:40 +01:00
parent 2d1cfad07f
commit 3e693ea230
4 changed files with 10 additions and 21 deletions

View File

@ -152,10 +152,6 @@ namespace NadekoBot.Modules.Music.Classes
} }
catch (OperationCanceledException) { } catch (OperationCanceledException) { }
catch (TimeoutException) {
Console.WriteLine("Bot couldn't connect to the channel. Most likely insufficient permissions. Fix permissions, then queue songs again");
ClearQueue();
}
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("Music thread almost crashed."); Console.WriteLine("Music thread almost crashed.");

View File

@ -76,21 +76,16 @@ namespace NadekoBot.Modules.Music.Classes
}) })
{ TotalTime = TimeSpan.FromMilliseconds(svideo.Duration) }; { TotalTime = TimeSpan.FromMilliseconds(svideo.Duration) };
} }
Console.WriteLine("Getting video id");
var link = (await NadekoBot.Google.GetVideosByKeywordsAsync(query).ConfigureAwait(false)).FirstOrDefault(); var link = (await NadekoBot.Google.GetVideosByKeywordsAsync(query).ConfigureAwait(false)).FirstOrDefault();
Console.WriteLine("Done getting video id");
if (string.IsNullOrWhiteSpace(link)) if (string.IsNullOrWhiteSpace(link))
throw new OperationCanceledException("Not a valid youtube query."); throw new OperationCanceledException("Not a valid youtube query.");
//var allVideos = await Task.Run(async () => { try { return await YouTube.Default.GetVideoAsync(link).ConfigureAwait(false); } catch { return Enumerable.Empty<YouTubeVideo>(); } }).ConfigureAwait(false); var allVideos = await Task.Run(async () => { try { return await YouTube.Default.GetAllVideosAsync(link).ConfigureAwait(false); } catch { return Enumerable.Empty<YouTubeVideo>(); } }).ConfigureAwait(false);
//var videos = allVideos.Where(v => v.AdaptiveKind == AdaptiveKind.Audio); var videos = allVideos.Where(v => v.AdaptiveKind == AdaptiveKind.Audio);
//var video = videos var video = videos
// .Where(v => v.AudioBitrate < 256) .Where(v => v.AudioBitrate < 256)
// .OrderByDescending(v => v.AudioBitrate) .OrderByDescending(v => v.AudioBitrate)
// .FirstOrDefault(); .FirstOrDefault();
Console.WriteLine("Getting video itself");
var video = await YouTube.Default.GetVideoAsync(link).ConfigureAwait(false);
Console.WriteLine("Done getting video");
if (video == null) // do something with this error if (video == null) // do something with this error
throw new Exception("Could not load any video elements based on the query."); throw new Exception("Could not load any video elements based on the query.");

View File

@ -325,7 +325,7 @@ $"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {tota
while (ids.Any() && !cancelSource.IsCancellationRequested) while (ids.Any() && !cancelSource.IsCancellationRequested)
{ {
var tasks = Task.WhenAll(ids.Take(3).Select(async id => var tasks = Task.WhenAll(ids.Take(5).Select(async id =>
{ {
if (cancelSource.Token.IsCancellationRequested) if (cancelSource.Token.IsCancellationRequested)
return; return;
@ -874,9 +874,8 @@ $"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {tota
try try
{ {
musicPlayer.ThrowIfQueueFull(); musicPlayer.ThrowIfQueueFull();
Console.WriteLine("Resolving");
resolvedSong = await SongHandler.ResolveSong(query, musicType).ConfigureAwait(false); resolvedSong = await SongHandler.ResolveSong(query, musicType).ConfigureAwait(false);
Console.WriteLine("Resolved");
if (resolvedSong == null) if (resolvedSong == null)
throw new SongNotFoundException(); throw new SongNotFoundException();

View File

@ -80,8 +80,7 @@ namespace NadekoBot
private Task Client_Log(LogMessage arg) private Task Client_Log(LogMessage arg)
{ {
_log.Warn(arg.Message); _log.Warn(arg.Exception, arg.Message);
_log.Error(arg.Exception);
return Task.CompletedTask; return Task.CompletedTask;
} }