Compare commits

...

2 commits

Author SHA1 Message Date
df89a5a7b0
playvid now also deletes live_chat.json 2024-08-19 21:44:02 +02:00
a23f2b95b3
librewolf: update useragent 2024-08-19 21:01:37 +02:00
7 changed files with 24 additions and 9 deletions

View file

@ -1,7 +1,7 @@
// vim: ft=javascript
defaultPref("identity.fxaccounts.enabled", true);
defaultPref("general.useragent.override", "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0");
defaultPref("general.useragent.override", "Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0");
defaultPref("webgl.disabled", false);

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1722630782,
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
"lastModified": 1723991338,
"narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
"rev": "8a3354191c0d7144db9756a74755672387b702ba",
"type": "github"
},
"original": {

View file

@ -20,7 +20,7 @@ pub fn onEvent(self: *LiveChat, mpv: *c.mpv_handle, ev: *c.mpv_event) !void {
c.MPV_EVENT_PROPERTY_CHANGE => {
const evprop: *c.mpv_event_property = @ptrCast(@alignCast(ev.data));
if (std.mem.eql(u8, std.mem.span(evprop.name), "stream-open-filename")) {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
var buf: [std.fs.max_path_bytes]u8 = undefined;
const str = std.mem.span((@as(?*[*:0]const u8, @ptrCast(@alignCast(evprop.data))) orelse return).*);

View file

@ -95,7 +95,7 @@ fn tryMain() !void {
var srv: ?Server = null;
if (env_map.data.get("XDG_RUNTIME_DIR")) |xrd| {
var sockaddr_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
var sockaddr_buf: [std.fs.max_path_bytes]u8 = undefined;
const sockaddr = try std.fmt.bufPrintZ(
&sockaddr_buf,
"{s}/mzteinit-{}-{}.sock",

View file

@ -23,7 +23,7 @@ pub fn query(alloc: std.mem.Allocator, queries: []ProcessQuery) !void {
if (!std.ascii.isDigit(c))
continue :procs;
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
var buf: [std.fs.max_path_bytes]u8 = undefined;
const cmdline_f = std.fs.openFileAbsolute(
try std.fmt.bufPrint(&buf, "/proc/{s}/cmdline", .{proc.name}),
.{},

View file

@ -10,7 +10,7 @@ pub fn main() !u8 {
defer _ = gpa.deinit();
const alloc = gpa.allocator();
var file_buf: [std.posix.PATH_MAX]u8 = undefined;
var file_buf: [std.fs.max_path_bytes]u8 = undefined;
const file = try findVideoFile(alloc, &file_buf);
try std.io.getStdOut().writer().print("playing: `{s}`\n", .{file});
@ -22,6 +22,21 @@ pub fn main() !u8 {
if (try promtForDeletion(file)) {
try std.io.getStdOut().writer().print("deleting: `{s}`\n", .{file});
try std.fs.cwd().deleteFile(file);
// Also delete the live_chat file from yt-dlp if present
if (std.mem.lastIndexOfScalar(u8, file, '.')) |dot_idx| {
var fname_buf: [std.fs.max_path_bytes]u8 = undefined;
const livechat_fname = try std.fmt.bufPrintZ(
&fname_buf,
"{s}.live_chat.json",
.{file[0..dot_idx]},
);
std.fs.cwd().deleteFile(livechat_fname) catch |e| switch (e) {
error.FileNotFound => {},
else => return e,
};
}
}
return 0;

View file

@ -31,7 +31,7 @@ pub fn walk(self: *Self, dir: std.fs.Dir) anyerror!void {
try self.walk(subdir);
},
.sym_link => {
var p_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
var p_buf: [std.fs.max_path_bytes]u8 = undefined;
const p = try dir.readLink(e.name, &p_buf);
var subdir = dir.openDir(p, .{ .iterate = true }) catch |err| {
switch (err) {