fix evil edge case (and fix typo)

is it really my fault. they say it's required right here: https://developer.apple.com/documentation/applemusicapi/songs/attributes-data.dictionary
This commit is contained in:
Reid 2025-10-21 00:06:26 -07:00
parent 6670b57674
commit a8571f28c6
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
3 changed files with 5 additions and 3 deletions

View file

@ -53,7 +53,9 @@ export type SongAttributes<
composerName?: string;
contentRating?: string;
discNumber?: number;
durationInMillis: number;
// >claims to be required
// >not present sometimes ??
durationInMillis?: number;
editorialNotes?: EditorialNotes;
genreNames: string[];
hasLyrics: boolean;

View file

@ -16,7 +16,7 @@ setGlobalDispatcher(new Agent().compose([
// TODO: configurable cache sizes?
// these values are pretty nice for non-binary (lol) data
interceptors.cache({ store: new cacheStores.MemoryCacheStore({
maxSize: 50 * 1024 * 1024, // 5mb
maxSize: 50 * 1024 * 1024, // 50mb
maxCount: 1000,
maxEntrySize: 5 * 1024 // 5kb
})})

View file

@ -24,7 +24,7 @@ const hbs = create({
helpers: {
add(a: number, b: number) { return a + b; },
arrayJoin(array: string[], separator: string) { return array.join(separator); },
formatDuration(duration: number) { return formatDuration(duration); },
formatDuration(duration?: number) { return duration === undefined ? "n/a" : formatDuration(duration); },
greaterThan(a: number, b: number) { return a > b; },
mapNumberToLetter(num: number) { return String.fromCharCode(num + 64); } // A = 1, B = 2
}