Skip to content

Commit

Permalink
Merge pull request #39 from LUSHDigital/pod_no_loop
Browse files Browse the repository at this point in the history
Pod no loop
  • Loading branch information
InBrewJ authored Dec 13, 2019
2 parents 489d8ca + 77abe4a commit 6ae412d
Show file tree
Hide file tree
Showing 8 changed files with 1,815 additions and 1,678 deletions.
3,427 changes: 1,769 additions & 1,658 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lrpi_tablet_ui",
"version": "1.0.1",
"version": "1.1.0",
"scripts": {
"ng": "ng",
"start": "ng serve -o",
Expand Down
6 changes: 5 additions & 1 deletion src/app/app.component.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
html {
background-color: black;
}

.settings-room-name {
padding: 0.6em 0 0.6em 10vw;
background-color: black;
Expand All @@ -12,7 +16,7 @@

p.slave-prompt {
padding: 0.6em 0 0.6em 10vw
}
}

.pair-button button {
margin-left: 0.3em;
Expand Down
38 changes: 24 additions & 14 deletions src/app/pages/track-control/track-control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class TrackControlComponent implements OnInit {
private route: ActivatedRoute,
private getTracksService: GetTracksService,
private getStylesService: GetStylesService,
private _location: Location,
private router: Router
) {}

Expand Down Expand Up @@ -129,20 +128,12 @@ export class TrackControlComponent implements OnInit {
}
}

setInterval(() => {
setInterval(() => {
if (this.playing && (this.ticks < +this.totalTicks)) {
this.now = this.hhmmss(this.ticks += 1);
this.now = this.hhmmss(this.ticks += 1);
} else if (this.ticks >= +this.totalTicks && this.ticks != 0 && this.playing) {
this.now = '00:00:00'
this.ticks = 0;
// Play the next track in the playlist
// automatically
this.playing = false;
this.skipped = false;
this.duration = 'XX:XX:XX';
// TODO: needs to loop on LOOP tracks?
// Skip only on command
this.next(undefined);
this.resetProgressBar()
this.next(undefined);;
}
this.i_progress = Math.floor((this.ticks/this.totalTicks)*100)
}, 1000);
Expand All @@ -153,6 +144,24 @@ export class TrackControlComponent implements OnInit {

}

// Used in the skip function to avoid looping an entire playlist
// Beware! if there is only one track in the playlist this will always
// return true

endOfPlaylist() {
return this.hrId + 1 === this.playlist.length;
}

resetProgressBar() {
this.now = '00:00:00';
this.ticks = 0;
// Play the next track in the playlist
// automatically
this.playing = false;
this.skipped = false;
this.duration = 'XX:XX:XX';
}

play() {
this.loading = true;
if (!this.started) {
Expand All @@ -170,7 +179,7 @@ export class TrackControlComponent implements OnInit {
this.playing = true;
this.duration = this.hhmmss(data)
console.log(data);
});
});
}
}

Expand All @@ -185,6 +194,7 @@ export class TrackControlComponent implements OnInit {
next(interval) {
if(!this.loading) {
this.hrId = ((++this.hrId) % (this.numTracks));
if (this.hrId === 0) this.started = false;
this.fadeToTrack(
this.hrId,
this.playing ? interval : 0
Expand Down
11 changes: 8 additions & 3 deletions src/app/pages/track-selector/track-selector.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<!-- <router-outlet></router-outlet> -->
<div *ngIf="serverData != null; else elseBlock">
<div id="mainBox" [ngStyle]="styleObject()" *ngIf="loading">
<h2>Please wait...</h2>
<mat-spinner class="white"></mat-spinner>
</div>

<div *ngIf="serverData != null; else error">
<div id="mainBox" [ngStyle]="styleObject()">
<div class="selector-heading">Select treatment:</div>
<div *ngFor="let item of serverData | async" [ngStyle]="itemStyleObject()">
Expand All @@ -18,12 +23,12 @@
<mat-icon>arrow_right_alt</mat-icon>
</div>
</div>
</a>
</a>
</ng-template>

</div>
</div>
</div>
<ng-template #elseBlock>
<ng-template #error>
<div class="error">{{ errorResponse.message }}</div>
</ng-template>
3 changes: 3 additions & 0 deletions src/app/pages/track-selector/track-selector.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class TrackSelectorComponent implements OnInit {
folderId = null;
settings: any;
roomName: string = '?';
loading = true;

constructor(
private httpClient: HttpClient,
Expand Down Expand Up @@ -55,6 +56,7 @@ export class TrackSelectorComponent implements OnInit {
ngOnInit() {

this.folderId = this.route.snapshot.queryParamMap.get("id");
this.loading = true;

this.getTracksService.getStatus().pipe(
switchMap((status: any) => {
Expand Down Expand Up @@ -87,6 +89,7 @@ export class TrackSelectorComponent implements OnInit {
console.log('In the playlist processor');

let data: any = d;
this.loading = false;

console.log('tracks: ', data, ' length: ', data.length);

Expand Down
2 changes: 1 addition & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

export const environment = {
production: false,
hostname: 'lushroom-dev-master.local'
hostname: '192.168.0.56'
};

/*
Expand Down
4 changes: 4 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ a {
font-weight: bold;
}

.mat-spinner.white circle {
stroke: white;
}


.mat-progress-spinner circle, .mat-spinner circle {
stroke: black;
Expand Down

0 comments on commit 6ae412d

Please sign in to comment.