Begin Scrobbles view
This commit is contained in:
parent
1809a12a8c
commit
692320a1d2
4 changed files with 15 additions and 11 deletions
|
|
@ -7,8 +7,12 @@ pub fn index(request: *jetzig.Request, data: *jetzig.Data) !jetzig.View {
|
|||
}
|
||||
|
||||
pub fn get(id: []const u8, request: *jetzig.Request, data: *jetzig.Data) !jetzig.View {
|
||||
_ = data;
|
||||
_ = id;
|
||||
var root = try request.data(.object);
|
||||
const params = try request.params();
|
||||
if (params.get("ar")) |param| {
|
||||
const artists = try jetzig.database.Query(.Artists).select(.{.id, .name});
|
||||
const
|
||||
}
|
||||
return request.render(.ok);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
@partial partials/header
|
||||
<div>
|
||||
<span>Content goes here</span>
|
||||
<span>Look for an artist</span>
|
||||
</div>
|
||||
<form action="/scrobbles" method"GET">
|
||||
<label>Filename</label>
|
||||
<input type="text" name="ar" />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
const std = @import("std");
|
||||
const jetzig = @import("jetzig");
|
||||
const jetquery = @import("jetzig").jetquery;
|
||||
//const Scrobble = @import("../../types.zig").LastFMScrobble;
|
||||
//const lastfm = @import("../../types.zig").LastFM;
|
||||
//const UploadData = @import("../../types").UploadData;
|
||||
const ScrobbleTypes = @import("../../types.zig");
|
||||
const zeit = @import("zeit");
|
||||
|
||||
|
|
@ -24,7 +21,6 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
|
|||
if (try request.file("upload")) |file| {
|
||||
const params = try request.params();
|
||||
const source = try std.fmt.parseInt(u8, params.get("t").?.string.value, 10); // This param is required in HTML
|
||||
// Date limiting is broken atm
|
||||
const before_limiter: bool = if (params.get("bbool")) |_| true else false;
|
||||
const after_limiter: bool = if (params.get("abool")) |_| true else false;
|
||||
|
||||
|
|
@ -85,8 +81,6 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
|
|||
continue :appends;
|
||||
}
|
||||
|
||||
// I'm separating these on account of the above comment, as well as
|
||||
// this part being kinda complicated
|
||||
const iso_ts = try zeit.Time.fromISO8601(scrobble.ts);
|
||||
if ((before_limiter or after_limiter) and (iso_ts.after(before_limiting_date) or iso_ts.before(after_limiting_date))) {
|
||||
limited_tracks += 1;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
<span>Upload Last.fm or Spotify history file here (in json format).</span>
|
||||
</div>
|
||||
<form action="/upload" enctype="multipart/form-data" method="POST">
|
||||
<label>Filename</label>
|
||||
<input type="text" name="description" />
|
||||
<label>File</label>
|
||||
<input type="file" name="upload" />
|
||||
<input type="submit" value="Submit" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue