tiny-essentials 1.28.11 → 1.28.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,3 @@
1
- /**
2
- * A type representing either a static string or a function that returns a string, used to resolve an unknown artist's name.
3
- * @typedef {string|(() => string)} UnknownArtistGetter
4
- */
5
1
  export type UnknownArtistGetter = string | (() => string);
6
2
  export type PictureDataType = Uint8Array | string;
7
3
  export type IPictureTemplate<PictureData extends PictureDataType> = {
@@ -28,62 +24,489 @@ export type IPictureTemplate<PictureData extends PictureDataType> = {
28
24
  };
29
25
  export type IPicture = IPictureTemplate<string>;
30
26
  export type MediaNumber = {
31
- no: number | null;
32
- of: number | null;
27
+ no?: number;
28
+ of?: number;
29
+ };
30
+ export type IComment = {
31
+ /**
32
+ * - A descriptor for the comment.
33
+ */
34
+ descriptor?: string;
35
+ /**
36
+ * - The language of the comment.
37
+ */
38
+ language?: string;
39
+ /**
40
+ * - The text content of the comment.
41
+ */
42
+ text?: string;
43
+ };
44
+ export type ILyricsText = {
45
+ /**
46
+ * - The lyric text content.
47
+ */
48
+ text: string;
49
+ /**
50
+ * - The timestamp associated with this lyric line.
51
+ */
52
+ timestamp?: number;
53
+ };
54
+ export type TimestampFormat = {
55
+ /**
56
+ * - Indicates if the timestamp is not synchronized.
57
+ */
58
+ notSynchronized: number;
59
+ /**
60
+ * - The MPEG frame number.
61
+ */
62
+ mpegFrameNumber: number;
63
+ /**
64
+ * - The time in milliseconds.
65
+ */
66
+ milliseconds: number;
67
+ };
68
+ export type LyricsContentType = {
69
+ /**
70
+ * - Content type for other.
71
+ */
72
+ other: number;
73
+ /**
74
+ * - Content type for lyrics.
75
+ */
76
+ lyrics: number;
77
+ /**
78
+ * - Content type for text.
79
+ */
80
+ text: number;
81
+ /**
82
+ * - Content type for movement parts.
83
+ */
84
+ movement_part: number;
85
+ /**
86
+ * - Content type for events.
87
+ */
88
+ events: number;
89
+ /**
90
+ * - Content type for chords.
91
+ */
92
+ chord: number;
93
+ /**
94
+ * - Content type for trivia/pop.
95
+ */
96
+ trivia_pop: number;
97
+ };
98
+ export type ILyricsTag = {
99
+ /**
100
+ * - The text content of the lyrics.
101
+ */
102
+ text?: string;
103
+ /**
104
+ * - An array of synchronized lyric text objects.
105
+ */
106
+ syncText: ILyricsText[];
107
+ /**
108
+ * - The format of the timestamp.
109
+ */
110
+ timeStampFormat: TimestampFormat;
111
+ /**
112
+ * - The type of lyrical content.
113
+ */
114
+ contentType: LyricsContentType;
115
+ };
116
+ export type IRating = {
117
+ /**
118
+ * - The source of the rating.
119
+ */
120
+ source?: string;
121
+ /**
122
+ * - The numeric rating value.
123
+ */
124
+ rating?: number;
33
125
  };
34
126
  export type ContentMetadataTemplate<IPictureContent extends IPictureTemplate<PictureDataType>> = {
127
+ _fetchData?: MediaContentFetchData<PictureDataType> | null;
35
128
  /**
36
129
  * - The title of the track.
37
130
  */
38
- title: string | null;
131
+ title?: string;
39
132
  /**
40
133
  * - The name of the album.
41
134
  */
42
- album: string | null;
135
+ album?: string;
43
136
  /**
44
137
  * - The primary artist of the album.
45
138
  */
46
- albumartist: string | null;
139
+ albumartist?: string;
47
140
  /**
48
141
  * - An array of artists associated with the album.
49
142
  */
50
- albumartists: string[];
143
+ albumartists?: string[];
51
144
  /**
52
145
  * - An array of genres associated with the track.
53
146
  */
54
- genre: string[];
147
+ genre?: string[];
55
148
  /**
56
149
  * - The record label.
57
150
  */
58
- label: string[];
151
+ label?: string[];
59
152
  /**
60
153
  * - The composer of the track.
61
154
  */
62
- composer: string[];
155
+ composer?: string[];
63
156
  /**
64
157
  * - The release year.
65
158
  */
66
- year: number | null;
159
+ year?: number;
67
160
  /**
68
161
  * - The primary artist of the track.
69
162
  */
70
- artist: string | null;
163
+ artist?: string;
71
164
  /**
72
165
  * - An array of artists associated with the track.
73
166
  */
74
- artists: string[];
167
+ artists?: string[];
75
168
  /**
76
169
  * - Disk information containing the current disk number and total disks.
77
170
  */
78
- disk: MediaNumber;
171
+ disk?: MediaNumber;
79
172
  /**
80
173
  * - Track information containing the current track number and total tracks.
81
174
  */
82
- track: MediaNumber;
175
+ track?: MediaNumber;
83
176
  /**
84
177
  * - An array of picture objects containing album art.
85
178
  */
86
179
  picture?: IPictureContent[];
180
+ /**
181
+ * - The date.
182
+ */
183
+ date?: string;
184
+ /**
185
+ * - The original date.
186
+ */
187
+ originaldate?: string;
188
+ /**
189
+ * - The original release year.
190
+ */
191
+ originalyear?: number;
192
+ /**
193
+ * - The release date.
194
+ */
195
+ releasedate?: string;
196
+ /**
197
+ * - An array of comments.
198
+ */
199
+ comment?: IComment[];
200
+ /**
201
+ * - An array of lyric tags.
202
+ */
203
+ lyrics?: ILyricsTag[];
204
+ /**
205
+ * - The sortable album name.
206
+ */
207
+ albumsort?: string;
208
+ /**
209
+ * - The sortable title.
210
+ */
211
+ titlesort?: string;
212
+ /**
213
+ * - The work/composition name.
214
+ */
215
+ work?: string;
216
+ /**
217
+ * - The sortable artist name.
218
+ */
219
+ artistsort?: string;
220
+ /**
221
+ * - The sortable album artist name.
222
+ */
223
+ albumartistsort?: string;
224
+ /**
225
+ * - The sortable composer name.
226
+ */
227
+ composersort?: string;
228
+ /**
229
+ * - An array of lyricists.
230
+ */
231
+ lyricist?: string[];
232
+ /**
233
+ * - An array of writers.
234
+ */
235
+ writer?: string[];
236
+ /**
237
+ * - An array of conductors.
238
+ */
239
+ conductor?: string[];
240
+ /**
241
+ * - An array of remixers.
242
+ */
243
+ remixer?: string[];
244
+ /**
245
+ * - An array of arrangers.
246
+ */
247
+ arranger?: string[];
248
+ /**
249
+ * - An array of engineers.
250
+ */
251
+ engineer?: string[];
252
+ /**
253
+ * - An array of publishers.
254
+ */
255
+ publisher?: string[];
256
+ /**
257
+ * - An array of producers.
258
+ */
259
+ producer?: string[];
260
+ /**
261
+ * - An array of DJ mixers.
262
+ */
263
+ djmixer?: string[];
264
+ /**
265
+ * - An array of mixers.
266
+ */
267
+ mixer?: string[];
268
+ /**
269
+ * - An array of technicians.
270
+ */
271
+ technician?: string[];
272
+ /**
273
+ * - The grouping name.
274
+ */
275
+ grouping?: string;
276
+ /**
277
+ * - An array of subtitles.
278
+ */
279
+ subtitle?: string[];
280
+ /**
281
+ * - An array of descriptions.
282
+ */
283
+ description?: string[];
284
+ /**
285
+ * - A long description.
286
+ */
287
+ longDescription?: string;
288
+ /**
289
+ * - An array of disc subtitles.
290
+ */
291
+ discsubtitle?: string[];
292
+ /**
293
+ * - Total number of tracks.
294
+ */
295
+ totaltracks?: string;
296
+ /**
297
+ * - Total number of discs.
298
+ */
299
+ totaldiscs?: string;
300
+ /**
301
+ * - Total number of movements.
302
+ */
303
+ movementTotal?: number;
304
+ /**
305
+ * - Whether it is a compilation.
306
+ */
307
+ compilation?: boolean;
308
+ /**
309
+ * - An array of ratings.
310
+ */
311
+ rating?: IRating[];
312
+ /**
313
+ * - Beats per minute.
314
+ */
315
+ bpm?: number;
316
+ /**
317
+ * - The mood of the track.
318
+ */
319
+ mood?: string;
320
+ /**
321
+ * - The media type.
322
+ */
323
+ media?: string;
324
+ /**
325
+ * - An array of catalog numbers.
326
+ */
327
+ catalognumber?: string[];
328
+ /**
329
+ * - The TV show name.
330
+ */
331
+ tvShow?: string;
332
+ /**
333
+ * - The sortable TV show name.
334
+ */
335
+ tvShowSort?: string;
336
+ /**
337
+ * - The TV season number.
338
+ */
339
+ tvSeason?: number;
340
+ /**
341
+ * - The TV episode number.
342
+ */
343
+ tvEpisode?: number;
344
+ /**
345
+ * - The TV episode ID.
346
+ */
347
+ tvEpisodeId?: string;
348
+ /**
349
+ * - The TV network.
350
+ */
351
+ tvNetwork?: string;
352
+ /**
353
+ * - Whether it is a podcast.
354
+ */
355
+ podcast?: boolean;
356
+ /**
357
+ * - The podcast URL.
358
+ */
359
+ podcasturl?: string;
360
+ /**
361
+ * - The release status.
362
+ */
363
+ releasestatus?: string;
364
+ /**
365
+ * - An array of release types.
366
+ */
367
+ releasetype?: string[];
368
+ /**
369
+ * - The release country.
370
+ */
371
+ releasecountry?: string;
372
+ /**
373
+ * - The script.
374
+ */
375
+ script?: string;
376
+ /**
377
+ * - The language.
378
+ */
379
+ language?: string;
380
+ /**
381
+ * - The copyright information.
382
+ */
383
+ copyright?: string;
384
+ /**
385
+ * - The license information.
386
+ */
387
+ license?: string;
388
+ /**
389
+ * - The encoder.
390
+ */
391
+ encodedby?: string;
392
+ /**
393
+ * - The encoder settings.
394
+ */
395
+ encodersettings?: string;
396
+ /**
397
+ * - Whether it is gapless.
398
+ */
399
+ gapless?: boolean;
400
+ /**
401
+ * - The barcode.
402
+ */
403
+ barcode?: string;
404
+ /**
405
+ * - An array of ISRC codes.
406
+ */
407
+ isrc?: string[];
408
+ /**
409
+ * - The ASIN.
410
+ */
411
+ asin?: string;
412
+ /**
413
+ * - The website.
414
+ */
415
+ website?: string;
416
+ /**
417
+ * - An array of performers and their instruments.
418
+ */
419
+ performer_instrument?: string[];
420
+ /**
421
+ * - The average loudness level.
422
+ */
423
+ averageLevel?: number;
424
+ /**
425
+ * - The peak loudness level.
426
+ */
427
+ peakLevel?: number;
428
+ /**
429
+ * - An array of notes.
430
+ */
431
+ notes?: string[];
432
+ /**
433
+ * - The original album.
434
+ */
435
+ originalalbum?: string;
436
+ /**
437
+ * - The original artist.
438
+ */
439
+ originalartist?: string;
440
+ /**
441
+ * - The initial key of the music in the file, e.g. "A Minor".
442
+ */
443
+ key?: string;
444
+ /**
445
+ * - An array of categories.
446
+ */
447
+ category?: string[];
448
+ /**
449
+ * - HD video flag.
450
+ */
451
+ hdVideo?: number;
452
+ /**
453
+ * - An array of keywords.
454
+ */
455
+ keywords?: string[];
456
+ /**
457
+ * - The movement.
458
+ */
459
+ movement?: string;
460
+ /**
461
+ * - The movement index.
462
+ */
463
+ movementIndex?: MediaNumber;
464
+ /**
465
+ * - The podcast ID.
466
+ */
467
+ podcastId?: string;
468
+ /**
469
+ * - Whether to show movement.
470
+ */
471
+ showMovement?: boolean;
472
+ /**
473
+ * - The stik value.
474
+ */
475
+ stik?: number;
476
+ /**
477
+ * - The play counter.
478
+ */
479
+ playCounter?: number;
480
+ };
481
+ export type MediaContentFetchNativeData = {
482
+ /**
483
+ * - The unique identifier for the native data.
484
+ */
485
+ id: string;
486
+ /**
487
+ * - The actual data value.
488
+ */
489
+ value?: any | Record<string | number | symbol, unknown>;
490
+ };
491
+ export type ICommonTagsResult<PictureData extends PictureDataType> = Record<string | number | symbol, unknown> & ContentMetadataTemplate<IPictureTemplate<PictureData>>;
492
+ export type INativeTags = Record<string | number | symbol, MediaContentFetchNativeData[]>;
493
+ export type MediaContentFetchData<PictureData extends PictureDataType> = {
494
+ /**
495
+ * - The common metadata properties.
496
+ */
497
+ common: ICommonTagsResult<PictureData>;
498
+ /**
499
+ * - The native metadata properties.
500
+ */
501
+ native: INativeTags;
502
+ /**
503
+ * - The format of the media.
504
+ */
505
+ format: unknown;
506
+ /**
507
+ * - The quality of the media.
508
+ */
509
+ quality: unknown;
87
510
  };
88
511
  export type MediaContentMetadata<PictureData extends PictureDataType> = ContentMetadataTemplate<IPictureTemplate<PictureData>>;
89
512
  export type MediaContentBase = {
@@ -117,9 +540,7 @@ export type MediaContentBase = {
117
540
  weight?: number;
118
541
  };
119
542
  export type MediaContent<PictureData extends PictureDataType> = MediaContentBase & MediaContentMetadata<PictureData>;
120
- export type ParseMediaContentMetadata = (data: Blob) => Promise<{
121
- common: Partial<ContentMetadataTemplate<IPictureTemplate<PictureDataType>>>;
122
- }>;
543
+ export type ParseMediaContentMetadata = (data: Blob) => Promise<MediaContentFetchData<PictureDataType>>;
123
544
  export type LoadingMediaProgress = {
124
545
  /**
125
546
  * - The current status of the operation.
@@ -161,11 +582,6 @@ export declare const _blobCounter: Map<string, number>;
161
582
  * @returns {MediaContentBase}
162
583
  */
163
584
  export declare const getMediaContentBase: () => MediaContentBase;
164
- /**
165
- * Returns a new object initialized with the default values for the media content metadata properties.
166
- * @returns {MediaContentMetadata<PictureDataType>}
167
- */
168
- export declare const getMediaContentMetadata: () => MediaContentMetadata<PictureDataType>;
169
585
  /**
170
586
  * Custom error class to provide detailed context during the content preparation process.
171
587
  * @extends Error
@@ -207,17 +623,16 @@ export declare const blobUrlToBase64: (url: string) => Promise<string>;
207
623
  */
208
624
  export declare const revokeContentUrls: <PictureData extends PictureDataType>(content: MediaContent<PictureData>) => void;
209
625
  /**
210
- * Helper to validate types within the media content metadata object.
211
- * This ensures that if a property is present, it matches the expected type.
212
- * @param {ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>} common
626
+ * @param {MediaContentFetchData<PictureDataType>|null} [fetchData] - The fetch object to be validated.
627
+ * @param {boolean} [returnsBoolean=false] - Ignores the throw error to return a boolean.
628
+ * @returns {boolean}
213
629
  */
214
- export declare const valMediaContentMetadata: (common: ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>) => void;
630
+ export declare const valFetchMediaContent: (fetchData?: MediaContentFetchData<PictureDataType> | null, returnsBoolean?: boolean) => boolean;
215
631
  /**
216
- * Helper to validate types within the media content metadata object.
217
- * Allows the absence of properties (useful for updates/patch).
218
- * @param {Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>} common
632
+ * Central logic of metadata validation.
633
+ * @param {ContentMetadataTemplate<IPictureTemplate<string | Uint8Array>>} common - The object to be validated.
219
634
  */
220
- export declare const valMediaContentMetadataPartial: (common: Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>) => void;
635
+ export declare const valMediaContentMetadata: (common: ContentMetadataTemplate<IPictureTemplate<string | Uint8Array>>) => void;
221
636
  /**
222
637
  * Downloads an audio file from a URL and extracts its ID3/metadata tags.
223
638
  *