mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Refactor the livefeed stop
This commit is contained in:
parent
d6bc3c8bcf
commit
ec5974cad1
|
|
@ -607,13 +607,26 @@ export class AppRdioScannerService implements OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private liveFeedStart(): void {
|
private liveFeedStart(): void {
|
||||||
|
this.liveFeedActive = true;
|
||||||
|
|
||||||
|
this.event.emit({ liveFeed: true });
|
||||||
|
|
||||||
this.webSocketSend(WebSocketCommand.LiveFeedMap, this.liveFeedMap);
|
this.webSocketSend(WebSocketCommand.LiveFeedMap, this.liveFeedMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private liveFeedStop(): void {
|
private liveFeedStop(): void {
|
||||||
this.webSocketSend(WebSocketCommand.LiveFeedMap, null);
|
this.liveFeedActive = false;
|
||||||
|
|
||||||
|
this.callQueue.splice(0, this.callQueue.length);
|
||||||
|
|
||||||
|
this.event.emit({
|
||||||
|
liveFeed: false,
|
||||||
|
queue: 0,
|
||||||
|
});
|
||||||
|
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
||||||
|
this.webSocketSend(WebSocketCommand.LiveFeedMap, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private liveFeedStore(): void {
|
private liveFeedStore(): void {
|
||||||
|
|
@ -638,10 +651,14 @@ export class AppRdioScannerService implements OnDestroy {
|
||||||
switch (message[2]) {
|
switch (message[2]) {
|
||||||
case WebSocketCallFlag.Download:
|
case WebSocketCallFlag.Download:
|
||||||
this.download(message[1]);
|
this.download(message[1]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WebSocketCallFlag.Play:
|
case WebSocketCallFlag.Play:
|
||||||
this.play(message[1]);
|
if (this.liveFeedActive) {
|
||||||
|
this.play(message[1]);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -679,23 +696,6 @@ export class AppRdioScannerService implements OnDestroy {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WebSocketCommand.LiveFeedMap:
|
|
||||||
this.liveFeedActive = message[1];
|
|
||||||
|
|
||||||
if (this.liveFeedActive) {
|
|
||||||
this.event.emit({ liveFeed: this.liveFeedActive });
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.callQueue.splice(0, this.callQueue.length);
|
|
||||||
|
|
||||||
this.event.emit({
|
|
||||||
liveFeed: this.liveFeedActive,
|
|
||||||
queue: this.callQueue.length,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WebSocketCommand.Nop:
|
case WebSocketCommand.Nop:
|
||||||
clearTimeout(this.webSocketTimeout);
|
clearTimeout(this.webSocketTimeout);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue