ffmpeg won't log anymore

This commit is contained in:
Master Kwoth 2016-02-19 04:53:54 +01:00
parent c08498af54
commit aa86359ea0
2 changed files with 18 additions and 17 deletions

View File

@ -172,12 +172,9 @@ namespace NadekoBot.Classes.Music {
//start feeding the buffer //start feeding the buffer
var p = Process.Start(new ProcessStartInfo { var p = Process.Start(new ProcessStartInfo {
FileName = "ffmpeg", FileName = "ffmpeg",
Arguments = $"-i {Url} -f s16le -ar 48000 -ac 2 pipe:1", Arguments = $"-i {Url} -f s16le -ar 48000 -ac 2 pipe:1 -loglevel quiet", //+ (NadekoBot.IsLinux ? "2> /dev/null" : "2>NUL"),
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,
RedirectStandardError = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
}); });
int attempt = 0; int attempt = 0;
while (true) { while (true) {

View File

@ -30,13 +30,15 @@ namespace NadekoBot {
botMention = creds.BotMention; botMention = creds.BotMention;
if (string.IsNullOrWhiteSpace(creds.GoogleAPIKey)) { if (string.IsNullOrWhiteSpace(creds.GoogleAPIKey)) {
Console.WriteLine("No google api key found. You will not be able to use music and links won't be shortened."); Console.WriteLine("No google api key found. You will not be able to use music and links won't be shortened.");
} else { }
else {
Console.WriteLine("Google API key provided."); Console.WriteLine("Google API key provided.");
GoogleAPIKey = creds.GoogleAPIKey; GoogleAPIKey = creds.GoogleAPIKey;
} }
if (string.IsNullOrWhiteSpace(creds.TrelloAppKey)) { if (string.IsNullOrWhiteSpace(creds.TrelloAppKey)) {
Console.WriteLine("No trello appkey found. You will not be able to use trello commands."); Console.WriteLine("No trello appkey found. You will not be able to use trello commands.");
} else { }
else {
Console.WriteLine("Trello app key provided."); Console.WriteLine("Trello app key provided.");
TrelloAppKey = creds.TrelloAppKey; TrelloAppKey = creds.TrelloAppKey;
loadTrello = true; loadTrello = true;
@ -47,14 +49,15 @@ namespace NadekoBot {
ForwardMessages = true; ForwardMessages = true;
Console.WriteLine("Forwarding messages."); Console.WriteLine("Forwarding messages.");
} }
if(string.IsNullOrWhiteSpace(creds.SoundCloudClientID)) if (string.IsNullOrWhiteSpace(creds.SoundCloudClientID))
Console.WriteLine("No soundcloud Client ID found. Soundcloud streaming is disabled."); Console.WriteLine("No soundcloud Client ID found. Soundcloud streaming is disabled.");
else else
Console.WriteLine("SoundCloud streaming enabled."); Console.WriteLine("SoundCloud streaming enabled.");
OwnerID = creds.OwnerID; OwnerID = creds.OwnerID;
password = creds.Password; password = creds.Password;
} catch (Exception ex) { }
catch (Exception ex) {
Console.WriteLine($"Failed to load stuff from credentials.json, RTFM\n{ex.Message}"); Console.WriteLine($"Failed to load stuff from credentials.json, RTFM\n{ex.Message}");
Console.ReadKey(); Console.ReadKey();
return; return;
@ -70,9 +73,9 @@ namespace NadekoBot {
var commandService = new CommandService(new CommandServiceConfigBuilder { var commandService = new CommandService(new CommandServiceConfigBuilder {
AllowMentionPrefix = false, AllowMentionPrefix = false,
CustomPrefixHandler = m => 0, CustomPrefixHandler = m => 0,
HelpMode = HelpMode.Disabled HelpMode = HelpMode.Disabled,
}); });
//reply to personal messages and forward if enabled. //reply to personal messages and forward if enabled.
client.MessageReceived += Client_MessageReceived; client.MessageReceived += Client_MessageReceived;
@ -83,7 +86,7 @@ namespace NadekoBot {
var modules = client.AddService<ModuleService>(new ModuleService()); var modules = client.AddService<ModuleService>(new ModuleService());
//add audio service //add audio service
var audio = client.AddService<AudioService>(new AudioService(new AudioServiceConfigBuilder() { var audio = client.AddService<AudioService>(new AudioService(new AudioServiceConfigBuilder() {
Channels = 2, Channels = 2,
EnableEncryption = false, EnableEncryption = false,
EnableMultiserver = true, EnableMultiserver = true,
@ -121,14 +124,14 @@ namespace NadekoBot {
try { try {
OwnerPrivateChannel = await client.CreatePrivateChannel(OwnerID); OwnerPrivateChannel = await client.CreatePrivateChannel(OwnerID);
} catch { }
catch {
Console.WriteLine("Failed creating private channel with the owner"); Console.WriteLine("Failed creating private channel with the owner");
} }
Classes.Permissions.PermissionsHandler.Initialize(); Classes.Permissions.PermissionsHandler.Initialize();
client.ClientAPI.SendingRequest += (s, e) => client.ClientAPI.SendingRequest += (s, e) => {
{
var request = e.Request as Discord.API.Client.Rest.SendMessageRequest; var request = e.Request as Discord.API.Client.Rest.SendMessageRequest;
if (request != null) { if (request != null) {
if (string.IsNullOrWhiteSpace(request.Content)) if (string.IsNullOrWhiteSpace(request.Content))
@ -139,12 +142,12 @@ namespace NadekoBot {
}); });
Console.WriteLine("Exiting..."); Console.WriteLine("Exiting...");
Console.ReadKey(); Console.ReadKey();
} }
static bool repliedRecently = false; static bool repliedRecently = false;
private static async void Client_MessageReceived(object sender, MessageEventArgs e) { private static async void Client_MessageReceived(object sender, MessageEventArgs e) {
if (e.Server != null || e.User.Id == client.CurrentUser.Id) return; if (e.Server != null || e.User.Id == client.CurrentUser.Id) return;
if (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u=>u.Id)).Contains(e.User.Id)) return; if (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u => u.Id)).Contains(e.User.Id)) return;
// just ban this trash AutoModerator // just ban this trash AutoModerator
// and cancer christmass spirit // and cancer christmass spirit
// and crappy shotaslave // and crappy shotaslave
@ -157,7 +160,8 @@ namespace NadekoBot {
await (await client.GetInvite(e.Message.Text)).Accept(); await (await client.GetInvite(e.Message.Text)).Accept();
await e.Send("I got in!"); await e.Send("I got in!");
return; return;
} catch { }
catch {
if (e.User.Id == 109338686889476096) { //carbonitex invite if (e.User.Id == 109338686889476096) { //carbonitex invite
await e.Send("Failed to join the server."); await e.Send("Failed to join the server.");
return; return;