6 Commits

Author SHA1 Message Date
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
8 changed files with 60 additions and 11 deletions

9
dist/dataTypes.d.ts vendored
View File

@@ -7,17 +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;
tags: string[]; tags: string[];
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;

13
dist/dataTypes.js vendored
View File

@@ -22,20 +22,22 @@ var SongType;
SongType[SongType["Spotify"] = 1] = "Spotify"; SongType[SongType["Spotify"] = 1] = "Spotify";
})(SongType || (exports.SongType = 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,11 +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, tags) { 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.tags = tags;
_this.inAutoPlay = inAutoPlay;
return _this; return _this;
} }
return PlayingSong; return PlayingSong;

View File

@@ -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 | ToggleTag | Shuffle | RemoveFromAutoPlay; 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);
@@ -89,6 +89,13 @@ export declare class PlaylistSongs extends StuenMessage {
playlist: Playlist; playlist: Playlist;
constructor(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;
playlist: string; playlist: string;

20
dist/messageTypes.js vendored
View File

@@ -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.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.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;
@@ -233,6 +233,24 @@ var PlaylistSongs = /** @class */ (function (_super) {
return PlaylistSongs; return PlaylistSongs;
}(StuenMessage)); }(StuenMessage));
exports.PlaylistSongs = PlaylistSongs; 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) {

View File

@@ -51,6 +51,8 @@ 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':
return new messageTypes_1.GetOtherPlaylists();
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':

View File

@@ -23,6 +23,7 @@ export type StuenMessages =
| Playlists | Playlists
| GetPlaylist | GetPlaylist
| PlaylistSongs | PlaylistSongs
| GetOtherPlaylists
| ToggleTag | ToggleTag
| Shuffle | Shuffle
| RemoveFromAutoPlay | RemoveFromAutoPlay
@@ -153,12 +154,24 @@ export class GetPlaylist extends StuenMessage {
super('GetPlaylist'); super('GetPlaylist');
} }
} }
export class PlaylistSongs extends StuenMessage { export class PlaylistSongs extends StuenMessage {
constructor(public playlist: Playlist) { constructor(public playlist: Playlist) {
super('PlaylistSongs'); 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');

View File

@@ -1,6 +1,6 @@
{ {
"name": "stuen-common", "name": "stuen-common",
"version": "1.2.11", "version": "1.2.16",
"main": "dist/common.js", "main": "dist/common.js",
"type": "commonjs", "type": "commonjs",
"types": "dist/common.d.ts", "types": "dist/common.d.ts",

View File

@@ -11,6 +11,7 @@ import {
ListenerList, ListenerList,
Playlists, Playlists,
PlaylistSongs, PlaylistSongs,
GetOtherPlaylists,
QueueSong, RemoveFromAutoPlay, RemovePlaylist, QueueSong, RemoveFromAutoPlay, RemovePlaylist,
RemoveSongFromPlaylist, RemoveSongFromPlaylist,
ReorderSong, ReorderSong,
@@ -75,6 +76,8 @@ 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':
return new GetOtherPlaylists();
case 'ToggleTag': case 'ToggleTag':
return new ToggleTag(data.song, data.tag); return new ToggleTag(data.song, data.tag);
case 'Shuffle': case 'Shuffle':