Update spotify integration

This commit is contained in:
Dominic Grimm 2025-07-03 17:16:47 +02:00
parent 30b9f32195
commit 0b1f5a6ce6
Signed by: dergrimm
SSH key fingerprint: SHA256:0uoWpcqOtkyvQ+ZqBjNYiDqIZY+9s8VeZkkJ/4ryB4E
6 changed files with 21 additions and 15 deletions

View file

@ -32,6 +32,10 @@ pub fn build(b: *std.Build) !void {
});
gen_proto.dependOn(&protc_step.step);
const utils_mod = b.createModule(.{
.root_source_file = b.path("src/utils/root.zig"),
});
const protocol = blk: {
const mod = b.addModule("eink_feed_protocol", .{
.root_source_file = b.path("src/eink_feed_protocol/root.zig"),
@ -45,6 +49,7 @@ pub fn build(b: *std.Build) !void {
.root_source_file = b.path("src/eink_feed_server/root.zig"),
.target = target,
});
server_mod.addImport("utils", utils_mod);
server_mod.addImport("eink_feed_protocol", protocol);
server_mod.addImport("zap", zap_dep.module("zap"));
server_mod.addImport("zigimg", zigimg_dep.module("zigimg"));
@ -71,6 +76,7 @@ pub fn build(b: *std.Build) !void {
.root_source_file = b.path("src/eink_feed_render/root.zig"),
.target = target,
});
render_mod.addImport("utils", utils_mod);
render_mod.addImport("eink_feed_server", server_mod);
render_mod.addImport("eink_feed_protocol", protocol);
render_mod.addImport("zigimg", zigimg_dep.module("zigimg"));

View file

@ -18,22 +18,22 @@
},
.curl = .{
.url = "https://github.com/curl/curl/releases/download/curl-8_12_1/curl-8.12.1.tar.xz",
.hash = "12203302a349824d4200886559735a236880c6a52f065e9876984b8fd671cbbe3e4d",
.hash = "N-V-__8AALHhRQEzAqNJgk1CAIhlWXNaI2iAxqUvBl6YdphL",
},
.mbedtls = .{
.url = "https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-3.6.2.tar.gz",
.hash = "1220df23c1e89d301f43026518f90e75cbfd91d92f9e62e5243268eec1db1b425db1",
.hash = "N-V-__8AAPnFhALfI8HonTAfQwJlGPkOdcv9kdkvnmLlJDJo",
},
.zlib = .{
.url = "https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz",
.hash = "1220fed0c74e1019b3ee29edae2051788b080cd96e90d56836eea857b0b966742efb",
.hash = "N-V-__8AAB0eQwD-0MdOEBmz7intriBReIsIDNlukNVoNu6o",
},
.zigimg = .{
.url = "git+https://github.com/zigimg/zigimg.git?ref=zigimg_zig_0.14.1#7144f698850afd968fa87e04b95343d819912a33",
.hash = "zigimg-0.1.0-8_eo2h6XEgAR6UkBiCtWECcml0gtx0oIXE3MX7sPCZof",
},
.libevdev = .{
.url = "git+https://gitlab.freedesktop.org/libevdev/libevdev#libevdev-1.13.4",
.url = "git+https://gitlab.freedesktop.org/libevdev/libevdev.git#libevdev-1.13.4",
.hash = "N-V-__8AANMxDAAf-rkutac-3EWwxzHeShacbZc9_8wshGYa",
},
.kindle = .{

View file

@ -1,7 +1,7 @@
const std = @import("std");
const escaper = @import("../../escaper.zig");
const ResultArena = @import("../../result.zig").ResultArena;
const utils = @import("utils");
pub const models = @import("models.zig");
@ -515,8 +515,8 @@ pub const Client = struct {
comptime T: type,
req: *std.http.Client.Request,
expected_status: std.http.Status,
) !ResultArena(std.json.Parsed(T)) {
var result = ResultArena(std.json.Parsed(models.GetPlaybackStateResponse)){
) !utils.ResultArena(std.json.Parsed(T)) {
var result = utils.ResultArena(std.json.Parsed(models.GetPlaybackStateResponse)){
.arena = try self.allocator.create(std.heap.ArenaAllocator),
.value = undefined,
};
@ -555,7 +555,7 @@ pub const Client = struct {
expected_status: std.http.Status,
url_str: []const u8,
payload: ?[]const u8,
) !ResultArena(std.json.Parsed(T)) {
) !utils.ResultArena(std.json.Parsed(T)) {
const url = try std.Uri.parse(url_str);
if ((try self.checkAccessTokenExpired()).?)
@ -585,7 +585,7 @@ pub const Client = struct {
return try self.handleResponse(T, &req, expected_status);
}
pub fn getPlaybackState(self: *Self) !ResultArena(std.json.Parsed(models.GetPlaybackStateResponse)) {
pub fn getPlaybackState(self: *Self) !utils.ResultArena(std.json.Parsed(models.GetPlaybackStateResponse)) {
const url_str = try std.fmt.allocPrint(
self.allocator,
"{[base]s}?market={[market]s}",

View file

@ -1,6 +1,7 @@
const std = @import("std");
const ResultArena = @import("../../../result.zig").ResultArena;
const utils = @import("utils");
const Dimensions = @import("../../../Dimensions.zig");
const escaper = @import("../../../escaper.zig");
const api = @import("../../../api/root.zig");
@ -11,8 +12,8 @@ pub const Title = struct {
album_name: ?[]const u8,
album_cover_url: ?[]const u8,
pub fn escape(self: *const Title, allocator: std.mem.Allocator) !ResultArena(Title) {
var result = ResultArena(Title){
pub fn escape(self: *const Title, allocator: std.mem.Allocator) !utils.ResultArena(Title) {
var result = utils.ResultArena(Title){
.arena = try allocator.create(std.heap.ArenaAllocator),
.value = undefined,
};
@ -49,8 +50,8 @@ pub const Title = struct {
pub const Context = struct {
title: ?Title,
pub fn escape(self: *const Context, allocator: std.mem.Allocator) !ResultArena(Context) {
var result = ResultArena(Context){
pub fn escape(self: *const Context, allocator: std.mem.Allocator) !utils.ResultArena(Context) {
var result = utils.ResultArena(Context){
.arena = try allocator.create(std.heap.ArenaAllocator),
.value = undefined,
};

View file

@ -1,4 +1,3 @@
pub const ResultArena = @import("result.zig").ResultArena;
pub const api = @import("api/root.zig");
pub const apps = @import("apps/root.zig");
pub const renderer = @import("renderer.zig");