tiny-essentials 1.28.12 → 1.28.15

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