27 Commits

Author SHA1 Message Date
Torben Pi Jensen 8b2ab7958f Upgrade with history search 2026-05-09 13:12:37 +02:00
Torben Pi Jensen 9b4103a8b2 Moved tags to song instead of on playing song 2026-05-09 11:23:46 +02:00
Thomas Viesmose Birch 5211a4a976 Adding songtype to playlists 2024-05-04 17:31:58 +02:00
Thomas Viesmose Birch 58f972156e Typescript is hard! 2024-05-04 16:20:19 +02:00
Thomas Viesmose Birch 1f69d0e867 Added OthersPlaylists to the parseMessages 2024-05-04 16:19:16 +02:00
Thomas Viesmose Birch de19886518 Added OthersPlaylists to the parseMessages 2024-05-04 16:16:45 +02:00
Thomas Viesmose Birch 4ef0946605 Removed the ListenerJoined and ListenerLeft events 2024-05-04 16:09:35 +02:00
Thomas Viesmose Birch 365132977a Fixed unused include before bump 2024-05-04 15:36:49 +02:00
Thomas Viesmose Birch 3c80493446 bump to 17! 2024-05-04 15:35:11 +02:00
Thomas Viesmose Birch 927aa80398 bump to 16 2024-05-04 15:29:06 +02:00
Thomas Viesmose Birch 1b31aaf549 Renaming to GetOtherPlaylists 2024-05-04 15:27:43 +02:00
Thomas Viesmose Birch 7e1136acad Me and typescript is not friends. 2024-05-04 14:50:27 +02:00
Thomas Viesmose Birch 1487f6e1f5 Changed "Added new messages for returning users with playlists" to a call that just returns all playslists. 2024-05-04 14:43:05 +02:00
Thomas Viesmose Birch 8760a3affc Added new messages for returning users with playlists. 2024-05-04 13:17:06 +02:00
Thomas Viesmose Birch 00dedc1d85 Added inAutoPlay property to songs 2024-05-04 12:31:30 +02:00
Thomas Viesmose Birch 283d7ea4ec Added inAutoPlay property to songs 2024-05-04 12:16:22 +02:00
Thomas Viesmose Birch e2475c254e Added inAutoPlay property to songs 2024-05-04 12:13:59 +02:00
Thomas Viesmose Birch d08afcc4d6 Added RemoveSongFromAutoPlay 2024-05-04 10:28:11 +02:00
Torben Pi Jensen d47379aacc Added remove playlist 2024-02-04 08:51:53 +01:00
Torben Pi Jensen 01b8319aef Added shuffle 2024-02-03 19:18:22 +01:00
Torben Pi Jensen 993501f049 Added tags 2024-02-03 17:06:07 +01:00
Torben Pi Jensen 343126bee3 Fix? 2024-02-03 15:40:38 +01:00
Torben Pi Jensen 588c778122 Fix? 2024-02-03 15:37:46 +01:00
Torben Pi Jensen 2ec9585c74 Fix? 2024-02-03 15:37:38 +01:00
Torben Pi Jensen d5b4cfefc3 Added playlist 2024-02-03 14:47:27 +01:00
Torben Pi Jensen 807cd568e1 Added playlist 2024-02-03 14:45:02 +01:00
Torben Pi Jensen 04253f753a Added playlist 2024-02-03 14:42:42 +01:00
14 changed files with 418 additions and 300 deletions
+13 -13
View File
@@ -5,34 +5,34 @@ export enum SongType {
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 tags: string[], public inAutoPlay: boolean) {
}
}
export class QueuedSong extends Song {
constructor(type: SongType, title: string, songId: string, image: string, public listener: string) {
super(type, title, songId, image);
constructor(type: SongType, title: string, songId: string, image: string, tags: string[], public listener: string, public inAutoPlay: boolean) {
super(type, title, songId, image, tags, inAutoPlay);
}
}
export class PlayingSong extends QueuedSong {
constructor(type: SongType, title: string, songId: string, image: string, listener: string, public length: number, public position: number) {
super(type, title, songId, image, listener);
constructor(type: SongType, title: string, songId: string, image: string, tags: string[], listener: string, public inAutoPlay: boolean) {
super(type, title, songId, image, tags, listener, inAutoPlay);
}
}
export class PlayerControl {
constructor(public type: SongType, public songId: string, public position: number, public length: number) {
}
}
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 {
public title: string;
public listener: string;
constructor(title: string, listener: string) {
this.title = title;
this.listener = listener;
constructor(public title: string, public listener: string, public type: SongType) {
}
}
+2 -1
View File
@@ -13,7 +13,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
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);
};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./dataTypes"), exports);
__exportStar(require("./messageTypes"), exports);
__exportStar(require("./parseMessage"), exports);
//# sourceMappingURL=common.js.map
+21 -5
View File
@@ -7,20 +7,36 @@ export declare class Song {
title: string;
songId: string;
image: string;
constructor(type: SongType, title: string, songId: string, image: string);
tags: string[];
inAutoPlay: boolean;
constructor(type: SongType, title: string, songId: string, image: string, tags: string[], inAutoPlay: boolean);
}
export declare class QueuedSong extends Song {
listener: string;
constructor(type: SongType, title: string, songId: string, image: string, listener: string);
inAutoPlay: boolean;
constructor(type: SongType, title: string, songId: string, image: string, tags: string[], listener: string, inAutoPlay: boolean);
}
export declare class PlayingSong extends QueuedSong {
length: number;
inAutoPlay: boolean;
constructor(type: SongType, title: string, songId: string, image: string, tags: string[], listener: string, inAutoPlay: boolean);
}
export declare class PlayerControl {
type: SongType;
songId: string;
position: number;
constructor(type: SongType, title: string, songId: string, image: string, listener: string, length: number, position: number);
length: number;
constructor(type: SongType, songId: string, position: number, length: number);
}
export declare class Playlist {
title: string;
listener: string;
type: SongType;
songs: Song[];
constructor(title: string, listener: string, songs: Song[]);
constructor(title: string, listener: string, type: SongType, songs: Song[]);
}
export declare class PlaylistDescription {
title: string;
listener: string;
type: SongType;
constructor(title: string, listener: string, type: SongType);
}
+41 -43
View File
@@ -1,63 +1,61 @@
"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.Playlist = exports.PlayingSong = exports.QueuedSong = exports.Song = exports.SongType = void 0;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlaylistDescription = exports.Playlist = exports.PlayerControl = exports.PlayingSong = exports.QueuedSong = exports.Song = exports.SongType = void 0;
var SongType;
(function (SongType) {
SongType[SongType["YouTube"] = 0] = "YouTube";
SongType[SongType["Spotify"] = 1] = "Spotify";
})(SongType = exports.SongType || (exports.SongType = {}));
var Song = /** @class */ (function () {
function Song(type, title, songId, image) {
})(SongType || (exports.SongType = SongType = {}));
class Song {
constructor(type, title, songId, image, tags, inAutoPlay) {
this.type = type;
this.title = title;
this.songId = songId;
this.image = image;
this.tags = tags;
this.inAutoPlay = inAutoPlay;
}
}
return Song;
}());
exports.Song = Song;
var QueuedSong = /** @class */ (function (_super) {
__extends(QueuedSong, _super);
function QueuedSong(type, title, songId, image, listener) {
var _this = _super.call(this, type, title, songId, image) || this;
_this.listener = listener;
return _this;
class QueuedSong extends Song {
constructor(type, title, songId, image, tags, listener, inAutoPlay) {
super(type, title, songId, image, tags, inAutoPlay);
this.listener = listener;
this.inAutoPlay = inAutoPlay;
}
}
return QueuedSong;
}(Song));
exports.QueuedSong = QueuedSong;
var PlayingSong = /** @class */ (function (_super) {
__extends(PlayingSong, _super);
function PlayingSong(type, title, songId, image, listener, length, position) {
var _this = _super.call(this, type, title, songId, image, listener) || this;
_this.length = length;
_this.position = position;
return _this;
class PlayingSong extends QueuedSong {
constructor(type, title, songId, image, tags, listener, inAutoPlay) {
super(type, title, songId, image, tags, listener, inAutoPlay);
this.inAutoPlay = inAutoPlay;
}
}
return PlayingSong;
}(QueuedSong));
exports.PlayingSong = PlayingSong;
var Playlist = /** @class */ (function () {
function Playlist(title, listener, songs) {
class PlayerControl {
constructor(type, songId, position, length) {
this.type = type;
this.songId = songId;
this.position = position;
this.length = length;
}
}
exports.PlayerControl = PlayerControl;
class Playlist {
constructor(title, listener, type, songs) {
this.title = title;
this.listener = listener;
this.type = type;
this.songs = songs;
}
return Playlist;
}());
}
exports.Playlist = Playlist;
class PlaylistDescription {
constructor(title, listener, type) {
this.title = title;
this.listener = listener;
this.type = type;
}
}
exports.PlaylistDescription = PlaylistDescription;
//# sourceMappingURL=dataTypes.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"dataTypes.js","sourceRoot":"","sources":["../dataTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAY,QAGX;AAHD,WAAY,QAAQ;IAChB,6CAAO,CAAA;IACP,6CAAO,CAAA;AACX,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAGD;IACI,cAAmB,IAAc,EAAS,KAAa,EAAS,MAAc,EAAS,KAAa;QAAjF,SAAI,GAAJ,IAAI,CAAU;QAAS,UAAK,GAAL,KAAK,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;IAEpG,CAAC;IACL,WAAC;AAAD,CAAC,AAJD,IAIC;AAJY,oBAAI;AAMjB;IAAgC,8BAAI;IAChC,oBAAY,IAAc,EAAE,KAAa,EAAE,MAAc,EAAE,KAAa,EAAS,QAAgB;QAAjG,YACI,kBAAM,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,SACpC;QAFgF,cAAQ,GAAR,QAAQ,CAAQ;;IAEjG,CAAC;IACL,iBAAC;AAAD,CAAC,AAJD,CAAgC,IAAI,GAInC;AAJY,gCAAU;AAMvB;IAAiC,+BAAU;IACvC,qBAAY,IAAc,EAAE,KAAa,EAAE,MAAc,EAAE,KAAa,EAAE,QAAgB,EAAS,MAAc,EAAS,QAAgB;QAA1I,YACI,kBAAM,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,SAC9C;QAFkG,YAAM,GAAN,MAAM,CAAQ;QAAS,cAAQ,GAAR,QAAQ,CAAQ;;IAE1I,C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,EAAS,QAAgB,EAAS,MAAc;QAArF,SAAI,GAAJ,IAAI,CAAU;QAAS,WAAM,GAAN,MAAM,CAAQ;QAAS,aAAQ,GAAR,QAAQ,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAQ;IACxG,CAAC;CACJ;AAHD,sCAGC;AAED,MAAa,QAAQ;IACjB,YAAmB,KAAa,EAAS,QAAgB,EAAS,IAAc,EAAS,KAAa;QAAnF,UAAK,GAAL,KAAK,CAAQ;QAAS,aAAQ,GAAR,QAAQ,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAU;QAAS,UAAK,GAAL,KAAK,CAAQ;IACtG,CAAC;CACJ;AAHD,4BAGC;AAED,MAAa,mBAAmB;IAC5B,YAAmB,KAAa,EAAS,QAAgB,EAAS,IAAc;QAA7D,UAAK,GAAL,KAAK,CAAQ;QAAS,aAAQ,GAAR,QAAQ,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAU;IAChF,CAAC;CACJ;AAHD,kDAGC"}
+46 -12
View File
@@ -1,5 +1,5 @@
import { Song, PlayingSong, QueuedSong, Playlist } 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;
import { Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription, PlayerControl } from "./dataTypes";
export type StuenMessages = ListenerList | SendChatMessage | SearchSong | SearchSongResult | SearchHistory | HistoryContent | Join | QueueSong | CurrentQueue | CurrentSong | CurrentPlayerControl | UnqueueSong | ReorderSong | SkipSong | SongLikes | ToggleSongLike | CreatePlaylist | RemovePlaylist | AddSongToPlaylist | RemoveSongFromPlaylist | Playlists | GetPlaylist | PlaylistSongs | GetOtherPlaylists | ToggleTag | Shuffle | RemoveFromAutoPlay;
export declare abstract class StuenMessage {
type: string;
constructor(type: string);
@@ -8,14 +8,6 @@ export declare class Join extends StuenMessage {
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 {
names: string[];
constructor(names: string[]);
@@ -37,6 +29,14 @@ export declare class SearchSongResult extends StuenMessage {
result: Song[];
constructor(result: Song[]);
}
export declare class SearchHistory extends StuenMessage {
query: string;
constructor(query: string);
}
export declare class HistoryContent extends StuenMessage {
result: Song[];
constructor(result: Song[]);
}
export declare class QueueSong extends StuenMessage {
song: Song;
constructor(song: Song);
@@ -49,6 +49,10 @@ export declare class CurrentSong extends StuenMessage {
song: PlayingSong | null;
constructor(song: PlayingSong | null);
}
export declare class CurrentPlayerControl extends StuenMessage {
playerControl: PlayerControl | null;
constructor(playerControl: PlayerControl | null);
}
export declare class UnqueueSong extends StuenMessage {
position: number | null;
all: boolean | undefined;
@@ -73,9 +77,28 @@ export declare class CreatePlaylist extends StuenMessage {
title: string;
constructor(title: string);
}
export declare class RemovePlaylist extends StuenMessage {
title: string;
constructor(title: string);
}
export declare class Playlists extends StuenMessage {
playlists: Playlist[];
constructor(playlists: Playlist[]);
playlists: PlaylistDescription[];
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 {
song: Song;
@@ -87,3 +110,14 @@ export declare class RemoveSongFromPlaylist extends StuenMessage {
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();
}
+173 -186
View File
@@ -1,227 +1,214 @@
"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.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;
var StuenMessage = /** @class */ (function () {
function StuenMessage(type) {
Object.defineProperty(exports, "__esModule", { value: true });
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.CurrentPlayerControl = exports.CurrentSong = exports.CurrentQueue = exports.QueueSong = exports.HistoryContent = exports.SearchHistory = exports.SearchSongResult = exports.SearchSong = exports.ChatMessage = exports.SendChatMessage = exports.ListenerList = exports.Join = exports.StuenMessage = void 0;
class StuenMessage {
constructor(type) {
this.type = type;
}
return StuenMessage;
}());
}
exports.StuenMessage = StuenMessage;
var Join = /** @class */ (function (_super) {
__extends(Join, _super);
function Join(name) {
var _this = _super.call(this, 'Join') || this;
_this.name = name;
return _this;
class Join extends StuenMessage {
constructor(name) {
super('Join');
this.name = name;
}
}
return Join;
}(StuenMessage));
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;
class ListenerList extends StuenMessage {
constructor(names) {
super('ListenerList');
this.names = names;
}
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) {
__extends(ListenerList, _super);
function ListenerList(names) {
var _this = _super.call(this, 'ListenerList') || this;
_this.names = names;
return _this;
}
return ListenerList;
}(StuenMessage));
exports.ListenerList = ListenerList;
var SendChatMessage = /** @class */ (function (_super) {
__extends(SendChatMessage, _super);
function SendChatMessage(message) {
var _this = _super.call(this, 'SendChatMessage') || this;
_this.message = message;
return _this;
class SendChatMessage extends StuenMessage {
constructor(message) {
super('SendChatMessage');
this.message = message;
}
}
return SendChatMessage;
}(StuenMessage));
exports.SendChatMessage = SendChatMessage;
var ChatMessage = /** @class */ (function (_super) {
__extends(ChatMessage, _super);
function ChatMessage(name, message) {
var _this = _super.call(this, 'ChatMessage') || this;
_this.name = name;
_this.message = message;
return _this;
class ChatMessage extends StuenMessage {
constructor(name, message) {
super('ChatMessage');
this.name = name;
this.message = message;
}
}
return ChatMessage;
}(StuenMessage));
exports.ChatMessage = ChatMessage;
var SearchSong = /** @class */ (function (_super) {
__extends(SearchSong, _super);
function SearchSong(query) {
var _this = _super.call(this, 'SearchSong') || this;
_this.query = query;
return _this;
class SearchSong extends StuenMessage {
constructor(query) {
super('SearchSong');
this.query = query;
}
}
return SearchSong;
}(StuenMessage));
exports.SearchSong = SearchSong;
var SearchSongResult = /** @class */ (function (_super) {
__extends(SearchSongResult, _super);
function SearchSongResult(result) {
var _this = _super.call(this, 'SearchSongResult') || this;
_this.result = result;
return _this;
class SearchSongResult extends StuenMessage {
constructor(result) {
super('SearchSongResult');
this.result = result;
}
}
return SearchSongResult;
}(StuenMessage));
exports.SearchSongResult = SearchSongResult;
var QueueSong = /** @class */ (function (_super) {
__extends(QueueSong, _super);
function QueueSong(song) {
var _this = _super.call(this, 'QueueSong') || this;
_this.song = song;
return _this;
class SearchHistory extends StuenMessage {
constructor(query) {
super('SearchHistory');
this.query = query;
}
}
exports.SearchHistory = SearchHistory;
class HistoryContent extends StuenMessage {
constructor(result) {
super('HistoryContent');
this.result = result;
}
}
exports.HistoryContent = HistoryContent;
class QueueSong extends StuenMessage {
constructor(song) {
super('QueueSong');
this.song = song;
}
}
return QueueSong;
}(StuenMessage));
exports.QueueSong = QueueSong;
var CurrentQueue = /** @class */ (function (_super) {
__extends(CurrentQueue, _super);
function CurrentQueue(songs) {
var _this = _super.call(this, 'CurrentQueue') || this;
_this.songs = songs;
return _this;
class CurrentQueue extends StuenMessage {
constructor(songs) {
super('CurrentQueue');
this.songs = songs;
}
}
return CurrentQueue;
}(StuenMessage));
exports.CurrentQueue = CurrentQueue;
var CurrentSong = /** @class */ (function (_super) {
__extends(CurrentSong, _super);
function CurrentSong(song) {
var _this = _super.call(this, 'CurrentSong') || this;
_this.song = song;
return _this;
class CurrentSong extends StuenMessage {
constructor(song) {
super('CurrentSong');
this.song = song;
}
}
return CurrentSong;
}(StuenMessage));
exports.CurrentSong = CurrentSong;
var UnqueueSong = /** @class */ (function (_super) {
__extends(UnqueueSong, _super);
function UnqueueSong(position, all) {
if (all === void 0) { all = false; }
var _this = _super.call(this, 'UnqueueSong') || this;
_this.position = position;
_this.all = all;
return _this;
class CurrentPlayerControl extends StuenMessage {
constructor(playerControl) {
super('CurrentPlayerControl');
this.playerControl = playerControl;
}
}
exports.CurrentPlayerControl = CurrentPlayerControl;
class UnqueueSong extends StuenMessage {
constructor(position, all = false) {
super('UnqueueSong');
this.position = position;
this.all = all;
}
}
return UnqueueSong;
}(StuenMessage));
exports.UnqueueSong = UnqueueSong;
var ReorderSong = /** @class */ (function (_super) {
__extends(ReorderSong, _super);
function ReorderSong(positionToMove, placePosition) {
var _this = _super.call(this, 'ReorderSong') || this;
_this.positionToMove = positionToMove;
_this.placePosition = placePosition;
return _this;
class ReorderSong extends StuenMessage {
constructor(positionToMove, placePosition) {
super('ReorderSong');
this.positionToMove = positionToMove;
this.placePosition = placePosition;
}
}
return ReorderSong;
}(StuenMessage));
exports.ReorderSong = ReorderSong;
var SkipSong = /** @class */ (function (_super) {
__extends(SkipSong, _super);
function SkipSong() {
return _super.call(this, 'SkipSong') || this;
class SkipSong extends StuenMessage {
constructor() {
super('SkipSong');
}
}
return SkipSong;
}(StuenMessage));
exports.SkipSong = SkipSong;
var ToggleSongLike = /** @class */ (function (_super) {
__extends(ToggleSongLike, _super);
function ToggleSongLike() {
return _super.call(this, 'ToggleSongLike') || this;
class ToggleSongLike extends StuenMessage {
constructor() {
super('ToggleSongLike');
}
}
return ToggleSongLike;
}(StuenMessage));
exports.ToggleSongLike = ToggleSongLike;
var SongLikes = /** @class */ (function (_super) {
__extends(SongLikes, _super);
function SongLikes(listeners) {
var _this = _super.call(this, 'SongLikes') || this;
_this.listeners = listeners;
return _this;
class SongLikes extends StuenMessage {
constructor(listeners) {
super('SongLikes');
this.listeners = listeners;
}
}
return SongLikes;
}(StuenMessage));
exports.SongLikes = SongLikes;
var CreatePlaylist = /** @class */ (function (_super) {
__extends(CreatePlaylist, _super);
function CreatePlaylist(title) {
var _this = _super.call(this, 'CreatePlaylist') || this;
_this.title = title;
return _this;
class CreatePlaylist extends StuenMessage {
constructor(title) {
super('CreatePlaylist');
this.title = title;
}
}
return CreatePlaylist;
}(StuenMessage));
exports.CreatePlaylist = CreatePlaylist;
var Playlists = /** @class */ (function (_super) {
__extends(Playlists, _super);
function Playlists(playlists) {
var _this = _super.call(this, 'Playlists') || this;
_this.playlists = playlists;
return _this;
class RemovePlaylist extends StuenMessage {
constructor(title) {
super('RemovePlaylist');
this.title = title;
}
}
exports.RemovePlaylist = RemovePlaylist;
class Playlists extends StuenMessage {
constructor(playlists) {
super('Playlists');
this.playlists = playlists;
}
}
return Playlists;
}(StuenMessage));
exports.Playlists = Playlists;
var AddSongToPlaylist = /** @class */ (function (_super) {
__extends(AddSongToPlaylist, _super);
function AddSongToPlaylist(song, playlist) {
var _this = _super.call(this, 'AddSongToPlaylist') || this;
_this.song = song;
_this.playlist = playlist;
return _this;
class GetPlaylist extends StuenMessage {
constructor(playlist) {
super('GetPlaylist');
this.playlist = playlist;
}
}
exports.GetPlaylist = GetPlaylist;
class PlaylistSongs extends StuenMessage {
constructor(playlist) {
super('PlaylistSongs');
this.playlist = playlist;
}
}
exports.PlaylistSongs = PlaylistSongs;
class GetOtherPlaylists extends StuenMessage {
constructor() {
super('GetOtherPlaylists');
}
}
exports.GetOtherPlaylists = GetOtherPlaylists;
class OthersPlaylists extends StuenMessage {
constructor(playlists) {
super('OthersPlaylists');
this.playlists = playlists;
}
}
exports.OthersPlaylists = OthersPlaylists;
class AddSongToPlaylist extends StuenMessage {
constructor(song, playlist) {
super('AddSongToPlaylist');
this.song = song;
this.playlist = playlist;
}
}
return AddSongToPlaylist;
}(StuenMessage));
exports.AddSongToPlaylist = AddSongToPlaylist;
var RemoveSongFromPlaylist = /** @class */ (function (_super) {
__extends(RemoveSongFromPlaylist, _super);
function RemoveSongFromPlaylist(song, playlist) {
var _this = _super.call(this, 'RemoveSongToPlaylist') || this;
_this.song = song;
_this.playlist = playlist;
return _this;
class RemoveSongFromPlaylist extends StuenMessage {
constructor(song, playlist) {
super('RemoveSongFromPlaylist');
this.song = song;
this.playlist = playlist;
}
}
return RemoveSongFromPlaylist;
}(StuenMessage));
exports.RemoveSongFromPlaylist = RemoveSongFromPlaylist;
class ToggleTag extends StuenMessage {
constructor(song, tag) {
super('ToggleTag');
this.song = song;
this.tag = tag;
}
}
exports.ToggleTag = ToggleTag;
class Shuffle extends StuenMessage {
constructor() {
super('Shuffle');
}
}
exports.Shuffle = Shuffle;
class RemoveFromAutoPlay extends StuenMessage {
constructor() {
super('RemoveFromAutoPlay');
}
}
exports.RemoveFromAutoPlay = RemoveFromAutoPlay;
//# sourceMappingURL=messageTypes.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"messageTypes.js","sourceRoot":"","sources":["../messageTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAiBA;IACI,sBAAmB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAC/B,CAAC;IACL,mBAAC;AAAD,CAAC,AAHD,IAGC;AAHqB,oCAAY;AAKlC;IAA0B,wBAAY;IAClC,cAAmB,IAAY;QAA/B,YACI,kBAAM,MAAM,CAAC,SAChB;QAFkB,UAAI,GAAJ,IAAI,CAAQ;;IAE/B,CAAC;IACL,WAAC;AAAD,CAAC,AAJD,CAA0B,YAAY,GAIrC;AAJY,oBAAI;AAMjB;IAAoC,kCAAY;IAC5C,wBAAmB,IAAY;QAA/B,YACI,kBAAM,gBAAgB,CAAC,SAC1B;QAFkB,UAAI,GAAJ,IAAI,CAAQ;;IAE/B,CAAC;IACL,qBAAC;AAAD,CAAC,AAJD,CAAoC,YAAY,GAI/C;AAJY,wCAAc;AAM3B;IAAkC,gCAAY;IAC1C,sBAAmB,IAAY;QAA/B,YACI,kBAAM,cAAc,CAAC,SACxB;QAFkB,UAAI,GAAJ,IAAI,CAAQ;;IAE/B,CAAC;IACL,mBAAC;AAAD,CAAC,AAJD,CAAkC,YAAY,GAI7C;AAJY,oCAAY;AAMzB;IAAkC,gCAAY;IAC1C,sBAAmB,KAAe;QAAlC,YACI,kBAAM,cAAc,CAAC,SACxB;QAFkB,WAAK,GA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,CAAC,iBAAiB,CAAC,CAAC;QADV,cAAS,GAAT,SAAS,CAAuB;IAEnD,CAAC;CACJ;AAJD,0CAIC;AACD,MAAa,iBAAkB,SAAQ,YAAY;IAC/C,YAAmB,IAAU,EAAS,QAAgB;QAClD,KAAK,CAAC,mBAAmB,CAAC,CAAC;QADZ,SAAI,GAAJ,IAAI,CAAM;QAAS,aAAQ,GAAR,QAAQ,CAAQ;IAEtD,CAAC;CACJ;AAJD,8CAIC;AAED,MAAa,sBAAuB,SAAQ,YAAY;IACpD,YAAmB,IAAU,EAAS,QAAgB;QAClD,KAAK,CAAC,wBAAwB,CAAC,CAAC;QADjB,SAAI,GAAJ,IAAI,CAAM;QAAS,aAAQ,GAAR,QAAQ,CAAQ;IAEtD,CAAC;CACJ;AAJD,wDAIC;AAED,MAAa,SAAU,SAAQ,YAAY;IACvC,YAAmB,IAAU,EAAS,GAAW;QAC7C,KAAK,CAAC,WAAW,CAAC,CAAC;QADJ,SAAI,GAAJ,IAAI,CAAM;QAAS,QAAG,GAAH,GAAG,CAAQ;IAEjD,CAAC;CACJ;AAJD,8BAIC;AAED,MAAa,OAAQ,SAAQ,YAAY;IACrC;QACI,KAAK,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;CACJ;AAJD,0BAIC;AAED,MAAa,kBAAmB,SAAQ,YAAY;IAChD;QACI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAChC,CAAC;CACJ;AAJD,gDAIC"}
+27 -8
View File
@@ -1,16 +1,13 @@
"use strict";
exports.__esModule = true;
var messageTypes_1 = require("./messageTypes");
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = parseMessage;
const messageTypes_1 = require("./messageTypes");
function parseMessage(message) {
try {
var data = JSON.parse(message);
const data = JSON.parse(message);
switch (data.type) {
case 'Join':
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':
return new messageTypes_1.ListenerList(data.names);
case 'SendChatMessage':
@@ -21,12 +18,18 @@ function parseMessage(message) {
return new messageTypes_1.SearchSong(data.query);
case 'SearchSongResult':
return new messageTypes_1.SearchSongResult(data.result);
case 'SearchHistory':
return new messageTypes_1.SearchHistory(data.query);
case 'HistoryContent':
return new messageTypes_1.HistoryContent(data.result);
case 'QueueSong':
return new messageTypes_1.QueueSong(data.song);
case 'CurrentQueue':
return new messageTypes_1.CurrentQueue(data.songs);
case 'CurrentSong':
return new messageTypes_1.CurrentSong(data.song);
case 'CurrentPlayerControl':
return new messageTypes_1.CurrentPlayerControl(data.playerControl);
case 'UnqueueSong':
return new messageTypes_1.UnqueueSong(data.position, data.all);
case 'ReorderSong':
@@ -39,12 +42,28 @@ function parseMessage(message) {
return new messageTypes_1.SongLikes(data.listeners);
case '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':
return new messageTypes_1.CreatePlaylist(data.title);
case 'RemovePlaylist':
return new messageTypes_1.RemovePlaylist(data.title);
case 'AddSongToPlaylist':
return new messageTypes_1.AddSongToPlaylist(data.song, data.playlist);
case 'RemoveSongFromPlaylist':
return new messageTypes_1.RemoveSongFromPlaylist(data.song, data.playlist);
case 'GetOtherPlaylists':
return new messageTypes_1.GetOtherPlaylists();
case 'OthersPlaylists':
return new messageTypes_1.OthersPlaylists(data.playlists);
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:
console.error('Unknown message type:', data.type);
return null;
@@ -55,4 +74,4 @@ function parseMessage(message) {
return null; // Handle parsing errors
}
}
exports["default"] = parseMessage;
//# sourceMappingURL=parseMessage.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"parseMessage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Q,CAAC,CAAC;YAC5C,KAAK,gBAAgB;gBACjB,OAAO,IAAI,6BAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1C,KAAK,gBAAgB;gBACjB,OAAO,IAAI,6BAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1C,KAAK,mBAAmB;gBACpB,OAAO,IAAI,gCAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC3D,KAAK,wBAAwB;gBACzB,OAAO,IAAI,qCAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChE,KAAK,mBAAmB;gBACpB,OAAO,IAAI,gCAAiB,EAAE,CAAC;YACnC,KAAK,iBAAiB;gBAClB,OAAO,IAAI,8BAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/C,KAAK,WAAW;gBACZ,OAAO,IAAI,wBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAC9C,KAAK,SAAS;gBACV,OAAO,IAAI,sBAAO,EAAE,CAAC;YACzB,KAAK,oBAAoB;gBACrB,OAAO,IAAI,iCAAkB,EAAE,CAAC;YACpC;gBACI,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClD,OAAO,IAAI,CAAC;QACpB,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,CAAC,wBAAwB;IACzC,CAAC;AACL,CAAC"}
+63 -16
View File
@@ -1,27 +1,33 @@
import {Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription} from "./dataTypes";
import {Song, PlayingSong, QueuedSong, Playlist, PlaylistDescription, PlayerControl} from "./dataTypes";
export type StuenMessages =
ListenerLeft
| ListenerList
| ListenerJoined
ListenerList
| SendChatMessage
| SearchSong
| SearchSongResult
| SearchHistory
| HistoryContent
| Join
| QueueSong
| CurrentQueue
| CurrentSong
| CurrentPlayerControl
| UnqueueSong
| ReorderSong
| SkipSong
| SongLikes
| ToggleSongLike
| CreatePlaylist
| RemovePlaylist
| AddSongToPlaylist
| RemoveSongFromPlaylist
| Playlists
| GetPlaylist
| PlaylistSongs
| GetOtherPlaylists
| ToggleTag
| Shuffle
| RemoveFromAutoPlay
export abstract class StuenMessage {
constructor(public type: string) {
@@ -34,18 +40,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 {
constructor(public names: string[]) {
super('ListenerList');
@@ -79,6 +73,18 @@ export class SearchSongResult extends StuenMessage {
}
}
export class SearchHistory extends StuenMessage {
constructor(public query: string) {
super('SearchHistory');
}
}
export class HistoryContent extends StuenMessage {
constructor(public result: Song[]) {
super('HistoryContent');
}
}
export class QueueSong extends StuenMessage {
constructor(public song: Song) {
super('QueueSong');
@@ -97,6 +103,12 @@ export class CurrentSong extends StuenMessage {
}
}
export class CurrentPlayerControl extends StuenMessage {
constructor(public playerControl: PlayerControl | null) {
super('CurrentPlayerControl');
}
}
export class UnqueueSong extends StuenMessage {
constructor(public position: number | null, public all: boolean | undefined = false) {
super('UnqueueSong');
@@ -132,6 +144,11 @@ export class CreatePlaylist extends StuenMessage {
super('CreatePlaylist');
}
}
export class RemovePlaylist extends StuenMessage {
constructor(public title: string) {
super('RemovePlaylist');
}
}
export class Playlists extends StuenMessage {
constructor(public playlists: PlaylistDescription[]) {
@@ -144,12 +161,24 @@ export class GetPlaylist extends StuenMessage {
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 {
constructor(public song: Song, public playlist: string) {
super('AddSongToPlaylist');
@@ -161,3 +190,21 @@ export class RemoveSongFromPlaylist extends StuenMessage {
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 -1
View File
@@ -1,6 +1,6 @@
{
"name": "stuen-common",
"version": "1.2.1",
"version": "1.2.17",
"main": "dist/common.js",
"type": "commonjs",
"types": "dist/common.d.ts",
+26 -10
View File
@@ -3,25 +3,27 @@ import {
ChatMessage,
CreatePlaylist,
CurrentQueue,
CurrentPlayerControl,
CurrentSong,
GetPlaylist,
HistoryContent,
Join,
ListenerJoined,
ListenerLeft,
ListenerList,
Playlists,
PlaylistSongs,
QueueSong,
GetOtherPlaylists,
QueueSong, RemoveFromAutoPlay, RemovePlaylist,
RemoveSongFromPlaylist,
ReorderSong,
SearchHistory,
SearchSong,
SearchSongResult,
SendChatMessage,
SendChatMessage, Shuffle,
SkipSong,
SongLikes,
StuenMessage,
ToggleSongLike,
UnqueueSong
ToggleSongLike, ToggleTag,
UnqueueSong, OthersPlaylists,
} from "./messageTypes";
export default function parseMessage(message: string): StuenMessage | null {
@@ -31,10 +33,6 @@ export default function parseMessage(message: string): StuenMessage | null {
switch (data.type) {
case 'Join':
return new Join(data.name);
case 'ListenerJoined':
return new ListenerJoined(data.name);
case 'ListenerLeft':
return new ListenerLeft(data.name);
case 'ListenerList':
return new ListenerList(data.names);
case 'SendChatMessage':
@@ -45,12 +43,18 @@ export default function parseMessage(message: string): StuenMessage | null {
return new SearchSong(data.query);
case 'SearchSongResult':
return new SearchSongResult(data.result);
case 'SearchHistory':
return new SearchHistory(data.query);
case 'HistoryContent':
return new HistoryContent(data.result);
case 'QueueSong':
return new QueueSong(data.song);
case 'CurrentQueue':
return new CurrentQueue(data.songs)
case 'CurrentSong':
return new CurrentSong(data.song);
case 'CurrentPlayerControl':
return new CurrentPlayerControl(data.playerControl);
case 'UnqueueSong':
return new UnqueueSong(data.position, data.all);
case 'ReorderSong':
@@ -69,10 +73,22 @@ export default function parseMessage(message: string): StuenMessage | null {
return new PlaylistSongs(data.playlist);
case 'CreatePlaylist':
return new CreatePlaylist(data.title);
case 'RemovePlaylist':
return new RemovePlaylist(data.title);
case 'AddSongToPlaylist':
return new AddSongToPlaylist(data.song, data.playlist);
case 'RemoveSongFromPlaylist':
return new RemoveSongFromPlaylist(data.song, data.playlist);
case 'GetOtherPlaylists':
return new GetOtherPlaylists();
case 'OthersPlaylists':
return new OthersPlaylists(data.playlists);
case 'ToggleTag':
return new ToggleTag(data.song, data.tag);
case 'Shuffle':
return new Shuffle();
case 'RemoveFromAutoPlay':
return new RemoveFromAutoPlay();
default:
console.error('Unknown message type:', data.type);
return null;
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"sourceMap": true,
"declaration": true,
},