6 Commits

Author SHA1 Message Date
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
9 changed files with 46 additions and 16 deletions

View File

@@ -5,20 +5,20 @@ 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 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, public listener: string, public inAutoPlay: boolean) {
super(type, title, songId, image, inAutoPlay);
}
}
export class PlayingSong extends QueuedSong {
constructor(type: SongType, title: string, songId: string, image: string, listener: string, public length: number, public position: number, public tags: string[]) {
super(type, title, songId, image, listener);
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, inAutoPlay);
}
}

9
dist/dataTypes.d.ts vendored
View File

@@ -7,17 +7,20 @@ export declare class Song {
title: string;
songId: 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 {
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 {
length: number;
position: number;
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 {
title: string;

13
dist/dataTypes.js vendored
View File

@@ -22,20 +22,22 @@ var SongType;
SongType[SongType["Spotify"] = 1] = "Spotify";
})(SongType || (exports.SongType = SongType = {}));
var Song = /** @class */ (function () {
function Song(type, title, songId, image) {
function Song(type, title, songId, image, inAutoPlay) {
this.type = type;
this.title = title;
this.songId = songId;
this.image = image;
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;
function QueuedSong(type, title, songId, image, listener, inAutoPlay) {
var _this = _super.call(this, type, title, songId, image, inAutoPlay) || this;
_this.listener = listener;
_this.inAutoPlay = inAutoPlay;
return _this;
}
return QueuedSong;
@@ -43,11 +45,12 @@ var QueuedSong = /** @class */ (function (_super) {
exports.QueuedSong = QueuedSong;
var PlayingSong = /** @class */ (function (_super) {
__extends(PlayingSong, _super);
function PlayingSong(type, title, songId, image, listener, length, position, tags) {
var _this = _super.call(this, type, title, songId, image, listener) || this;
function PlayingSong(type, title, songId, image, listener, length, position, tags, inAutoPlay) {
var _this = _super.call(this, type, title, songId, image, listener, inAutoPlay) || this;
_this.length = length;
_this.position = position;
_this.tags = tags;
_this.inAutoPlay = inAutoPlay;
return _this;
}
return PlayingSong;

View File

@@ -1,5 +1,5 @@
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 | GetAllPlaylists | ToggleTag | Shuffle | RemoveFromAutoPlay;
export declare abstract class StuenMessage {
type: string;
constructor(type: string);
@@ -89,6 +89,9 @@ export declare class PlaylistSongs extends StuenMessage {
playlist: Playlist;
constructor(playlist: Playlist);
}
export declare class GetAllPlaylists extends StuenMessage {
constructor();
}
export declare class AddSongToPlaylist extends StuenMessage {
song: Song;
playlist: string;

10
dist/messageTypes.js vendored
View File

@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
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.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;
var StuenMessage = /** @class */ (function () {
function StuenMessage(type) {
this.type = type;
@@ -233,6 +233,14 @@ var PlaylistSongs = /** @class */ (function (_super) {
return PlaylistSongs;
}(StuenMessage));
exports.PlaylistSongs = PlaylistSongs;
var GetAllPlaylists = /** @class */ (function (_super) {
__extends(GetAllPlaylists, _super);
function GetAllPlaylists() {
return _super.call(this, 'GetAllPlaylists') || this;
}
return GetAllPlaylists;
}(StuenMessage));
exports.GetAllPlaylists = GetAllPlaylists;
var AddSongToPlaylist = /** @class */ (function (_super) {
__extends(AddSongToPlaylist, _super);
function AddSongToPlaylist(song, playlist) {

View File

@@ -51,6 +51,8 @@ function parseMessage(message) {
return new messageTypes_1.AddSongToPlaylist(data.song, data.playlist);
case 'RemoveSongFromPlaylist':
return new messageTypes_1.RemoveSongFromPlaylist(data.song, data.playlist);
case 'GetAllPlaylists':
return new messageTypes_1.GetAllPlaylists();
case 'ToggleTag':
return new messageTypes_1.ToggleTag(data.song, data.tag);
case 'Shuffle':

View File

@@ -23,6 +23,7 @@ export type StuenMessages =
| Playlists
| GetPlaylist
| PlaylistSongs
| GetAllPlaylists
| ToggleTag
| Shuffle
| RemoveFromAutoPlay
@@ -153,12 +154,19 @@ export class GetPlaylist extends StuenMessage {
super('GetPlaylist');
}
}
export class PlaylistSongs extends StuenMessage {
constructor(public playlist: Playlist) {
super('PlaylistSongs');
}
}
export class GetAllPlaylists extends StuenMessage {
constructor() {
super('GetAllPlaylists');
}
}
export class AddSongToPlaylist extends StuenMessage {
constructor(public song: Song, public playlist: string) {
super('AddSongToPlaylist');

View File

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

View File

@@ -11,6 +11,7 @@ import {
ListenerList,
Playlists,
PlaylistSongs,
GetAllPlaylists,
QueueSong, RemoveFromAutoPlay, RemovePlaylist,
RemoveSongFromPlaylist,
ReorderSong,
@@ -75,6 +76,8 @@ export default function parseMessage(message: string): StuenMessage | null {
return new AddSongToPlaylist(data.song, data.playlist);
case 'RemoveSongFromPlaylist':
return new RemoveSongFromPlaylist(data.song, data.playlist);
case 'GetAllPlaylists':
return new GetAllPlaylists();
case 'ToggleTag':
return new ToggleTag(data.song, data.tag);
case 'Shuffle':