(Proper) Initial commit
This commit is contained in:
parent
48c0059860
commit
32796e4026
19 changed files with 6094 additions and 97 deletions
49
backend/models/queue.models.ts
Normal file
49
backend/models/queue.models.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import QM from "../queueManager";
|
||||
import {ProcessingQueue, Queue, QueueItem} from "../types/queue";
|
||||
|
||||
export function list(): Queue {
|
||||
return QM.getQueue();
|
||||
}
|
||||
|
||||
export function get(index: number): QueueItem {
|
||||
return QM.get(index);
|
||||
}
|
||||
|
||||
export async function add(song: string): Promise<QueueItem> {
|
||||
return await QM.add(song);
|
||||
}
|
||||
|
||||
export async function insertAt(song: string, index: number): Promise<QueueItem> {
|
||||
return await QM.insertAt(song, index);
|
||||
}
|
||||
|
||||
export async function remove(song: string): Promise<QueueItem> {
|
||||
return await QM.remove(song);
|
||||
}
|
||||
|
||||
export function clear(): void {
|
||||
QM.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an item from one index to another.
|
||||
* @param song the song to move
|
||||
* @param to the index to move the song to.
|
||||
* If an item already exists at this index, the song will be inserted before it.
|
||||
* If the index is out of bounds, the song will be moved to the end of the queue.
|
||||
*/
|
||||
export function move(song: string, to: number): void {
|
||||
QM.move(song, to);
|
||||
}
|
||||
|
||||
export function retry(song: string): void {
|
||||
QM.retry(song);
|
||||
}
|
||||
|
||||
export function processing(): ProcessingQueue {
|
||||
return QM.getProcessing();
|
||||
}
|
||||
|
||||
export function history(): Queue {
|
||||
return QM.getHistory();
|
||||
}
|
Reference in a new issue