mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-14 06:23:47 +01:00
playtwitch won't show streamlink crash popup if the stream ended
This commit is contained in:
parent
c2bcbfb11c
commit
a04f193729
2 changed files with 19 additions and 2 deletions
|
@ -363,7 +363,10 @@ fn streamlinkCommunicateCb(
|
|||
};
|
||||
defer c.g_bytes_unref(stdout);
|
||||
|
||||
if (c.g_subprocess_get_exit_status(@ptrCast(*c.GSubprocess, source_object)) == 0) {
|
||||
const exit_code = c.g_subprocess_get_exit_status(@ptrCast(*c.GSubprocess, source_object));
|
||||
|
||||
if (exit_code == 0) {
|
||||
std.log.info("Streamlink exited with code 0.", .{});
|
||||
c.gtk_window_close(data.window);
|
||||
return;
|
||||
}
|
||||
|
@ -371,6 +374,20 @@ fn streamlinkCommunicateCb(
|
|||
var len: usize = 0;
|
||||
const stdout_data = @ptrCast([*c]const u8, c.g_bytes_get_data(stdout, &len));
|
||||
|
||||
// Streamlink exits with a nonzero code if the stream ends, but we don't
|
||||
// want to count this as a crash.
|
||||
if (std.mem.containsAtLeast(u8, stdout_data[0..len], 1, "Stream ended")) {
|
||||
std.log.warn(
|
||||
\\Streamlink exited with code {d}, but output contained
|
||||
\\"Stream ended", not showing popup. Full output:
|
||||
\\{s}
|
||||
,
|
||||
.{ exit_code, stdout_data[0..len] },
|
||||
);
|
||||
c.gtk_window_close(data.window);
|
||||
return;
|
||||
}
|
||||
|
||||
c.gtk_text_buffer_set_text(data.text_buf, stdout_data, @intCast(c_int, len));
|
||||
c.gtk_widget_show(data.dialog);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ const ffi = @import("ffi.zig");
|
|||
const c = ffi.c;
|
||||
const gui = @import("gui.zig");
|
||||
|
||||
pub const log = @import("glib-log").log(c, "playtwitch", 512);
|
||||
pub const log = @import("glib-log").log(c, "playtwitch", 1024);
|
||||
// glib handles level filtering
|
||||
pub const log_level = .debug;
|
||||
|
||||
|
|
Loading…
Reference in a new issue