Reliably fill "position" field in tracks

This commit is contained in:
encode42 2024-05-29 23:37:47 -04:00
parent 20fe6b225a
commit 48837d80fa
No known key found for this signature in database
GPG Key ID: 7E6D1008AC19B80B
3 changed files with 6 additions and 5 deletions

6
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "bandcamp-fetch", "name": "@encode42/bandcamp-fetch",
"version": "1.2.1", "version": "1.2.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "bandcamp-fetch", "name": "@encode42/bandcamp-fetch",
"version": "1.2.1", "version": "1.2.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -30,7 +30,7 @@
"typescript": "^4.9.5" "typescript": "^4.9.5"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=15"
} }
}, },
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@encode42/bandcamp-fetch", "name": "@encode42/bandcamp-fetch",
"version": "1.2.1", "version": "1.2.3",
"description": "Scrape Bandcamp content (supports Cloudflare Pages)", "description": "Scrape Bandcamp content (supports Cloudflare Pages)",
"scripts": { "scripts": {
"build": "npm run prepare", "build": "npm run prepare",

View File

@ -64,7 +64,8 @@ export default class TrackInfoParser {
type: 'track', type: 'track',
name: basic.name, name: basic.name,
description: basic.description.replaceAll('\r\n', '\n') || '', description: basic.description.replaceAll('\r\n', '\n') || '',
url: basic['@id'] url: basic['@id'],
position: extra.current?.track_number
}; };
const imageUrl = reformatImageUrl(basic.image, opts.albumImageFormat); const imageUrl = reformatImageUrl(basic.image, opts.albumImageFormat);