Create m3u files.
- Write relative or absolute m3u files
- Support m3u and extm3u format
- Add extm3u displayName based on id3 tag info
Install as npm package:
npm install m3ujs --save
Install latest development version:
npm install m3ujs@next --save
import { Playlist } from 'm3ujs/playlist';
import { Mp3Entry } from 'm3ujs/mp3-entry';
import { TypeEXTM3U } from 'm3ujs/type';
const playlist = new Playlist(new TypeEXTM3U(entry => {
if (entry instanceof Mp3Entry) {
return `${entry.artist} - ${entry.album} - ${entry.track} - ${entry.title}`;
}
return entry.displayName;
}));
playlist.add(new Mp3Entry('/path/to/test.mp3'));
playlist.write('/pat/to/playlist.m3u');