Sync tracks/tags automatically if <5
This commit is contained in:
parent
011db51e11
commit
6cc0003120
2 changed files with 7 additions and 1 deletions
|
@ -63,7 +63,7 @@ html
|
|||
.fl-grow1 Searching for #[strong= searchText]
|
||||
a.s-btn.s-notice--btn(href=and({filter: null, filter_field: null, filter_fuzzy: null})) Clear
|
||||
else
|
||||
form.d-flex.ai-stretch.gx8.jc-space-between.baw0(hx-indicator="#search-submit")
|
||||
form.d-flex.ai-stretch.gx12.jc-space-between.baw0(hx-indicator="#search-submit")
|
||||
input.s-input(name="filter" placeholder="Search" autocomplete="off").fl-grow1
|
||||
input(type="hidden" name="filter_field" value=
|
||||
( arrange === "artist" ? "band_name"
|
||||
|
|
|
@ -9,6 +9,8 @@ const {z} = require("zod")
|
|||
|
||||
const {sync, db, router} = require("../passthrough")
|
||||
const pugSync = sync.require("../pug-sync")
|
||||
/** @type {import("./load-tags")} */
|
||||
const loadTags = sync.require("./load-tags")
|
||||
|
||||
async function loadCollection(inputUsername) {
|
||||
assert.match(inputUsername, /^[a-z0-9_-]+$/)
|
||||
|
@ -74,6 +76,10 @@ async function loadCollection(inputUsername) {
|
|||
})()
|
||||
const storedTrackCount = db.prepare("SELECT count(*) AS count FROM track WHERE account = ?").pluck().get(account)
|
||||
|
||||
// load full tracks/tags immediately if there's not too many
|
||||
const downloader = loadTags.downloadManager.check(account)
|
||||
if (downloader.total <= 5) loadTags.downloadManager.start(account)
|
||||
|
||||
return {
|
||||
storedItemCount,
|
||||
storedTrackCount,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue