Skip to content

Commit

Permalink
Discogs plugin bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Feb 24, 2020
1 parent 88365e9 commit b1007a5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/app/app/components/FavoriteTracksView/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.favorite_tracks_view {
display: flex;
flex-flow: column;
height: 100%;
min-height: 100%;

.empty_state {
@include emptyState;
Expand Down
2 changes: 1 addition & 1 deletion packages/app/app/components/TrackRow/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
width: 3em;
height: 3em;
display: block;
object-fit: contain;
object-fit: cover;
}
}

Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/plugins/meta/discogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
DiscogsTrack
} from '../../rest/Discogs.types';
import { LastFmArtistInfo, LastfmTopTracks, LastfmTrack } from '../../rest/Lastfm.types';
import { cleanName } from '../../structs/Artist';

class DiscogsMetaProvider extends MetaProvider {
lastfm: LastFmApi;
Expand Down Expand Up @@ -140,6 +141,7 @@ class DiscogsMetaProvider extends MetaProvider {

async fetchArtistDetails(artistId: string): Promise<ArtistDetails> {
const discogsInfo: DiscogsArtistInfo = await (await Discogs.artistInfo(artistId)).json();
discogsInfo.name = cleanName(discogsInfo.name);

const lastFmInfo: LastFmArtistInfo = (await (await this.lastfm.getArtistInfo(discogsInfo.name)).json()).artist;
const lastFmTopTracks: LastfmTopTracks = (await (await this.lastfm.getArtistTopTracks(discogsInfo.name)).json()).toptracks;
Expand All @@ -149,8 +151,8 @@ class DiscogsMetaProvider extends MetaProvider {
return Promise.resolve({
id: discogsInfo.id,
name: discogsInfo.name,
description: lastFmInfo.bio.summary,
tags: _.map(lastFmInfo.tags.tag, 'name'),
description: _.get(lastFmInfo, 'bio.summary'),
tags: _.map(_.get(lastFmInfo, 'tags.tag'), 'name'),
onTour: lastFmInfo.ontour === '1',
coverImage: coverImage,
thumb: coverImage,
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/structs/Artist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '../plugins/plugins.types';

const artistQuantifierRegex = /\s\([0-9]*\)$/;
export const cleanName = name => name && name.replace(artistQuantifierRegex, '');

export default class Artist {
uuid: string;
Expand Down Expand Up @@ -47,7 +48,7 @@ export default class Artist {
}

cleanName(): void {
this.name = this.name && this.name.replace(artistQuantifierRegex, '');
this.name = cleanName(this.name);
}

addSearchResultData(data: SearchResultsArtist): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/components/ContextPopup/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
flex: 0 0 auto;
width: 5em;
height: 5em;
object-fit: contain;
margin-right: 1em;

img {
width: 5em;
height: 5em;
object-fit: cover;
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/ui/lib/components/QueueItem/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
img {
@include circle;
width: 100%;
height: 100%;
object-fit: cover;
}
}

Expand Down

0 comments on commit b1007a5

Please sign in to comment.