zuletzt/src/types.zig
mitteneer 0631ded115 Work on add artist action in rules
Really close to having it work, but there seems to be an error when uploading files, which causes particularly annoying problems on WSL when testing, so I'm commiting and trying on my desktop.
2025-04-23 19:32:32 -04:00

63 lines
1.8 KiB
Zig

pub const ImportedScrobble = struct {
track: []const u8,
artist: []const u8,
album: []const u8 = "",
date: i128,
};
pub const Scrobble = struct {
track: []const u8,
artists_track: []const []const u8,
album: []const u8 = "",
artists_album: []const []const u8,
date: i128,
};
// From lastfmstats.com
pub const LastFM = struct { username: []const u8, scrobbles: []ImportedScrobble };
// I derived whether or not these values were optional from searching
// the respective fields for null in Vim, so there may be some fields
// that can be optional that I haven't run into yet
pub const SpotifyScrobble = struct {
ts: []const u8,
//username: []const u8,
//platform: []const u8,
ms_played: u64,
//conn_country: []const u8,
//ip_addr_decrypted: ?[]const u8,
//user_agent_decrypted: ?[]const u8,
master_metadata_track_name: ?[]const u8,
master_metadata_album_artist_name: ?[]const u8,
master_metadata_album_album_name: ?[]const u8,
//spotify_track_uri: ?[]const u8,
//episode_name: ?[]const u8,
//episode_show_name: ?[]const u8,
//spotify_episode_uri: ?[]const u8,
reason_start: []const u8,
reason_end: ?[]const u8,
//shuffle: bool,
skipped: ?bool,
//offline: bool,
offline_timestamp: u64,
//incognito_mode: ?bool,
};
pub const Rule = struct {
name: []const u8,
cond_req: enum { any, all },
conditionals: []struct {
match_on: enum { artist, album, track },
match_cond: enum { is, contains },
match_txt: []const u8,
},
actions: []struct {
action: enum { replace, add },
action_on: enum { artists_album, album, artists_track, track },
action_txt: []const u8,
},
};
pub const Rules = struct {
rules: []const Rule,
};