Add tag list
This commit is contained in:
parent
4744a22ef6
commit
c4e67c119e
3 changed files with 18 additions and 3 deletions
|
@ -29,6 +29,7 @@ const sqls = {
|
|||
label_grid: "SELECT iif(count(DISTINCT band_name) = 1, band_name, band_url) AS display_name, band_url, count(DISTINCT item_id) AS album_count, count(DISTINCT band_name) AS artist_count, count(*) AS track_count, iif(sum(duration) > 3600, cast(total(duration)/3600 AS INTEGER) || 'h ' || cast(total(duration)/60%60 AS INTEGER) || 'm', cast(total(duration)/60 AS INTEGER) || 'm') AS total_duration FROM item INNER JOIN track USING (account, item_id) {JOIN TAG} WHERE account = ? {WHERE} GROUP BY band_url ORDER BY display_name COLLATE NOCASE",
|
||||
label_list: "SELECT iif(count(DISTINCT band_name) = 1, band_name, band_url) AS display_name, band_url, count(DISTINCT item_id) AS album_count, count(DISTINCT band_name) AS artist_count, count(*) AS track_count, iif(sum(duration) > 3600, cast(total(duration)/3600 AS INTEGER) || 'h ' || cast(total(duration)/60%60 AS INTEGER) || 'm', cast(total(duration)/60 AS INTEGER) || 'm') AS total_duration FROM item INNER JOIN track USING (account, item_id) {JOIN TAG} WHERE account = ? {WHERE} GROUP BY band_url ORDER BY display_name COLLATE NOCASE",
|
||||
tag_grid: "SELECT tag, count(*) AS count FROM item_tag INNER JOIN item USING (account, item_id) WHERE account = ? {WHERE} GROUP BY tag, band_url ORDER BY count DESC",
|
||||
tag_list: "SELECT tag, count(*) AS labels, sum(count) AS albums FROM (SELECT tag, count(*) AS count FROM item_tag INNER JOIN item USING (account, item_id) WHERE account = ? {WHERE} GROUP BY tag, band_url) GROUP BY tag ORDER BY labels DESC",
|
||||
track_list: "SELECT * FROM track INNER JOIN item USING (account, item_id) {JOIN TAG} WHERE account = ? {WHERE} ORDER BY band_url, item_title COLLATE NOCASE, track_number"
|
||||
}
|
||||
|
||||
|
@ -116,7 +117,7 @@ router.get("/:account/", defineEventHandler({
|
|||
}
|
||||
try {
|
||||
const prepared = db.prepare(sql)
|
||||
if (arrange === "tag") {
|
||||
if (mode === "tag_grid") {
|
||||
prepared.raw()
|
||||
}
|
||||
var items = prepared.all(params)
|
||||
|
|
|
@ -55,7 +55,6 @@ const downloadManager = new class {
|
|||
return this.inProgressTagDownloads.get(account) || (() => {
|
||||
const downloader = new TagDownloader(account)
|
||||
this.inProgressTagDownloads.set(account, downloader)
|
||||
console.log(`created downloader ${account}`)
|
||||
setTimeout(() => {
|
||||
this.resolve(account)
|
||||
})
|
||||
|
@ -74,7 +73,6 @@ const downloadManager = new class {
|
|||
resolve(account) {
|
||||
const downloader = this.check(account)
|
||||
if (!downloader.running) {
|
||||
console.log(`disposed downloader ${account}`)
|
||||
this.inProgressTagDownloads.delete(account)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue