37 lines
891 B
JavaScript
37 lines
891 B
JavaScript
// Handler around the Playlist file to keep track on the ID3 and more!
|
|
class AudioPlayerFile {
|
|
constructor(file, index) {
|
|
this.file = file;
|
|
this.name = this.getName();
|
|
this.id3 = null;
|
|
this.index = index;
|
|
}
|
|
|
|
getName() {
|
|
let name = this.file.name.split(".");
|
|
name.pop();
|
|
name = name.join(".");
|
|
return name;
|
|
}
|
|
|
|
getID3Tag(force) {
|
|
if (!force && this.id3 !== null) {
|
|
return this.id3;
|
|
}
|
|
eventHandler.sendData('getData', {
|
|
file: this.file,
|
|
name: this.name,
|
|
index: this.index,
|
|
force: force === true
|
|
});
|
|
return {
|
|
title: this.name,
|
|
artist: 'VA',
|
|
}
|
|
}
|
|
|
|
getAudioName() {
|
|
let tag = this.getID3Tag();
|
|
return template.parseTemplate('audio-information', tag);
|
|
}
|
|
} |