Skip to content

Commit

Permalink
fix: artist tracks not being listed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ferferga authored Dec 30, 2024
1 parent 929a22e commit 15dbcda
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
6 changes: 3 additions & 3 deletions frontend/src/components/Layout/Artist/ArtistTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
class="my-2">
<VCol>
<TrackList
:tracks
:tracks="tracksByRelease.get(release.Id) ?? []"
:item="release" />
</VCol>
</VRow>
Expand All @@ -48,8 +48,8 @@
import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client';
import { getItemDetailsLink } from '@/utils/items';
const { releases } = defineProps<{
tracks: BaseItemDto[];
const { releases, tracksByRelease } = defineProps<{
tracksByRelease: Map<BaseItemDto['Id'], BaseItemDto[]>;
releases: BaseItemDto[];
}>();
</script>
32 changes: 22 additions & 10 deletions frontend/src/pages/artist/[itemId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@
class="bg-transparent">
<VWindowItem :value="0">
<ArtistTab
:tracks
:tracks-by-release
:releases="discography" />
</VWindowItem>
<VWindowItem :value="1">
<ArtistTab
:tracks
:tracks-by-release
:releases="albums" />
</VWindowItem>
<VWindowItem :value="2">
<ArtistTab
:tracks
:tracks-by-release
:releases="eps" />
</VWindowItem>
<VWindowItem :value="3">
<ArtistTab
:tracks
:tracks-by-release
:releases="singles" />
</VWindowItem>
<VWindowItem :value="4">
Expand Down Expand Up @@ -180,8 +180,7 @@ const [
{ data: relatedItems },
{ data: discography },
{ data: appearances },
{ data: musicVideos },
{ data: tracks }
{ data: musicVideos }
] = await Promise.all([
useBaseItem(getUserLibraryApi, 'getItem')(() => ({
itemId: route.params.itemId
Expand Down Expand Up @@ -211,13 +210,26 @@ const [
sortOrder: [SortOrder.Descending],
recursive: true,
includeItemTypes: [BaseItemKind.MusicVideo]
})),
}))
]);
const all_tracks = await Promise.all(discography.value.map(album =>
useBaseItem(getItemsApi, 'getItems')(() => ({
parentId: route.params.itemId,
parentId: album.Id,
sortBy: ['SortName'],
sortOrder: [SortOrder.Ascending]
}))
]);
})))
);
const tracksByRelease = computed(() => {
const map = new Map<BaseItemDto['Id'], BaseItemDto[]>();
for (let i = 0; i < discography.value.length; i++) {
map.set(discography.value[i]!.Id, all_tracks[i]!.data.value);
}
return map;
});
const singles = computed<BaseItemDto[]>(() =>
discography.value.filter(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/series/[itemId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ const seasonsData = await Promise.all(seasons.value.map(s =>
const seasonEpisodes = computed(() => {
const map = new Map<BaseItemDto['Id'], BaseItemDto[]>();
for (const [index, season] of seasons.value.entries()) {
map.set(season.Id, seasonsData[index]!.data.value);
for (let i = 0; i < seasons.value.length; i++) {
map.set(seasons.value[i]!.Id, seasonsData[i]!.data.value);
}
return map;
Expand Down

0 comments on commit 15dbcda

Please sign in to comment.