Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
365132977a | ||
|
|
3c80493446 | ||
|
|
927aa80398 | ||
|
|
1b31aaf549 | ||
|
|
7e1136acad | ||
|
|
1487f6e1f5 | ||
|
|
8760a3affc | ||
|
|
00dedc1d85 | ||
|
|
283d7ea4ec | ||
|
|
e2475c254e | ||
|
|
d08afcc4d6 | ||
|
|
d47379aacc | ||
|
|
01b8319aef | ||
|
|
993501f049 | ||
|
|
343126bee3 | ||
|
|
588c778122 | ||
|
|
2ec9585c74 | ||
|
|
d5b4cfefc3 | ||
|
|
807cd568e1 | ||
|
|
04253f753a | ||
|
|
829e9c599b |
14
dataTypes.ts
14
dataTypes.ts
@@ -5,20 +5,20 @@ export enum SongType {
|
|||||||
|
|
||||||
|
|
||||||
export class Song {
|
export class Song {
|
||||||
constructor(public type: SongType, public title: string, public songId: string, public image: string) {
|
constructor(public type: SongType, public title: string, public songId: string, public image: string, public inAutoPlay: boolean) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QueuedSong extends Song {
|
export class QueuedSong extends Song {
|
||||||
constructor(type: SongType, title: string, songId: string, image: string, public listener: string) {
|
constructor(type: SongType, title: string, songId: string, image: string, public listener: string, public inAutoPlay: boolean) {
|
||||||
super(type, title, songId, image);
|
super(type, title, songId, image, inAutoPlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PlayingSong extends QueuedSong {
|
export class PlayingSong extends QueuedSong {
|
||||||
constructor(type: SongType, title: string, songId: string, image: string, listener: string, public length: number, public position: number) {
|
constructor(type: SongType, title: string, songId: string, image: string, listener: string, public length: number, public position: number, public tags: string[], public inAutoPlay: boolean) {
|
||||||
super(type, title, songId, image, listener);
|
super(type, title, songId, image, listener, inAutoPlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,3 +26,7 @@ export class Playlist {
|
|||||||
constructor(public title: string, public listener: string, public songs: Song[]) {
|
constructor(public title: string, public listener: string, public songs: Song[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class PlaylistDescription {
|
||||||
|
constructor(public title: string, public listener: string) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
2
dist/common.js
vendored
2
dist/common.js
vendored
@@ -13,7 +13,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|||||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||||
};
|
};
|
||||||
exports.__esModule = true;
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
__exportStar(require("./dataTypes"), exports);
|
__exportStar(require("./dataTypes"), exports);
|
||||||
__exportStar(require("./messageTypes"), exports);
|
__exportStar(require("./messageTypes"), exports);
|
||||||
__exportStar(require("./parseMessage"), exports);
|
__exportStar(require("./parseMessage"), exports);
|
||||||
|
|||||||
15
dist/dataTypes.d.ts
vendored
15
dist/dataTypes.d.ts
vendored
@@ -7,16 +7,20 @@ export declare class Song {
|
|||||||
title: string;
|
title: string;
|
||||||
songId: string;
|
songId: string;
|
||||||
image: string;
|
image: string;
|
||||||
constructor(type: SongType, title: string, songId: string, image: string);
|
inAutoPlay: boolean;
|
||||||
|
constructor(type: SongType, title: string, songId: string, image: string, inAutoPlay: boolean);
|
||||||
}
|
}
|
||||||
export declare class QueuedSong extends Song {
|
export declare class QueuedSong extends Song {
|
||||||
listener: string;
|
listener: string;
|
||||||
constructor(type: SongType, title: string, songId: string, image: string, listener: string);
|
inAutoPlay: boolean;
|
||||||
|
constructor(type: SongType, title: string, songId: string, image: string, listener: string, inAutoPlay: boolean);
|
||||||
}
|
}
|
||||||
export declare class PlayingSong extends QueuedSong {
|
export declare class PlayingSong extends QueuedSong {
|
||||||
length: number;
|
length: number;
|
||||||
position: number;
|
position: number;
|
||||||
constructor(type: SongType, title: string, songId: string, image: string, listener: string, length: number, position: number);
|
tags: string[];
|
||||||
|
inAutoPlay: boolean;
|
||||||
|
constructor(type: SongType, title: string, songId: string, image: string, listener: string, length: number, position: number, tags: string[], inAutoPlay: boolean);
|
||||||
}
|
}
|
||||||
export declare class Playlist {
|
export declare class Playlist {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -24,3 +28,8 @@ export declare class Playlist {
|
|||||||
songs: Song[];
|
songs: Song[];
|
||||||
constructor(title: string, listener: string, songs: Song[]);
|
constructor(title: string, listener: string, songs: Song[]);
|
||||||
}
|
}
|
||||||
|
export declare class PlaylistDescription {
|
||||||
|
title: string;
|
||||||
|
listener: string;
|
||||||
|
constructor(title: string, listener: string);
|
||||||
|
}
|
||||||
|
|||||||
28
dist/dataTypes.js
vendored
28
dist/dataTypes.js
vendored
@@ -14,28 +14,30 @@ var __extends = (this && this.__extends) || (function () {
|
|||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
exports.__esModule = true;
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.Playlist = exports.PlayingSong = exports.QueuedSong = exports.Song = exports.SongType = void 0;
|
exports.PlaylistDescription = exports.Playlist = exports.PlayingSong = exports.QueuedSong = 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 = SongType = {}));
|
||||||
var Song = /** @class */ (function () {
|
var Song = /** @class */ (function () {
|
||||||
function Song(type, title, songId, image) {
|
function Song(type, title, songId, image, inAutoPlay) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.songId = songId;
|
this.songId = songId;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
|
this.inAutoPlay = inAutoPlay;
|
||||||
}
|
}
|
||||||
return Song;
|
return Song;
|
||||||
}());
|
}());
|
||||||
exports.Song = Song;
|
exports.Song = Song;
|
||||||
var QueuedSong = /** @class */ (function (_super) {
|
var QueuedSong = /** @class */ (function (_super) {
|
||||||
__extends(QueuedSong, _super);
|
__extends(QueuedSong, _super);
|
||||||
function QueuedSong(type, title, songId, image, listener) {
|
function QueuedSong(type, title, songId, image, listener, inAutoPlay) {
|
||||||
var _this = _super.call(this, type, title, songId, image) || this;
|
var _this = _super.call(this, type, title, songId, image, inAutoPlay) || this;
|
||||||
_this.listener = listener;
|
_this.listener = listener;
|
||||||
|
_this.inAutoPlay = inAutoPlay;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
return QueuedSong;
|
return QueuedSong;
|
||||||
@@ -43,10 +45,12 @@ var QueuedSong = /** @class */ (function (_super) {
|
|||||||
exports.QueuedSong = QueuedSong;
|
exports.QueuedSong = QueuedSong;
|
||||||
var PlayingSong = /** @class */ (function (_super) {
|
var PlayingSong = /** @class */ (function (_super) {
|
||||||
__extends(PlayingSong, _super);
|
__extends(PlayingSong, _super);
|
||||||
function PlayingSong(type, title, songId, image, listener, length, position) {
|
function PlayingSong(type, title, songId, image, listener, length, position, tags, inAutoPlay) {
|
||||||
var _this = _super.call(this, type, title, songId, image, listener) || this;
|
var _this = _super.call(this, type, title, songId, image, listener, inAutoPlay) || this;
|
||||||
_this.length = length;
|
_this.length = length;
|
||||||
_this.position = position;
|
_this.position = position;
|
||||||
|
_this.tags = tags;
|
||||||
|
_this.inAutoPlay = inAutoPlay;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
return PlayingSong;
|
return PlayingSong;
|
||||||
@@ -61,3 +65,11 @@ var Playlist = /** @class */ (function () {
|
|||||||
return Playlist;
|
return Playlist;
|
||||||
}());
|
}());
|
||||||
exports.Playlist = Playlist;
|
exports.Playlist = Playlist;
|
||||||
|
var PlaylistDescription = /** @class */ (function () {
|
||||||
|
function PlaylistDescription(title, listener) {
|
||||||
|
this.title = title;
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
return PlaylistDescription;
|
||||||
|
}());
|
||||||
|
exports.PlaylistDescription = PlaylistDescription;
|
||||||
|
|||||||
38
dist/messageTypes.d.ts
vendored
38
dist/messageTypes.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
import { Song, PlayingSong, QueuedSong, Playlist } from "./dataTypes";
|
import { Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription } from "./dataTypes";
|
||||||
export declare type StuenMessages = ListenerLeft | ListenerList | ListenerJoined | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong | SkipSong | SongLikes | CreatePlaylist | ToggleSongLike | AddSongToPlaylist | RemoveSongFromPlaylist | Playlists;
|
export type StuenMessages = ListenerLeft | ListenerList | ListenerJoined | SendChatMessage | SearchSong | SearchSongResult | Join | QueueSong | CurrentQueue | CurrentSong | UnqueueSong | ReorderSong | SkipSong | SongLikes | ToggleSongLike | CreatePlaylist | RemovePlaylist | AddSongToPlaylist | RemoveSongFromPlaylist | Playlists | GetPlaylist | PlaylistSongs | GetOtherPlaylists | ToggleTag | Shuffle | RemoveFromAutoPlay;
|
||||||
export declare abstract class StuenMessage {
|
export declare abstract class StuenMessage {
|
||||||
type: string;
|
type: string;
|
||||||
constructor(type: string);
|
constructor(type: string);
|
||||||
@@ -73,9 +73,28 @@ export declare class CreatePlaylist extends StuenMessage {
|
|||||||
title: string;
|
title: string;
|
||||||
constructor(title: string);
|
constructor(title: string);
|
||||||
}
|
}
|
||||||
|
export declare class RemovePlaylist extends StuenMessage {
|
||||||
|
title: string;
|
||||||
|
constructor(title: string);
|
||||||
|
}
|
||||||
export declare class Playlists extends StuenMessage {
|
export declare class Playlists extends StuenMessage {
|
||||||
playlists: Playlist[];
|
playlists: PlaylistDescription[];
|
||||||
constructor(playlists: Playlist[]);
|
constructor(playlists: PlaylistDescription[]);
|
||||||
|
}
|
||||||
|
export declare class GetPlaylist extends StuenMessage {
|
||||||
|
playlist: PlaylistDescription;
|
||||||
|
constructor(playlist: PlaylistDescription);
|
||||||
|
}
|
||||||
|
export declare class PlaylistSongs extends StuenMessage {
|
||||||
|
playlist: Playlist;
|
||||||
|
constructor(playlist: Playlist);
|
||||||
|
}
|
||||||
|
export declare class GetOtherPlaylists extends StuenMessage {
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export declare class OthersPlaylists extends StuenMessage {
|
||||||
|
playlists: PlaylistDescription[];
|
||||||
|
constructor(playlists: PlaylistDescription[]);
|
||||||
}
|
}
|
||||||
export declare class AddSongToPlaylist extends StuenMessage {
|
export declare class AddSongToPlaylist extends StuenMessage {
|
||||||
song: Song;
|
song: Song;
|
||||||
@@ -87,3 +106,14 @@ export declare class RemoveSongFromPlaylist extends StuenMessage {
|
|||||||
playlist: string;
|
playlist: string;
|
||||||
constructor(song: Song, playlist: string);
|
constructor(song: Song, playlist: string);
|
||||||
}
|
}
|
||||||
|
export declare class ToggleTag extends StuenMessage {
|
||||||
|
song: Song;
|
||||||
|
tag: string;
|
||||||
|
constructor(song: Song, tag: string);
|
||||||
|
}
|
||||||
|
export declare class Shuffle extends StuenMessage {
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export declare class RemoveFromAutoPlay extends StuenMessage {
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
|||||||
81
dist/messageTypes.js
vendored
81
dist/messageTypes.js
vendored
@@ -14,8 +14,8 @@ var __extends = (this && this.__extends) || (function () {
|
|||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
exports.__esModule = true;
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.RemoveSongFromPlaylist = exports.AddSongToPlaylist = exports.Playlists = exports.CreatePlaylist = exports.SongLikes = exports.ToggleSongLike = exports.SkipSong = exports.ReorderSong = exports.UnqueueSong = exports.CurrentSong = exports.CurrentQueue = exports.QueueSong = exports.SearchSongResult = exports.SearchSong = exports.ChatMessage = exports.SendChatMessage = exports.ListenerList = exports.ListenerLeft = exports.ListenerJoined = exports.Join = exports.StuenMessage = void 0;
|
exports.RemoveFromAutoPlay = exports.Shuffle = exports.ToggleTag = exports.RemoveSongFromPlaylist = exports.AddSongToPlaylist = exports.OthersPlaylists = exports.GetOtherPlaylists = exports.PlaylistSongs = exports.GetPlaylist = exports.Playlists = exports.RemovePlaylist = exports.CreatePlaylist = exports.SongLikes = exports.ToggleSongLike = exports.SkipSong = exports.ReorderSong = exports.UnqueueSong = exports.CurrentSong = exports.CurrentQueue = exports.QueueSong = exports.SearchSongResult = exports.SearchSong = exports.ChatMessage = exports.SendChatMessage = exports.ListenerList = exports.ListenerLeft = exports.ListenerJoined = exports.Join = exports.StuenMessage = void 0;
|
||||||
var StuenMessage = /** @class */ (function () {
|
var StuenMessage = /** @class */ (function () {
|
||||||
function StuenMessage(type) {
|
function StuenMessage(type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@@ -193,6 +193,16 @@ var CreatePlaylist = /** @class */ (function (_super) {
|
|||||||
return CreatePlaylist;
|
return CreatePlaylist;
|
||||||
}(StuenMessage));
|
}(StuenMessage));
|
||||||
exports.CreatePlaylist = CreatePlaylist;
|
exports.CreatePlaylist = CreatePlaylist;
|
||||||
|
var RemovePlaylist = /** @class */ (function (_super) {
|
||||||
|
__extends(RemovePlaylist, _super);
|
||||||
|
function RemovePlaylist(title) {
|
||||||
|
var _this = _super.call(this, 'RemovePlaylist') || this;
|
||||||
|
_this.title = title;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
return RemovePlaylist;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.RemovePlaylist = RemovePlaylist;
|
||||||
var Playlists = /** @class */ (function (_super) {
|
var Playlists = /** @class */ (function (_super) {
|
||||||
__extends(Playlists, _super);
|
__extends(Playlists, _super);
|
||||||
function Playlists(playlists) {
|
function Playlists(playlists) {
|
||||||
@@ -203,6 +213,44 @@ var Playlists = /** @class */ (function (_super) {
|
|||||||
return Playlists;
|
return Playlists;
|
||||||
}(StuenMessage));
|
}(StuenMessage));
|
||||||
exports.Playlists = Playlists;
|
exports.Playlists = Playlists;
|
||||||
|
var GetPlaylist = /** @class */ (function (_super) {
|
||||||
|
__extends(GetPlaylist, _super);
|
||||||
|
function GetPlaylist(playlist) {
|
||||||
|
var _this = _super.call(this, 'GetPlaylist') || this;
|
||||||
|
_this.playlist = playlist;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
return GetPlaylist;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.GetPlaylist = GetPlaylist;
|
||||||
|
var PlaylistSongs = /** @class */ (function (_super) {
|
||||||
|
__extends(PlaylistSongs, _super);
|
||||||
|
function PlaylistSongs(playlist) {
|
||||||
|
var _this = _super.call(this, 'PlaylistSongs') || this;
|
||||||
|
_this.playlist = playlist;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
return PlaylistSongs;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.PlaylistSongs = PlaylistSongs;
|
||||||
|
var GetOtherPlaylists = /** @class */ (function (_super) {
|
||||||
|
__extends(GetOtherPlaylists, _super);
|
||||||
|
function GetOtherPlaylists() {
|
||||||
|
return _super.call(this, 'GetOtherPlaylists') || this;
|
||||||
|
}
|
||||||
|
return GetOtherPlaylists;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.GetOtherPlaylists = GetOtherPlaylists;
|
||||||
|
var OthersPlaylists = /** @class */ (function (_super) {
|
||||||
|
__extends(OthersPlaylists, _super);
|
||||||
|
function OthersPlaylists(playlists) {
|
||||||
|
var _this = _super.call(this, 'OthersPlaylists') || this;
|
||||||
|
_this.playlists = playlists;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
return OthersPlaylists;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.OthersPlaylists = OthersPlaylists;
|
||||||
var AddSongToPlaylist = /** @class */ (function (_super) {
|
var AddSongToPlaylist = /** @class */ (function (_super) {
|
||||||
__extends(AddSongToPlaylist, _super);
|
__extends(AddSongToPlaylist, _super);
|
||||||
function AddSongToPlaylist(song, playlist) {
|
function AddSongToPlaylist(song, playlist) {
|
||||||
@@ -217,7 +265,7 @@ exports.AddSongToPlaylist = AddSongToPlaylist;
|
|||||||
var RemoveSongFromPlaylist = /** @class */ (function (_super) {
|
var RemoveSongFromPlaylist = /** @class */ (function (_super) {
|
||||||
__extends(RemoveSongFromPlaylist, _super);
|
__extends(RemoveSongFromPlaylist, _super);
|
||||||
function RemoveSongFromPlaylist(song, playlist) {
|
function RemoveSongFromPlaylist(song, playlist) {
|
||||||
var _this = _super.call(this, 'RemoveSongToPlaylist') || this;
|
var _this = _super.call(this, 'RemoveSongFromPlaylist') || this;
|
||||||
_this.song = song;
|
_this.song = song;
|
||||||
_this.playlist = playlist;
|
_this.playlist = playlist;
|
||||||
return _this;
|
return _this;
|
||||||
@@ -225,3 +273,30 @@ var RemoveSongFromPlaylist = /** @class */ (function (_super) {
|
|||||||
return RemoveSongFromPlaylist;
|
return RemoveSongFromPlaylist;
|
||||||
}(StuenMessage));
|
}(StuenMessage));
|
||||||
exports.RemoveSongFromPlaylist = RemoveSongFromPlaylist;
|
exports.RemoveSongFromPlaylist = RemoveSongFromPlaylist;
|
||||||
|
var ToggleTag = /** @class */ (function (_super) {
|
||||||
|
__extends(ToggleTag, _super);
|
||||||
|
function ToggleTag(song, tag) {
|
||||||
|
var _this = _super.call(this, 'ToggleTag') || this;
|
||||||
|
_this.song = song;
|
||||||
|
_this.tag = tag;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
return ToggleTag;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.ToggleTag = ToggleTag;
|
||||||
|
var Shuffle = /** @class */ (function (_super) {
|
||||||
|
__extends(Shuffle, _super);
|
||||||
|
function Shuffle() {
|
||||||
|
return _super.call(this, 'Shuffle') || this;
|
||||||
|
}
|
||||||
|
return Shuffle;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.Shuffle = Shuffle;
|
||||||
|
var RemoveFromAutoPlay = /** @class */ (function (_super) {
|
||||||
|
__extends(RemoveFromAutoPlay, _super);
|
||||||
|
function RemoveFromAutoPlay() {
|
||||||
|
return _super.call(this, 'RemoveFromAutoPlay') || this;
|
||||||
|
}
|
||||||
|
return RemoveFromAutoPlay;
|
||||||
|
}(StuenMessage));
|
||||||
|
exports.RemoveFromAutoPlay = RemoveFromAutoPlay;
|
||||||
|
|||||||
18
dist/parseMessage.js
vendored
18
dist/parseMessage.js
vendored
@@ -1,5 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
exports.__esModule = true;
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
var messageTypes_1 = require("./messageTypes");
|
var messageTypes_1 = require("./messageTypes");
|
||||||
function parseMessage(message) {
|
function parseMessage(message) {
|
||||||
try {
|
try {
|
||||||
@@ -39,12 +39,26 @@ function parseMessage(message) {
|
|||||||
return new messageTypes_1.SongLikes(data.listeners);
|
return new messageTypes_1.SongLikes(data.listeners);
|
||||||
case 'Playlists':
|
case 'Playlists':
|
||||||
return new messageTypes_1.Playlists(data.playlists);
|
return new messageTypes_1.Playlists(data.playlists);
|
||||||
|
case 'GetPlaylist':
|
||||||
|
return new messageTypes_1.GetPlaylist(data.playlist);
|
||||||
|
case 'PlaylistSongs':
|
||||||
|
return new messageTypes_1.PlaylistSongs(data.playlist);
|
||||||
case 'CreatePlaylist':
|
case 'CreatePlaylist':
|
||||||
return new messageTypes_1.CreatePlaylist(data.title);
|
return new messageTypes_1.CreatePlaylist(data.title);
|
||||||
|
case 'RemovePlaylist':
|
||||||
|
return new messageTypes_1.RemovePlaylist(data.title);
|
||||||
case 'AddSongToPlaylist':
|
case 'AddSongToPlaylist':
|
||||||
return new messageTypes_1.AddSongToPlaylist(data.song, data.playlist);
|
return new messageTypes_1.AddSongToPlaylist(data.song, data.playlist);
|
||||||
case 'RemoveSongFromPlaylist':
|
case 'RemoveSongFromPlaylist':
|
||||||
return new messageTypes_1.RemoveSongFromPlaylist(data.song, data.playlist);
|
return new messageTypes_1.RemoveSongFromPlaylist(data.song, data.playlist);
|
||||||
|
case 'GetOtherPlaylists':
|
||||||
|
return new messageTypes_1.GetOtherPlaylists();
|
||||||
|
case 'ToggleTag':
|
||||||
|
return new messageTypes_1.ToggleTag(data.song, data.tag);
|
||||||
|
case 'Shuffle':
|
||||||
|
return new messageTypes_1.Shuffle();
|
||||||
|
case 'RemoveFromAutoPlay':
|
||||||
|
return new messageTypes_1.RemoveFromAutoPlay();
|
||||||
default:
|
default:
|
||||||
console.error('Unknown message type:', data.type);
|
console.error('Unknown message type:', data.type);
|
||||||
return null;
|
return null;
|
||||||
@@ -55,4 +69,4 @@ function parseMessage(message) {
|
|||||||
return null; // Handle parsing errors
|
return null; // Handle parsing errors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports["default"] = parseMessage;
|
exports.default = parseMessage;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {Song, PlayingSong, QueuedSong, Playlist} from "./dataTypes";
|
import {Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription} from "./dataTypes";
|
||||||
|
|
||||||
export type StuenMessages =
|
export type StuenMessages =
|
||||||
ListenerLeft
|
ListenerLeft
|
||||||
@@ -15,11 +15,18 @@ export type StuenMessages =
|
|||||||
| ReorderSong
|
| ReorderSong
|
||||||
| SkipSong
|
| SkipSong
|
||||||
| SongLikes
|
| SongLikes
|
||||||
| CreatePlaylist
|
|
||||||
| ToggleSongLike
|
| ToggleSongLike
|
||||||
|
| CreatePlaylist
|
||||||
|
| RemovePlaylist
|
||||||
| AddSongToPlaylist
|
| AddSongToPlaylist
|
||||||
| RemoveSongFromPlaylist
|
| RemoveSongFromPlaylist
|
||||||
| Playlists;
|
| Playlists
|
||||||
|
| GetPlaylist
|
||||||
|
| PlaylistSongs
|
||||||
|
| GetOtherPlaylists
|
||||||
|
| ToggleTag
|
||||||
|
| Shuffle
|
||||||
|
| RemoveFromAutoPlay
|
||||||
|
|
||||||
export abstract class StuenMessage {
|
export abstract class StuenMessage {
|
||||||
constructor(public type: string) {
|
constructor(public type: string) {
|
||||||
@@ -130,13 +137,41 @@ export class CreatePlaylist extends StuenMessage {
|
|||||||
super('CreatePlaylist');
|
super('CreatePlaylist');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class RemovePlaylist extends StuenMessage {
|
||||||
|
constructor(public title: string) {
|
||||||
|
super('RemovePlaylist');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Playlists extends StuenMessage {
|
export class Playlists extends StuenMessage {
|
||||||
constructor(public playlists: Playlist[]) {
|
constructor(public playlists: PlaylistDescription[]) {
|
||||||
super('Playlists');
|
super('Playlists');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class GetPlaylist extends StuenMessage {
|
||||||
|
constructor(public playlist: PlaylistDescription) {
|
||||||
|
super('GetPlaylist');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PlaylistSongs extends StuenMessage {
|
||||||
|
constructor(public playlist: Playlist) {
|
||||||
|
super('PlaylistSongs');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GetOtherPlaylists extends StuenMessage {
|
||||||
|
constructor() {
|
||||||
|
super('GetOtherPlaylists');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class OthersPlaylists extends StuenMessage {
|
||||||
|
constructor(public playlists: PlaylistDescription[]) {
|
||||||
|
super('OthersPlaylists');
|
||||||
|
}
|
||||||
|
}
|
||||||
export class AddSongToPlaylist extends StuenMessage {
|
export class AddSongToPlaylist extends StuenMessage {
|
||||||
constructor(public song: Song, public playlist: string) {
|
constructor(public song: Song, public playlist: string) {
|
||||||
super('AddSongToPlaylist');
|
super('AddSongToPlaylist');
|
||||||
@@ -145,6 +180,24 @@ export class AddSongToPlaylist extends StuenMessage {
|
|||||||
|
|
||||||
export class RemoveSongFromPlaylist extends StuenMessage {
|
export class RemoveSongFromPlaylist extends StuenMessage {
|
||||||
constructor(public song: Song, public playlist: string) {
|
constructor(public song: Song, public playlist: string) {
|
||||||
super('RemoveSongToPlaylist');
|
super('RemoveSongFromPlaylist');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ToggleTag extends StuenMessage {
|
||||||
|
constructor(public song: Song, public tag: string) {
|
||||||
|
super('ToggleTag');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Shuffle extends StuenMessage {
|
||||||
|
constructor() {
|
||||||
|
super('Shuffle');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RemoveFromAutoPlay extends StuenMessage {
|
||||||
|
constructor() {
|
||||||
|
super('RemoveFromAutoPlay');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stuen-common",
|
"name": "stuen-common",
|
||||||
"version": "1.2.0",
|
"version": "1.2.17",
|
||||||
"main": "dist/common.js",
|
"main": "dist/common.js",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"types": "dist/common.d.ts",
|
"types": "dist/common.d.ts",
|
||||||
|
|||||||
@@ -1,12 +1,28 @@
|
|||||||
import {
|
import {
|
||||||
AddSongToPlaylist,
|
AddSongToPlaylist,
|
||||||
ChatMessage, CreatePlaylist, CurrentQueue, CurrentSong,
|
ChatMessage,
|
||||||
|
CreatePlaylist,
|
||||||
|
CurrentQueue,
|
||||||
|
CurrentSong,
|
||||||
|
GetPlaylist,
|
||||||
Join,
|
Join,
|
||||||
ListenerJoined,
|
ListenerJoined,
|
||||||
ListenerLeft,
|
ListenerLeft,
|
||||||
ListenerList, Playlists, QueueSong, RemoveSongFromPlaylist, ReorderSong, SearchSong, SearchSongResult,
|
ListenerList,
|
||||||
SendChatMessage, SkipSong, SongLikes,
|
Playlists,
|
||||||
StuenMessage, ToggleSongLike, UnqueueSong
|
PlaylistSongs,
|
||||||
|
GetOtherPlaylists,
|
||||||
|
QueueSong, RemoveFromAutoPlay, RemovePlaylist,
|
||||||
|
RemoveSongFromPlaylist,
|
||||||
|
ReorderSong,
|
||||||
|
SearchSong,
|
||||||
|
SearchSongResult,
|
||||||
|
SendChatMessage, Shuffle,
|
||||||
|
SkipSong,
|
||||||
|
SongLikes,
|
||||||
|
StuenMessage,
|
||||||
|
ToggleSongLike, ToggleTag,
|
||||||
|
UnqueueSong,
|
||||||
} from "./messageTypes";
|
} from "./messageTypes";
|
||||||
|
|
||||||
export default function parseMessage(message: string): StuenMessage | null {
|
export default function parseMessage(message: string): StuenMessage | null {
|
||||||
@@ -48,12 +64,26 @@ export default function parseMessage(message: string): StuenMessage | null {
|
|||||||
return new SongLikes(data.listeners);
|
return new SongLikes(data.listeners);
|
||||||
case 'Playlists':
|
case 'Playlists':
|
||||||
return new Playlists(data.playlists);
|
return new Playlists(data.playlists);
|
||||||
|
case 'GetPlaylist':
|
||||||
|
return new GetPlaylist(data.playlist);
|
||||||
|
case 'PlaylistSongs':
|
||||||
|
return new PlaylistSongs(data.playlist);
|
||||||
case 'CreatePlaylist':
|
case 'CreatePlaylist':
|
||||||
return new CreatePlaylist(data.title);
|
return new CreatePlaylist(data.title);
|
||||||
|
case 'RemovePlaylist':
|
||||||
|
return new RemovePlaylist(data.title);
|
||||||
case 'AddSongToPlaylist':
|
case 'AddSongToPlaylist':
|
||||||
return new AddSongToPlaylist(data.song, data.playlist);
|
return new AddSongToPlaylist(data.song, data.playlist);
|
||||||
case 'RemoveSongFromPlaylist':
|
case 'RemoveSongFromPlaylist':
|
||||||
return new RemoveSongFromPlaylist(data.song, data.playlist);
|
return new RemoveSongFromPlaylist(data.song, data.playlist);
|
||||||
|
case 'GetOtherPlaylists':
|
||||||
|
return new GetOtherPlaylists();
|
||||||
|
case 'ToggleTag':
|
||||||
|
return new ToggleTag(data.song, data.tag);
|
||||||
|
case 'Shuffle':
|
||||||
|
return new Shuffle();
|
||||||
|
case 'RemoveFromAutoPlay':
|
||||||
|
return new RemoveFromAutoPlay();
|
||||||
default:
|
default:
|
||||||
console.error('Unknown message type:', data.type);
|
console.error('Unknown message type:', data.type);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user