Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5211a4a976 | ||
|
|
58f972156e | ||
|
|
1f69d0e867 | ||
|
|
de19886518 | ||
|
|
4ef0946605 | ||
|
|
365132977a | ||
|
|
3c80493446 | ||
|
|
927aa80398 | ||
|
|
1b31aaf549 |
@ -23,10 +23,11 @@ export class PlayingSong extends QueuedSong {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Playlist {
|
export class Playlist {
|
||||||
constructor(public title: string, public listener: string, public songs: Song[]) {
|
constructor(public title: string, public listener: string, public type: SongType, public songs: Song[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PlaylistDescription {
|
export class PlaylistDescription {
|
||||||
constructor(public title: string, public listener: string) {
|
constructor(public title: string, public listener: string, public type: SongType) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
dist/dataTypes.d.ts
vendored
6
dist/dataTypes.d.ts
vendored
@ -25,11 +25,13 @@ export declare class PlayingSong extends QueuedSong {
|
|||||||
export declare class Playlist {
|
export declare class Playlist {
|
||||||
title: string;
|
title: string;
|
||||||
listener: string;
|
listener: string;
|
||||||
|
type: SongType;
|
||||||
songs: Song[];
|
songs: Song[];
|
||||||
constructor(title: string, listener: string, songs: Song[]);
|
constructor(title: string, listener: string, type: SongType, songs: Song[]);
|
||||||
}
|
}
|
||||||
export declare class PlaylistDescription {
|
export declare class PlaylistDescription {
|
||||||
title: string;
|
title: string;
|
||||||
listener: string;
|
listener: string;
|
||||||
constructor(title: string, listener: string);
|
type: SongType;
|
||||||
|
constructor(title: string, listener: string, type: SongType);
|
||||||
}
|
}
|
||||||
|
|||||||
6
dist/dataTypes.js
vendored
6
dist/dataTypes.js
vendored
@ -57,18 +57,20 @@ var PlayingSong = /** @class */ (function (_super) {
|
|||||||
}(QueuedSong));
|
}(QueuedSong));
|
||||||
exports.PlayingSong = PlayingSong;
|
exports.PlayingSong = PlayingSong;
|
||||||
var Playlist = /** @class */ (function () {
|
var Playlist = /** @class */ (function () {
|
||||||
function Playlist(title, listener, songs) {
|
function Playlist(title, listener, type, songs) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
|
this.type = type;
|
||||||
this.songs = songs;
|
this.songs = songs;
|
||||||
}
|
}
|
||||||
return Playlist;
|
return Playlist;
|
||||||
}());
|
}());
|
||||||
exports.Playlist = Playlist;
|
exports.Playlist = Playlist;
|
||||||
var PlaylistDescription = /** @class */ (function () {
|
var PlaylistDescription = /** @class */ (function () {
|
||||||
function PlaylistDescription(title, listener) {
|
function PlaylistDescription(title, listener, type) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
return PlaylistDescription;
|
return PlaylistDescription;
|
||||||
}());
|
}());
|
||||||
|
|||||||
16
dist/messageTypes.d.ts
vendored
16
dist/messageTypes.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import { Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription } from "./dataTypes";
|
import { Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription } from "./dataTypes";
|
||||||
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 | GetAllPlaylists | ToggleTag | Shuffle | RemoveFromAutoPlay;
|
export type StuenMessages = ListenerList | 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);
|
||||||
@ -8,14 +8,6 @@ export declare class Join extends StuenMessage {
|
|||||||
name: string;
|
name: string;
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
}
|
}
|
||||||
export declare class ListenerJoined extends StuenMessage {
|
|
||||||
name: string;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
export declare class ListenerLeft extends StuenMessage {
|
|
||||||
name: string;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
export declare class ListenerList extends StuenMessage {
|
export declare class ListenerList extends StuenMessage {
|
||||||
names: string[];
|
names: string[];
|
||||||
constructor(names: string[]);
|
constructor(names: string[]);
|
||||||
@ -89,9 +81,13 @@ export declare class PlaylistSongs extends StuenMessage {
|
|||||||
playlist: Playlist;
|
playlist: Playlist;
|
||||||
constructor(playlist: Playlist);
|
constructor(playlist: Playlist);
|
||||||
}
|
}
|
||||||
export declare class GetAllPlaylists extends StuenMessage {
|
export declare class GetOtherPlaylists extends StuenMessage {
|
||||||
constructor();
|
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;
|
||||||
playlist: string;
|
playlist: string;
|
||||||
|
|||||||
44
dist/messageTypes.js
vendored
44
dist/messageTypes.js
vendored
@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.RemoveFromAutoPlay = exports.Shuffle = exports.ToggleTag = exports.RemoveSongFromPlaylist = exports.AddSongToPlaylist = exports.GetAllPlaylists = 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;
|
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.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;
|
||||||
@ -33,26 +33,6 @@ var Join = /** @class */ (function (_super) {
|
|||||||
return Join;
|
return Join;
|
||||||
}(StuenMessage));
|
}(StuenMessage));
|
||||||
exports.Join = Join;
|
exports.Join = Join;
|
||||||
var ListenerJoined = /** @class */ (function (_super) {
|
|
||||||
__extends(ListenerJoined, _super);
|
|
||||||
function ListenerJoined(name) {
|
|
||||||
var _this = _super.call(this, 'ListenerJoined') || this;
|
|
||||||
_this.name = name;
|
|
||||||
return _this;
|
|
||||||
}
|
|
||||||
return ListenerJoined;
|
|
||||||
}(StuenMessage));
|
|
||||||
exports.ListenerJoined = ListenerJoined;
|
|
||||||
var ListenerLeft = /** @class */ (function (_super) {
|
|
||||||
__extends(ListenerLeft, _super);
|
|
||||||
function ListenerLeft(name) {
|
|
||||||
var _this = _super.call(this, 'ListenerLeft') || this;
|
|
||||||
_this.name = name;
|
|
||||||
return _this;
|
|
||||||
}
|
|
||||||
return ListenerLeft;
|
|
||||||
}(StuenMessage));
|
|
||||||
exports.ListenerLeft = ListenerLeft;
|
|
||||||
var ListenerList = /** @class */ (function (_super) {
|
var ListenerList = /** @class */ (function (_super) {
|
||||||
__extends(ListenerList, _super);
|
__extends(ListenerList, _super);
|
||||||
function ListenerList(names) {
|
function ListenerList(names) {
|
||||||
@ -233,14 +213,24 @@ var PlaylistSongs = /** @class */ (function (_super) {
|
|||||||
return PlaylistSongs;
|
return PlaylistSongs;
|
||||||
}(StuenMessage));
|
}(StuenMessage));
|
||||||
exports.PlaylistSongs = PlaylistSongs;
|
exports.PlaylistSongs = PlaylistSongs;
|
||||||
var GetAllPlaylists = /** @class */ (function (_super) {
|
var GetOtherPlaylists = /** @class */ (function (_super) {
|
||||||
__extends(GetAllPlaylists, _super);
|
__extends(GetOtherPlaylists, _super);
|
||||||
function GetAllPlaylists() {
|
function GetOtherPlaylists() {
|
||||||
return _super.call(this, 'GetAllPlaylists') || this;
|
return _super.call(this, 'GetOtherPlaylists') || this;
|
||||||
}
|
}
|
||||||
return GetAllPlaylists;
|
return GetOtherPlaylists;
|
||||||
}(StuenMessage));
|
}(StuenMessage));
|
||||||
exports.GetAllPlaylists = GetAllPlaylists;
|
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) {
|
||||||
|
|||||||
10
dist/parseMessage.js
vendored
10
dist/parseMessage.js
vendored
@ -7,10 +7,6 @@ function parseMessage(message) {
|
|||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case 'Join':
|
case 'Join':
|
||||||
return new messageTypes_1.Join(data.name);
|
return new messageTypes_1.Join(data.name);
|
||||||
case 'ListenerJoined':
|
|
||||||
return new messageTypes_1.ListenerJoined(data.name);
|
|
||||||
case 'ListenerLeft':
|
|
||||||
return new messageTypes_1.ListenerLeft(data.name);
|
|
||||||
case 'ListenerList':
|
case 'ListenerList':
|
||||||
return new messageTypes_1.ListenerList(data.names);
|
return new messageTypes_1.ListenerList(data.names);
|
||||||
case 'SendChatMessage':
|
case 'SendChatMessage':
|
||||||
@ -51,8 +47,10 @@ function parseMessage(message) {
|
|||||||
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 'GetAllPlaylists':
|
case 'GetOtherPlaylists':
|
||||||
return new messageTypes_1.GetAllPlaylists();
|
return new messageTypes_1.GetOtherPlaylists();
|
||||||
|
case 'OthersPlaylists':
|
||||||
|
return new messageTypes_1.OthersPlaylists(data.playlists);
|
||||||
case 'ToggleTag':
|
case 'ToggleTag':
|
||||||
return new messageTypes_1.ToggleTag(data.song, data.tag);
|
return new messageTypes_1.ToggleTag(data.song, data.tag);
|
||||||
case 'Shuffle':
|
case 'Shuffle':
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import {Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription} from "./dataTypes";
|
import {Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription} from "./dataTypes";
|
||||||
|
|
||||||
export type StuenMessages =
|
export type StuenMessages =
|
||||||
ListenerLeft
|
ListenerList
|
||||||
| ListenerList
|
|
||||||
| ListenerJoined
|
|
||||||
| SendChatMessage
|
| SendChatMessage
|
||||||
| SearchSong
|
| SearchSong
|
||||||
| SearchSongResult
|
| SearchSongResult
|
||||||
@ -23,7 +21,7 @@ export type StuenMessages =
|
|||||||
| Playlists
|
| Playlists
|
||||||
| GetPlaylist
|
| GetPlaylist
|
||||||
| PlaylistSongs
|
| PlaylistSongs
|
||||||
| GetAllPlaylists
|
| GetOtherPlaylists
|
||||||
| ToggleTag
|
| ToggleTag
|
||||||
| Shuffle
|
| Shuffle
|
||||||
| RemoveFromAutoPlay
|
| RemoveFromAutoPlay
|
||||||
@ -39,18 +37,6 @@ export class Join extends StuenMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListenerJoined extends StuenMessage {
|
|
||||||
constructor(public name: string) {
|
|
||||||
super('ListenerJoined');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ListenerLeft extends StuenMessage {
|
|
||||||
constructor(public name: string) {
|
|
||||||
super('ListenerLeft');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ListenerList extends StuenMessage {
|
export class ListenerList extends StuenMessage {
|
||||||
constructor(public names: string[]) {
|
constructor(public names: string[]) {
|
||||||
super('ListenerList');
|
super('ListenerList');
|
||||||
@ -161,12 +147,17 @@ export class PlaylistSongs extends StuenMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetAllPlaylists extends StuenMessage {
|
export class GetOtherPlaylists extends StuenMessage {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('GetAllPlaylists');
|
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');
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stuen-common",
|
"name": "stuen-common",
|
||||||
"version": "1.2.14",
|
"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",
|
||||||
|
|||||||
@ -6,12 +6,10 @@ import {
|
|||||||
CurrentSong,
|
CurrentSong,
|
||||||
GetPlaylist,
|
GetPlaylist,
|
||||||
Join,
|
Join,
|
||||||
ListenerJoined,
|
|
||||||
ListenerLeft,
|
|
||||||
ListenerList,
|
ListenerList,
|
||||||
Playlists,
|
Playlists,
|
||||||
PlaylistSongs,
|
PlaylistSongs,
|
||||||
GetAllPlaylists,
|
GetOtherPlaylists,
|
||||||
QueueSong, RemoveFromAutoPlay, RemovePlaylist,
|
QueueSong, RemoveFromAutoPlay, RemovePlaylist,
|
||||||
RemoveSongFromPlaylist,
|
RemoveSongFromPlaylist,
|
||||||
ReorderSong,
|
ReorderSong,
|
||||||
@ -22,7 +20,7 @@ import {
|
|||||||
SongLikes,
|
SongLikes,
|
||||||
StuenMessage,
|
StuenMessage,
|
||||||
ToggleSongLike, ToggleTag,
|
ToggleSongLike, ToggleTag,
|
||||||
UnqueueSong
|
UnqueueSong, OthersPlaylists,
|
||||||
} from "./messageTypes";
|
} from "./messageTypes";
|
||||||
|
|
||||||
export default function parseMessage(message: string): StuenMessage | null {
|
export default function parseMessage(message: string): StuenMessage | null {
|
||||||
@ -32,10 +30,6 @@ export default function parseMessage(message: string): StuenMessage | null {
|
|||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case 'Join':
|
case 'Join':
|
||||||
return new Join(data.name);
|
return new Join(data.name);
|
||||||
case 'ListenerJoined':
|
|
||||||
return new ListenerJoined(data.name);
|
|
||||||
case 'ListenerLeft':
|
|
||||||
return new ListenerLeft(data.name);
|
|
||||||
case 'ListenerList':
|
case 'ListenerList':
|
||||||
return new ListenerList(data.names);
|
return new ListenerList(data.names);
|
||||||
case 'SendChatMessage':
|
case 'SendChatMessage':
|
||||||
@ -76,8 +70,10 @@ export default function parseMessage(message: string): StuenMessage | null {
|
|||||||
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 'GetAllPlaylists':
|
case 'GetOtherPlaylists':
|
||||||
return new GetAllPlaylists();
|
return new GetOtherPlaylists();
|
||||||
|
case 'OthersPlaylists':
|
||||||
|
return new OthersPlaylists(data.playlists);
|
||||||
case 'ToggleTag':
|
case 'ToggleTag':
|
||||||
return new ToggleTag(data.song, data.tag);
|
return new ToggleTag(data.song, data.tag);
|
||||||
case 'Shuffle':
|
case 'Shuffle':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user