Version dropdown and Album Art

This commit is contained in:
Geomitron
2020-02-08 09:54:26 -05:00
parent 749a132b4a
commit 89948b118b
9 changed files with 134 additions and 16 deletions

View File

@@ -0,0 +1,25 @@
import { Injectable } from '@angular/core'
import { ElectronService } from './electron.service'
@Injectable({
providedIn: 'root'
})
export class AlbumArtService {
constructor(private electronService: ElectronService) { }
private imageCache: { [songID: number]: Buffer } = {}
async getImage(songID: number): Promise<Buffer | null> {
if (this.imageCache[songID] == undefined) {
const albumArtResult = await this.electronService.invoke('album-art', songID)
if (albumArtResult) {
this.imageCache[songID] = albumArtResult.art
} else {
this.imageCache[songID] = null
}
}
return this.imageCache[songID]
}
}