Comparing version 0.0.0 to 0.0.1
@@ -9,6 +9,13 @@ import type { ProbeResult } from './js-binding' | ||
export * from './lib/binding'; | ||
export interface Metadata { | ||
title: string | null; | ||
author: string | null; | ||
genre: string | null; | ||
} | ||
export * from './js-binding'; | ||
export function probeStream( | ||
stream: Readable, | ||
probeSize?: number | ||
): Promise<StreamProbeResult>; | ||
): Promise<StreamProbeResult>; | ||
export function readMetadata(result: ProbeResult): Metadata; |
29
index.js
@@ -92,2 +92,30 @@ const binding = require('./js-binding'); | ||
/** | ||
* Reads metadata tags | ||
* @param {import('./js-binding').ProbeResult} result The probe result to read metadata from | ||
*/ | ||
function readMetadata(result) { | ||
const res = { | ||
title: null, | ||
author: null, | ||
genre: null | ||
}; | ||
if (!result.metadata?.length) return res; | ||
result.metadata.forEach(m => { | ||
if (!m.value) return; | ||
if ((m.name === 'TPE1' || m.name === 'TPUB') && !res['author']) { | ||
res['author'] = m.value; | ||
} else if (m.name === 'TIT2') { | ||
res['title'] = m.value; | ||
} else if ((m.name === 'TALB' || m.name === 'TCON') && !res['genre']) { | ||
res['genre'] = m.value; | ||
} | ||
}); | ||
return res; | ||
} | ||
const { CodecType, probe } = binding; | ||
@@ -99,2 +127,3 @@ | ||
probeStream, | ||
readMetadata | ||
}; |
@@ -19,2 +19,4 @@ /* tslint:disable */ | ||
duration: number | ||
/** The metadata object */ | ||
metadata: Array<MetadataField> | ||
} | ||
@@ -89,2 +91,6 @@ export const enum CodecType { | ||
} | ||
export interface MetadataField { | ||
name: string | ||
value: string | ||
} | ||
export function probe(data: Buffer): ProbeResult |
{ | ||
"name": "mediaplex", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"main": "index.js", | ||
@@ -64,17 +64,17 @@ "types": "index.d.ts", | ||
"optionalDependencies": { | ||
"mediaplex-win32-x64-msvc": "0.0.0", | ||
"mediaplex-darwin-x64": "0.0.0", | ||
"mediaplex-linux-x64-gnu": "0.0.0", | ||
"mediaplex-darwin-arm64": "0.0.0", | ||
"mediaplex-android-arm64": "0.0.0", | ||
"mediaplex-linux-arm64-gnu": "0.0.0", | ||
"mediaplex-linux-arm64-musl": "0.0.0", | ||
"mediaplex-win32-arm64-msvc": "0.0.0", | ||
"mediaplex-linux-arm-gnueabihf": "0.0.0", | ||
"mediaplex-linux-x64-musl": "0.0.0", | ||
"mediaplex-freebsd-x64": "0.0.0", | ||
"mediaplex-win32-ia32-msvc": "0.0.0", | ||
"mediaplex-android-arm-eabi": "0.0.0", | ||
"mediaplex-darwin-universal": "0.0.0" | ||
"mediaplex-win32-x64-msvc": "0.0.1", | ||
"mediaplex-darwin-x64": "0.0.1", | ||
"mediaplex-linux-x64-gnu": "0.0.1", | ||
"mediaplex-darwin-arm64": "0.0.1", | ||
"mediaplex-android-arm64": "0.0.1", | ||
"mediaplex-linux-arm64-gnu": "0.0.1", | ||
"mediaplex-linux-arm64-musl": "0.0.1", | ||
"mediaplex-win32-arm64-msvc": "0.0.1", | ||
"mediaplex-linux-arm-gnueabihf": "0.0.1", | ||
"mediaplex-linux-x64-musl": "0.0.1", | ||
"mediaplex-freebsd-x64": "0.0.1", | ||
"mediaplex-win32-ia32-msvc": "0.0.1", | ||
"mediaplex-android-arm-eabi": "0.0.1", | ||
"mediaplex-darwin-universal": "0.0.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33993
14
462