Fixed up some of the artist albums

pull/3895/head
tidusjar 5 years ago
parent b6c53a69fa
commit f921d84b0b

@ -102,7 +102,7 @@
<div class="row">
<div class="col-12">
<artist-release-panel [releases]="artist.releaseGroups"></artist-release-panel>
<artist-release-panel *ngIf="artist.releaseGroups.length > 0" [releases]="artist.releaseGroups"></artist-release-panel>
</div>
</div>

@ -12,11 +12,11 @@
<div class="row card-spacer">
<span *ngFor="let r of albums">
<div class="col-md-2" *ngIf="r.image" >
<div class="col-md-2" >
<div class="sidebar affixable affix-top preview-poster">
<div class="poster">
<img class="real grow" matTooltip="{{r.title}}"
src="{{r.image}}" alt="Poster"
src="{{r.image ? r.image : 'images/default-music-placeholder.png'}}" alt="Poster"
style="display: block;">
</div>
</div>

@ -1,4 +1,4 @@
import { Component, Input, ViewEncapsulation, OnInit } from "@angular/core";
import { Component, Input, ViewEncapsulation, OnInit, OnChanges, SimpleChanges } from "@angular/core";
import { IReleaseGroups } from "../../../../../interfaces/IMusicSearchResultV2";
import { SearchV2Service } from "../../../../../services/searchV2.service";
import { ActivatedRoute } from "@angular/router";
@ -9,19 +9,16 @@ import { ActivatedRoute } from "@angular/router";
selector: "artist-release-panel",
encapsulation: ViewEncapsulation.None
})
export class ArtistReleasePanel implements OnInit {
export class ArtistReleasePanel implements OnChanges {
@Input() public releases: IReleaseGroups[];
public albums: IReleaseGroups[];
constructor(private searchService: SearchV2Service, private route: ActivatedRoute) {
route.params.subscribe(() => {
// This is due to when we change the music Id, NgOnInit is not called again
// Since the component has not been destroyed (We are not navigating away)
// so we need to subscribe to custom changes so we can do the data manulipulation below
this.loadAlbums();
});
constructor(private searchService: SearchV2Service) {
}
ngOnChanges(changes: SimpleChanges): void {
this.loadAlbums();
}
public ngOnInit() {
@ -29,10 +26,19 @@ export class ArtistReleasePanel implements OnInit {
}
private loadAlbums(): void {
this.albums = this.releases.filter(x => x.type === "Album");
if (this.releases) {
this.albums = this.releases.filter(x => x.type === "Album");
this.albums = this.albums.sort((a: IReleaseGroups, b: IReleaseGroups) => {
return this.getTime(new Date(b.releaseDate)) - this.getTime(new Date(a.releaseDate));
});
this.albums.forEach(a => {
this.searchService.getReleaseGroupArt(a.id).subscribe(x => a.image = x.image);
});
}
}
this.albums.forEach(a => {
this.searchService.getReleaseGroupArt(a.id).subscribe(x => a.image = x.image);
});
private getTime(date?: Date) {
return date != null ? date.getTime() : 0;
}
}

@ -8,7 +8,7 @@
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit(form)" style="padding-top:5%;">
<div class="col-md-6">
<small>Changes to any of the below requires you to restart Ombi. </small>
<small>You can generate valid CRON Expressions here: <a href="http://www.cronmaker.com/" target="_blank">http://www.cronmaker.com/</a></small>
<small>You can generate valid CRON Expressions here: <a href="https://www.cronmaker.com/" target="_blank">https://www.cronmaker.com/</a></small>
<div class="form-group">
<label for="sonarrSync" class="control-label">Sonarr Sync</label>
<input type="text" class="form-control form-control-custom" [ngClass]="{'form-error': form.get('sonarrSync').hasError('required')}" id="sonarrSync" name="sonarrSync" formControlName="sonarrSync">

Loading…
Cancel
Save