Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
Something went wrong. Try again.
2.0 kB · 63 lines
TSX
at debugStartup
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263import type { Card, IconProps, HTMLChakraProps} from '@chakra-ui/react';import { Span } from '@chakra-ui/react';import type {PlayApiCommonDetailed} from '../../core/Api';import { type LifecycleStep, QUEUE_STATUS_COMPLETED, QUEUE_STATUS_FAILED } from '../../core/Atomic';
export const cardHeaderSeparator: Card.HeaderProps = { borderBottomWidth: "1px", paddingBottom: "2"};
export const timelineTextFormatting: HTMLChakraProps<"span"> = { //textAlign: "left", textWrap: "balance" }
export const timelineIconProps: IconProps = { fontSize: 'md'}
export const TimelineItemSummaryText = (props: HTMLChakraProps<"span"> & {children: React.ReactNode}) => <Span {...timelineTextFormatting}>{props.children}</Span>
export const activityTransformHasIssue = (steps: LifecycleStep[]): 'warn' | 'error' | undefined => { for(const step of steps) { if(step.flowKnownState === 'prereq') { return 'warn'; } if(step.flowKnownState === 'skip') { continue; } if(step.error !== undefined && step.error !== null && Object.keys(step.error).length > 0) { return 'error'; } } return undefined;}
export const activityTimelineHasIssue = (activity: PlayApiCommonDetailed): 'warn' | 'error' | undefined => { const { queueStates = [], play: { lifecycle = [], scrobble: { error: scrobbleError, warnings: scrobbleWarnings = [] } = {}, } = {}, } = activity; const transformIssue = activityTransformHasIssue(lifecycle); if(transformIssue !== undefined) { return transformIssue; } if (scrobbleError !== undefined) { return 'error'; } if(scrobbleWarnings.length > 0) { return 'warn'; } if (queueStates.some(x => x.queueStatus === QUEUE_STATUS_FAILED) && !queueStates.some(x => x.queueStatus === QUEUE_STATUS_COMPLETED)) { return 'error'; }
return undefined;}