mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-07-09 03:25:09 +00:00
Version dropdown and Album Art
This commit is contained in:
@@ -9,8 +9,8 @@ export default class Database {
|
||||
static async getInstance() {
|
||||
if (this.database == undefined) {
|
||||
this.database = new Database()
|
||||
await this.database.initDatabaseConnection()
|
||||
}
|
||||
await this.database.initDatabaseConnection()
|
||||
return this.database
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export default class Database {
|
||||
* @returns one of the responses as type <ResponseType[]>, or an empty array if the query fails.
|
||||
*/
|
||||
async sendQuery<ResponseType>(query: string, queryStatement?: number) {
|
||||
return new Promise<ResponseType[]>(resolve => {
|
||||
return new Promise<ResponseType[] | ResponseType>(resolve => {
|
||||
this.conn.query(query, (err, results) => {
|
||||
if (err) {
|
||||
failQuery(query, err)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import SearchHandler from '../ipc/SearchHandler.ipc'
|
||||
import { SongSearch, SongResult } from './interfaces/search.interface'
|
||||
import { VersionResult } from './interfaces/songDetails.interface'
|
||||
import { VersionResult, AlbumArtResult } from './interfaces/songDetails.interface'
|
||||
import SearchHandler from '../ipc/SearchHandler.ipc'
|
||||
import SongDetailsHandler from '../ipc/SongDetailsHandler.ipc'
|
||||
import AlbumArtHandler from '../ipc/AlbumArtHandler.ipc'
|
||||
|
||||
/**
|
||||
* To add a new IPC listener:
|
||||
@@ -14,7 +15,8 @@ import SongDetailsHandler from '../ipc/SongDetailsHandler.ipc'
|
||||
export function getIPCHandlers(): IPCHandler<keyof IPCEvents>[] {
|
||||
return [
|
||||
new SearchHandler(),
|
||||
new SongDetailsHandler()
|
||||
new SongDetailsHandler(),
|
||||
new AlbumArtHandler()
|
||||
]
|
||||
}
|
||||
|
||||
@@ -23,6 +25,10 @@ export type IPCEvents = {
|
||||
input: SongSearch
|
||||
output: SongResult[]
|
||||
}
|
||||
['album-art']: {
|
||||
input: SongResult['id']
|
||||
output: AlbumArtResult
|
||||
}
|
||||
['song-details']: {
|
||||
input: SongResult['id']
|
||||
output: VersionResult[]
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
export interface AlbumArtResult {
|
||||
art: Buffer
|
||||
}
|
||||
|
||||
export interface VersionResult {
|
||||
versionID: number
|
||||
chartID: number
|
||||
|
||||
Reference in New Issue
Block a user