mirror of
https://github.com/Jellify-Music/App.git
synced 2026-02-25 21:29:24 -06:00
carplay fixes
This commit is contained in:
@@ -47,7 +47,7 @@ export function fetchItemImage(itemId: string, imageType: ImageType, width: numb
|
||||
});
|
||||
}
|
||||
|
||||
function getImageFilePath(itemId: string, width: number, height: number, imageType: ImageType) {
|
||||
export function getImageFilePath(itemId: string, width: number, height: number, imageType: ImageType) {
|
||||
return `${Dirs.CacheDir}/images/${itemId}_${imageType}_${width}x${height}.png`
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ const CarPlayHome : ListTemplate = new ListTemplate({
|
||||
onItemSelect: async ({ index }) => {
|
||||
|
||||
switch (index) {
|
||||
case 1:
|
||||
case 0:
|
||||
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
const tracks = await fetchRecentlyPlayed()
|
||||
CarPlay.pushTemplate(CarPlayRecentlyPlayed(tracks))
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getImageFilePath } from "../../api/queries/functions/images";
|
||||
import Client from "../../api/client";
|
||||
import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
|
||||
import { BaseItemDto, ImageType } from "@jellyfin/sdk/lib/generated-client/models";
|
||||
import { getImageApi } from "@jellyfin/sdk/lib/utils/api";
|
||||
import { GridTemplate, ListTemplate } from "react-native-carplay";
|
||||
|
||||
@@ -9,9 +10,9 @@ export const CarPlayRecentlyPlayed = (recentTracks : BaseItemDto[]) => new ListT
|
||||
return {
|
||||
id: track.Id!,
|
||||
text: track.Name ? track.Name : "Untitled Track",
|
||||
imgUrls : [
|
||||
Client.api ? getImageApi(Client.api).getItemImageUrlById(track.Id!) : ""
|
||||
]
|
||||
image: {
|
||||
uri: `file://${getImageFilePath(track.Id!, 150, 150, ImageType.Primary)}`
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user