More stuff

This commit is contained in:
Torben Pi Jensen 2023-11-09 19:36:18 +01:00
parent 2da7f2f1c9
commit 6a3eb21439
5 changed files with 55 additions and 83 deletions

View File

@ -4,41 +4,14 @@ export enum SongType {
} }
export class SearchResult {
public type: SongType
public title: string;
public songId: string;
public image: string;
constructor(type: SongType, title: string, songId: string, image: string) {
this.type = type;
this.title = title;
this.songId = songId;
this.image = image;
}
}
export class QueuedSong {
public title: string;
public image: string;
constructor(title: string, image: string) {
this.title = title;
this.image = image;
}
}
export class Song { export class Song {
public type: SongType constructor(public type: SongType, public title: string, public songId: string, public image: string) {
public songId: string;
public title: string;
public position: number;
constructor(type: SongType, songId: string, title: string, position: number) { }
this.type = type; }
this.songId = songId;
this.title = title; export class PlayingSong extends Song {
this.position = position; constructor(type: SongType, title: string, songId: string, image: string, public position: number) {
super(type, title, songId, image);
} }
} }

14
dist/dataTypes.d.ts vendored
View File

@ -2,22 +2,14 @@ export declare enum SongType {
YouTube = 0, YouTube = 0,
Spotify = 1 Spotify = 1
} }
export declare class SearchResult { export declare class Song {
type: SongType; type: SongType;
title: string; title: string;
songId: string; songId: string;
image: string; image: string;
constructor(type: SongType, title: string, songId: string, image: string); constructor(type: SongType, title: string, songId: string, image: string);
} }
export declare class QueuedSong { export declare class PlayingSong extends Song {
title: string;
image: string;
constructor(title: string, image: string);
}
export declare class Song {
type: SongType;
songId: string;
title: string;
position: number; position: number;
constructor(type: SongType, songId: string, title: string, position: number); constructor(type: SongType, title: string, songId: string, image: string, position: number);
} }

51
dist/dataTypes.js vendored
View File

@ -1,36 +1,43 @@
"use strict"; "use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true; exports.__esModule = true;
exports.Song = exports.QueuedSong = exports.SearchResult = exports.SongType = void 0; exports.PlayingSong = exports.Song = exports.SongType = void 0;
var SongType; var SongType;
(function (SongType) { (function (SongType) {
SongType[SongType["YouTube"] = 0] = "YouTube"; SongType[SongType["YouTube"] = 0] = "YouTube";
SongType[SongType["Spotify"] = 1] = "Spotify"; SongType[SongType["Spotify"] = 1] = "Spotify";
})(SongType = exports.SongType || (exports.SongType = {})); })(SongType = exports.SongType || (exports.SongType = {}));
var SearchResult = /** @class */ (function () {
function SearchResult(type, title, songId, image) {
this.type = type;
this.title = title;
this.songId = songId;
this.image = image;
}
return SearchResult;
}());
exports.SearchResult = SearchResult;
var QueuedSong = /** @class */ (function () {
function QueuedSong(title, image) {
this.title = title;
this.image = image;
}
return QueuedSong;
}());
exports.QueuedSong = QueuedSong;
var Song = /** @class */ (function () { var Song = /** @class */ (function () {
function Song(type, songId, title, position) { function Song(type, title, songId, image) {
this.type = type; this.type = type;
this.songId = songId;
this.title = title; this.title = title;
this.position = position; this.songId = songId;
this.image = image;
} }
return Song; return Song;
}()); }());
exports.Song = Song; exports.Song = Song;
var PlayingSong = /** @class */ (function (_super) {
__extends(PlayingSong, _super);
function PlayingSong(type, title, songId, image, position) {
var _this = _super.call(this, type, title, songId, image) || this;
_this.position = position;
return _this;
}
return PlayingSong;
}(Song));
exports.PlayingSong = PlayingSong;

View File

@ -1,4 +1,4 @@
import { Song, SearchResult, QueuedSong } from "./dataTypes"; import { Song, PlayingSong } from "./dataTypes";
export declare type StuenMessages = ListenerLeft | ListenerList | ListenerJoined | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong; export declare type StuenMessages = ListenerLeft | ListenerList | ListenerJoined | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong;
export declare abstract class StuenMessage { export declare abstract class StuenMessage {
type: string; type: string;
@ -34,21 +34,21 @@ export declare class SearchSong extends StuenMessage {
constructor(query: string); constructor(query: string);
} }
export declare class SearchSongResult extends StuenMessage { export declare class SearchSongResult extends StuenMessage {
result: SearchResult[]; result: Song[];
constructor(result: SearchResult[]); constructor(result: Song[]);
} }
export declare class QueueSong extends StuenMessage { export declare class QueueSong extends StuenMessage {
song: SearchResult;
constructor(song: SearchResult);
}
export declare class CurrentQueue extends StuenMessage {
songs: QueuedSong[];
constructor(songs: QueuedSong[]);
}
export declare class CurrentSong extends StuenMessage {
song: Song; song: Song;
constructor(song: Song); constructor(song: Song);
} }
export declare class CurrentQueue extends StuenMessage {
songs: Song[];
constructor(songs: Song[]);
}
export declare class CurrentSong extends StuenMessage {
song: PlayingSong;
constructor(song: PlayingSong);
}
export declare class UnqueueSong extends StuenMessage { export declare class UnqueueSong extends StuenMessage {
position: number | null; position: number | null;
all: boolean | undefined; all: boolean | undefined;

View File

@ -1,4 +1,4 @@
import {Song, SearchResult, QueuedSong} from "./dataTypes"; import {Song, PlayingSong} from "./dataTypes";
export type StuenMessages = ListenerLeft | ListenerList | ListenerJoined | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong; export type StuenMessages = ListenerLeft | ListenerList | ListenerJoined | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong;
export abstract class StuenMessage { export abstract class StuenMessage {
@ -50,25 +50,25 @@ export class SearchSong extends StuenMessage {
export class SearchSongResult extends StuenMessage { export class SearchSongResult extends StuenMessage {
constructor(public result: SearchResult[]) { constructor(public result: Song[]) {
super('SearchSongResult'); super('SearchSongResult');
} }
} }
export class QueueSong extends StuenMessage { export class QueueSong extends StuenMessage {
constructor(public song: SearchResult) { constructor(public song: Song) {
super('QueueSong'); super('QueueSong');
} }
} }
export class CurrentQueue extends StuenMessage { export class CurrentQueue extends StuenMessage {
constructor(public songs: QueuedSong[]) { constructor(public songs: Song[]) {
super('CurrentQueue'); super('CurrentQueue');
} }
} }
export class CurrentSong extends StuenMessage { export class CurrentSong extends StuenMessage {
constructor(public song: Song) { constructor(public song: PlayingSong) {
super('CurrentSong'); super('CurrentSong');
} }
} }