Add more information to artists view, songs view, and format dates correctly in scrobbles view
This commit is contained in:
parent
01fe10f045
commit
65136a44d6
9 changed files with 82 additions and 34 deletions
|
|
@ -1,5 +1,6 @@
|
|||
const std = @import("std");
|
||||
const jetzig = @import("jetzig");
|
||||
const zeit = @import("zeit");
|
||||
|
||||
pub fn index(request: *jetzig.Request) !jetzig.View {
|
||||
var root = try request.data(.object);
|
||||
|
|
@ -33,7 +34,9 @@ pub fn index(request: *jetzig.Request) !jetzig.View {
|
|||
try scrobble_view.put("song_id", scrobble.song_id);
|
||||
try scrobble_view.put("album_name", scrobble.album_name);
|
||||
try scrobble_view.put("album_id", scrobble.album_id);
|
||||
try scrobble_view.put("date", scrobble.date);
|
||||
var date = std.ArrayList(u8).init(request.allocator);
|
||||
try (try zeit.instant(.{ .source = .{ .unix_timestamp = @divFloor(scrobble.date, 1_000_000) } })).time().strftime(date.writer(), "%d %b %Y, %H:%M");
|
||||
try scrobble_view.put("date", date.items);
|
||||
}
|
||||
|
||||
//for (scrobbles) |scrobble| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue