Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

webui: display current track

+493 -31
+1
Cargo.lock
··· 5680 5680 "anyhow", 5681 5681 "async-graphql", 5682 5682 "async-graphql-actix-web", 5683 + "md5", 5683 5684 "owo-colors 4.1.0", 5684 5685 "reqwest", 5685 5686 "rockbox-library",
+1
crates/graphql/Cargo.toml
··· 10 10 anyhow = "1.0.87" 11 11 async-graphql = "7.0.9" 12 12 async-graphql-actix-web = "7.0.9" 13 + md5 = "0.7.0" 13 14 owo-colors = "4.1.0" 14 15 reqwest = {version = "0.12.7", features = ["rustls-tls", "json"], default-features = false} 15 16 rockbox-library = {path = "../library"}
+29 -3
crates/graphql/src/schema/playback.rs
··· 1 1 use std::sync::{mpsc::Sender, Arc, Mutex}; 2 2 3 3 use async_graphql::*; 4 + use rockbox_library::repo; 4 5 use rockbox_sys::{ 5 6 events::RockboxCommand, 6 7 types::{audio_status::AudioStatus, file_position::FilePosition, mp3_entry::Mp3Entry}, 7 8 }; 9 + use sqlx::{Pool, Sqlite}; 8 10 9 11 use crate::{rockbox_url, schema::objects::track::Track}; 10 12 ··· 15 17 impl PlaybackQuery { 16 18 async fn status(&self) -> Result<i32, Error> { 17 19 let client = reqwest::Client::new(); 18 - let url = format!("{}/audio_status", rockbox_url()); 20 + let url = format!("{}/player/status", rockbox_url()); 19 21 let response = client.get(&url).send().await?; 20 22 let response = response.json::<AudioStatus>().await?; 21 23 Ok(response.status) 22 24 } 23 25 24 26 async fn current_track(&self, ctx: &Context<'_>) -> Result<Option<Track>, Error> { 27 + let pool = ctx.data::<Pool<Sqlite>>()?; 25 28 let client = ctx.data::<reqwest::Client>().unwrap(); 26 29 let url = format!("{}/player/current-track", rockbox_url()); 27 30 let response = client.get(&url).send().await?; 28 31 let track = response.json::<Option<Mp3Entry>>().await?; 29 - Ok(track.map(|t| t.into())) 32 + let mut track: Option<Track> = track.map(|t| t.into()); 33 + let path: Option<String> = track.as_ref().map(|t| t.path.clone()); 34 + if let Some(path) = path { 35 + let hash = format!("{:x}", md5::compute(path.as_bytes())); 36 + if let Some(metadata) = repo::track::find_by_md5(pool.clone(), &hash).await? { 37 + track.as_mut().unwrap().id = Some(metadata.id); 38 + track.as_mut().unwrap().album_art = metadata.album_art; 39 + track.as_mut().unwrap().album_id = Some(metadata.album_id); 40 + track.as_mut().unwrap().artist_id = Some(metadata.artist_id); 41 + } 42 + } 43 + Ok(track) 30 44 } 31 45 32 46 async fn next_track(&self, ctx: &Context<'_>) -> Result<Option<Track>, Error> { 47 + let pool = ctx.data::<Pool<Sqlite>>()?; 33 48 let client = ctx.data::<reqwest::Client>().unwrap(); 34 49 let url = format!("{}/player/next-track", rockbox_url()); 35 50 let response = client.get(&url).send().await?; 36 51 let track = response.json::<Option<Mp3Entry>>().await?; 37 - Ok(track.map(|t| t.into())) 52 + let mut track: Option<Track> = track.map(|t| t.into()); 53 + let path: Option<String> = track.as_ref().map(|t| t.path.clone()); 54 + if let Some(path) = path { 55 + let hash = format!("{:x}", md5::compute(path.as_bytes())); 56 + if let Some(metadata) = repo::track::find_by_md5(pool.clone(), &hash).await? { 57 + track.as_mut().unwrap().id = Some(metadata.id); 58 + track.as_mut().unwrap().album_art = metadata.album_art; 59 + track.as_mut().unwrap().album_id = Some(metadata.album_id); 60 + track.as_mut().unwrap().artist_id = Some(metadata.artist_id); 61 + } 62 + } 63 + Ok(track) 38 64 } 39 65 40 66 async fn get_file_position(&self, ctx: &Context<'_>) -> Result<i32, Error> {
+1 -1
crates/rpc/src/playback.rs
··· 99 99 ) -> Result<tonic::Response<StatusResponse>, tonic::Status> { 100 100 let response = self 101 101 .client 102 - .get(&format!("{}/audio_status", rockbox_url())) 102 + .get(&format!("{}/player/status", rockbox_url())) 103 103 .send() 104 104 .await 105 105 .map_err(|e| tonic::Status::internal(e.to_string()))?
+1 -1
webui/rockbox/codegen.ts
··· 2 2 3 3 const config: CodegenConfig = { 4 4 schema: "http://127.0.0.1:6062/graphql", 5 - documents: ["src/**/*.tsx"], 5 + documents: ["src/**/*.tsx", "src/**/*.ts"], 6 6 ignoreNoDocuments: true, // for better experience with the watcher 7 7 generates: { 8 8 "src/Hooks/GraphQL.tsx": {
+2 -10
webui/rockbox/src/Components/ControlBar/ControlBar.tsx
··· 8 8 import CurrentTrack from "./CurrentTrack"; 9 9 import RightMenu from "./RightMenu"; 10 10 import Pause from "../Icons/Pause"; 11 + import { CurrentTrack as Track } from "../../Types/track"; 11 12 12 13 export type ControlBarProps = { 13 - nowPlaying?: { 14 - album?: string; 15 - artist?: string; 16 - title?: string; 17 - cover?: string; 18 - duration: number; 19 - progress: number; 20 - isPlaying?: boolean; 21 - albumId?: string; 22 - }; 14 + nowPlaying?: Track; 23 15 onPlay: () => void; 24 16 onPause: () => void; 25 17 onNext: () => void;
+43 -16
webui/rockbox/src/Components/ControlBar/ControlBarWithData.tsx
··· 1 - import { FC } from "react"; 1 + import { FC, useEffect, useState } from "react"; 2 2 import ControlBar from "./ControlBar"; 3 + import { 4 + useGetCurrentTrackQuery, 5 + useGetPlaybackStatusQuery, 6 + useNextMutation, 7 + usePauseMutation, 8 + usePreviousMutation, 9 + useResumeMutation, 10 + } from "../../Hooks/GraphQL"; 11 + import { CurrentTrack } from "../../Types/track"; 3 12 4 13 const ControlBarWithData: FC = () => { 14 + const [nowPlaying, setNowPlaying] = useState<CurrentTrack | undefined>( 15 + undefined 16 + ); 17 + const { data, loading } = useGetCurrentTrackQuery(); 18 + const { data: playback } = useGetPlaybackStatusQuery(); 19 + const [pause] = usePauseMutation(); 20 + const [resume] = useResumeMutation(); 21 + const [previous] = usePreviousMutation(); 22 + const [next] = useNextMutation(); 23 + 24 + useEffect(() => { 25 + if (loading || !data) { 26 + return; 27 + } 28 + 29 + setNowPlaying({ 30 + album: data.currentTrack?.album, 31 + artist: data.currentTrack?.artist, 32 + title: data.currentTrack?.title, 33 + cover: data.currentTrack?.albumArt 34 + ? `http://localhost:6062/covers/${data.currentTrack?.albumArt}` 35 + : "", 36 + duration: data.currentTrack?.length || 0, 37 + progress: data.currentTrack?.elapsed || 0, 38 + isPlaying: playback?.status === 1, 39 + albumId: data.currentTrack?.albumId, 40 + }); 41 + }, [data, loading, playback]); 5 42 return ( 6 43 <ControlBar 7 - nowPlaying={{ 8 - album: "Pluto x Baby Pluto (Deluxe)", 9 - artist: "Future, Lil Uzi Vert", 10 - title: "Drankin N Smokin", 11 - cover: 12 - "https://resources.tidal.com/images/fe6787d5/4ba5/4d3e/8576/48943ee6a768/320x320.jpg", 13 - duration: 255488.00659179688, 14 - progress: 123456.789, 15 - isPlaying: true, 16 - albumId: "229251493", 17 - }} 18 - onPlay={() => {}} 19 - onPause={() => {}} 20 - onNext={() => {}} 21 - onPrevious={() => {}} 44 + nowPlaying={nowPlaying} 45 + onPlay={() => resume()} 46 + onPause={() => pause()} 47 + onNext={() => next()} 48 + onPrevious={() => previous()} 22 49 onShuffle={() => {}} 23 50 onRepeat={() => {}} 24 51 />
webui/rockbox/src/GraphQL/Browse/Query.tsx webui/rockbox/src/GraphQL/Browse/Query.ts
webui/rockbox/src/GraphQL/Library/Query.tsx webui/rockbox/src/GraphQL/Library/Query.ts
webui/rockbox/src/GraphQL/Playback/.gitkeep

This is a binary file and will not be displayed.

+31
webui/rockbox/src/GraphQL/Playback/Mutation.ts
··· 1 + import { gql } from "@apollo/client"; 2 + 3 + export const PLAY = gql` 4 + mutation Play($elapsed: Int!, $offset: Int!) { 5 + play(elapsed: $elapsed, offset: $offset) 6 + } 7 + `; 8 + 9 + export const PAUSE = gql` 10 + mutation Pause { 11 + pause 12 + } 13 + `; 14 + 15 + export const RESUME = gql` 16 + mutation Resume { 17 + resume 18 + } 19 + `; 20 + 21 + export const PREVIOUS = gql` 22 + mutation Previous { 23 + previous 24 + } 25 + `; 26 + 27 + export const NEXT = gql` 28 + mutation Next { 29 + next 30 + } 31 + `;
+42
webui/rockbox/src/GraphQL/Playback/Query.ts
··· 1 + import { gql } from "@apollo/client"; 2 + 3 + export const GET_CURRENT_TRACK = gql` 4 + query GetCurrentTrack { 5 + currentTrack { 6 + id 7 + title 8 + artist 9 + album 10 + albumArt 11 + artistId 12 + albumId 13 + elapsed 14 + length 15 + year 16 + yearString 17 + } 18 + } 19 + `; 20 + 21 + export const GET_NEXT_TRACK = gql` 22 + query GetNextTrack { 23 + nextTrack { 24 + id 25 + title 26 + artist 27 + album 28 + albumArt 29 + artistId 30 + albumId 31 + length 32 + year 33 + yearString 34 + } 35 + } 36 + `; 37 + 38 + export const GET_PLAYBACK_STATUS = gql` 39 + query GetPlaybackStatus { 40 + status 41 + } 42 + `;
webui/rockbox/src/GraphQL/System/Query.tsx webui/rockbox/src/GraphQL/System/Query.ts
+329
webui/rockbox/src/Hooks/GraphQL.tsx
··· 476 476 477 477 export type GetAlbumQuery = { __typename?: 'Query', album?: { __typename?: 'Album', id: string, title: string, artist: string, albumArt?: string | null, year: number, yearString: string, artistId: string, md5: string, tracks: Array<{ __typename?: 'Track', id?: string | null, title: string, tracknum: number, artist: string, album: string, discnum: number, albumArtist: string, artistId?: string | null, albumId?: string | null, path: string, length: number }> } | null }; 478 478 479 + export type PlayMutationVariables = Exact<{ 480 + elapsed: Scalars['Int']['input']; 481 + offset: Scalars['Int']['input']; 482 + }>; 483 + 484 + 485 + export type PlayMutation = { __typename?: 'Mutation', play: string }; 486 + 487 + export type PauseMutationVariables = Exact<{ [key: string]: never; }>; 488 + 489 + 490 + export type PauseMutation = { __typename?: 'Mutation', pause: string }; 491 + 492 + export type ResumeMutationVariables = Exact<{ [key: string]: never; }>; 493 + 494 + 495 + export type ResumeMutation = { __typename?: 'Mutation', resume: string }; 496 + 497 + export type PreviousMutationVariables = Exact<{ [key: string]: never; }>; 498 + 499 + 500 + export type PreviousMutation = { __typename?: 'Mutation', previous: string }; 501 + 502 + export type NextMutationVariables = Exact<{ [key: string]: never; }>; 503 + 504 + 505 + export type NextMutation = { __typename?: 'Mutation', next: string }; 506 + 507 + export type GetCurrentTrackQueryVariables = Exact<{ [key: string]: never; }>; 508 + 509 + 510 + export type GetCurrentTrackQuery = { __typename?: 'Query', currentTrack?: { __typename?: 'Track', id?: string | null, title: string, artist: string, album: string, albumArt?: string | null, artistId?: string | null, albumId?: string | null, elapsed: number, length: number, year: number, yearString: string } | null }; 511 + 512 + export type GetNextTrackQueryVariables = Exact<{ [key: string]: never; }>; 513 + 514 + 515 + export type GetNextTrackQuery = { __typename?: 'Query', nextTrack?: { __typename?: 'Track', id?: string | null, title: string, artist: string, album: string, albumArt?: string | null, artistId?: string | null, albumId?: string | null, length: number, year: number, yearString: string } | null }; 516 + 517 + export type GetPlaybackStatusQueryVariables = Exact<{ [key: string]: never; }>; 518 + 519 + 520 + export type GetPlaybackStatusQuery = { __typename?: 'Query', status: number }; 521 + 479 522 export type GetRockboxVersionQueryVariables = Exact<{ [key: string]: never; }>; 480 523 481 524 ··· 794 837 export type GetAlbumLazyQueryHookResult = ReturnType<typeof useGetAlbumLazyQuery>; 795 838 export type GetAlbumSuspenseQueryHookResult = ReturnType<typeof useGetAlbumSuspenseQuery>; 796 839 export type GetAlbumQueryResult = Apollo.QueryResult<GetAlbumQuery, GetAlbumQueryVariables>; 840 + export const PlayDocument = gql` 841 + mutation Play($elapsed: Int!, $offset: Int!) { 842 + play(elapsed: $elapsed, offset: $offset) 843 + } 844 + `; 845 + export type PlayMutationFn = Apollo.MutationFunction<PlayMutation, PlayMutationVariables>; 846 + 847 + /** 848 + * __usePlayMutation__ 849 + * 850 + * To run a mutation, you first call `usePlayMutation` within a React component and pass it any options that fit your needs. 851 + * When your component renders, `usePlayMutation` returns a tuple that includes: 852 + * - A mutate function that you can call at any time to execute the mutation 853 + * - An object with fields that represent the current status of the mutation's execution 854 + * 855 + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; 856 + * 857 + * @example 858 + * const [playMutation, { data, loading, error }] = usePlayMutation({ 859 + * variables: { 860 + * elapsed: // value for 'elapsed' 861 + * offset: // value for 'offset' 862 + * }, 863 + * }); 864 + */ 865 + export function usePlayMutation(baseOptions?: Apollo.MutationHookOptions<PlayMutation, PlayMutationVariables>) { 866 + const options = {...defaultOptions, ...baseOptions} 867 + return Apollo.useMutation<PlayMutation, PlayMutationVariables>(PlayDocument, options); 868 + } 869 + export type PlayMutationHookResult = ReturnType<typeof usePlayMutation>; 870 + export type PlayMutationResult = Apollo.MutationResult<PlayMutation>; 871 + export type PlayMutationOptions = Apollo.BaseMutationOptions<PlayMutation, PlayMutationVariables>; 872 + export const PauseDocument = gql` 873 + mutation Pause { 874 + pause 875 + } 876 + `; 877 + export type PauseMutationFn = Apollo.MutationFunction<PauseMutation, PauseMutationVariables>; 878 + 879 + /** 880 + * __usePauseMutation__ 881 + * 882 + * To run a mutation, you first call `usePauseMutation` within a React component and pass it any options that fit your needs. 883 + * When your component renders, `usePauseMutation` returns a tuple that includes: 884 + * - A mutate function that you can call at any time to execute the mutation 885 + * - An object with fields that represent the current status of the mutation's execution 886 + * 887 + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; 888 + * 889 + * @example 890 + * const [pauseMutation, { data, loading, error }] = usePauseMutation({ 891 + * variables: { 892 + * }, 893 + * }); 894 + */ 895 + export function usePauseMutation(baseOptions?: Apollo.MutationHookOptions<PauseMutation, PauseMutationVariables>) { 896 + const options = {...defaultOptions, ...baseOptions} 897 + return Apollo.useMutation<PauseMutation, PauseMutationVariables>(PauseDocument, options); 898 + } 899 + export type PauseMutationHookResult = ReturnType<typeof usePauseMutation>; 900 + export type PauseMutationResult = Apollo.MutationResult<PauseMutation>; 901 + export type PauseMutationOptions = Apollo.BaseMutationOptions<PauseMutation, PauseMutationVariables>; 902 + export const ResumeDocument = gql` 903 + mutation Resume { 904 + resume 905 + } 906 + `; 907 + export type ResumeMutationFn = Apollo.MutationFunction<ResumeMutation, ResumeMutationVariables>; 908 + 909 + /** 910 + * __useResumeMutation__ 911 + * 912 + * To run a mutation, you first call `useResumeMutation` within a React component and pass it any options that fit your needs. 913 + * When your component renders, `useResumeMutation` returns a tuple that includes: 914 + * - A mutate function that you can call at any time to execute the mutation 915 + * - An object with fields that represent the current status of the mutation's execution 916 + * 917 + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; 918 + * 919 + * @example 920 + * const [resumeMutation, { data, loading, error }] = useResumeMutation({ 921 + * variables: { 922 + * }, 923 + * }); 924 + */ 925 + export function useResumeMutation(baseOptions?: Apollo.MutationHookOptions<ResumeMutation, ResumeMutationVariables>) { 926 + const options = {...defaultOptions, ...baseOptions} 927 + return Apollo.useMutation<ResumeMutation, ResumeMutationVariables>(ResumeDocument, options); 928 + } 929 + export type ResumeMutationHookResult = ReturnType<typeof useResumeMutation>; 930 + export type ResumeMutationResult = Apollo.MutationResult<ResumeMutation>; 931 + export type ResumeMutationOptions = Apollo.BaseMutationOptions<ResumeMutation, ResumeMutationVariables>; 932 + export const PreviousDocument = gql` 933 + mutation Previous { 934 + previous 935 + } 936 + `; 937 + export type PreviousMutationFn = Apollo.MutationFunction<PreviousMutation, PreviousMutationVariables>; 938 + 939 + /** 940 + * __usePreviousMutation__ 941 + * 942 + * To run a mutation, you first call `usePreviousMutation` within a React component and pass it any options that fit your needs. 943 + * When your component renders, `usePreviousMutation` returns a tuple that includes: 944 + * - A mutate function that you can call at any time to execute the mutation 945 + * - An object with fields that represent the current status of the mutation's execution 946 + * 947 + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; 948 + * 949 + * @example 950 + * const [previousMutation, { data, loading, error }] = usePreviousMutation({ 951 + * variables: { 952 + * }, 953 + * }); 954 + */ 955 + export function usePreviousMutation(baseOptions?: Apollo.MutationHookOptions<PreviousMutation, PreviousMutationVariables>) { 956 + const options = {...defaultOptions, ...baseOptions} 957 + return Apollo.useMutation<PreviousMutation, PreviousMutationVariables>(PreviousDocument, options); 958 + } 959 + export type PreviousMutationHookResult = ReturnType<typeof usePreviousMutation>; 960 + export type PreviousMutationResult = Apollo.MutationResult<PreviousMutation>; 961 + export type PreviousMutationOptions = Apollo.BaseMutationOptions<PreviousMutation, PreviousMutationVariables>; 962 + export const NextDocument = gql` 963 + mutation Next { 964 + next 965 + } 966 + `; 967 + export type NextMutationFn = Apollo.MutationFunction<NextMutation, NextMutationVariables>; 968 + 969 + /** 970 + * __useNextMutation__ 971 + * 972 + * To run a mutation, you first call `useNextMutation` within a React component and pass it any options that fit your needs. 973 + * When your component renders, `useNextMutation` returns a tuple that includes: 974 + * - A mutate function that you can call at any time to execute the mutation 975 + * - An object with fields that represent the current status of the mutation's execution 976 + * 977 + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; 978 + * 979 + * @example 980 + * const [nextMutation, { data, loading, error }] = useNextMutation({ 981 + * variables: { 982 + * }, 983 + * }); 984 + */ 985 + export function useNextMutation(baseOptions?: Apollo.MutationHookOptions<NextMutation, NextMutationVariables>) { 986 + const options = {...defaultOptions, ...baseOptions} 987 + return Apollo.useMutation<NextMutation, NextMutationVariables>(NextDocument, options); 988 + } 989 + export type NextMutationHookResult = ReturnType<typeof useNextMutation>; 990 + export type NextMutationResult = Apollo.MutationResult<NextMutation>; 991 + export type NextMutationOptions = Apollo.BaseMutationOptions<NextMutation, NextMutationVariables>; 992 + export const GetCurrentTrackDocument = gql` 993 + query GetCurrentTrack { 994 + currentTrack { 995 + id 996 + title 997 + artist 998 + album 999 + albumArt 1000 + artistId 1001 + albumId 1002 + elapsed 1003 + length 1004 + year 1005 + yearString 1006 + } 1007 + } 1008 + `; 1009 + 1010 + /** 1011 + * __useGetCurrentTrackQuery__ 1012 + * 1013 + * To run a query within a React component, call `useGetCurrentTrackQuery` and pass it any options that fit your needs. 1014 + * When your component renders, `useGetCurrentTrackQuery` returns an object from Apollo Client that contains loading, error, and data properties 1015 + * you can use to render your UI. 1016 + * 1017 + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; 1018 + * 1019 + * @example 1020 + * const { data, loading, error } = useGetCurrentTrackQuery({ 1021 + * variables: { 1022 + * }, 1023 + * }); 1024 + */ 1025 + export function useGetCurrentTrackQuery(baseOptions?: Apollo.QueryHookOptions<GetCurrentTrackQuery, GetCurrentTrackQueryVariables>) { 1026 + const options = {...defaultOptions, ...baseOptions} 1027 + return Apollo.useQuery<GetCurrentTrackQuery, GetCurrentTrackQueryVariables>(GetCurrentTrackDocument, options); 1028 + } 1029 + export function useGetCurrentTrackLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetCurrentTrackQuery, GetCurrentTrackQueryVariables>) { 1030 + const options = {...defaultOptions, ...baseOptions} 1031 + return Apollo.useLazyQuery<GetCurrentTrackQuery, GetCurrentTrackQueryVariables>(GetCurrentTrackDocument, options); 1032 + } 1033 + export function useGetCurrentTrackSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<GetCurrentTrackQuery, GetCurrentTrackQueryVariables>) { 1034 + const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} 1035 + return Apollo.useSuspenseQuery<GetCurrentTrackQuery, GetCurrentTrackQueryVariables>(GetCurrentTrackDocument, options); 1036 + } 1037 + export type GetCurrentTrackQueryHookResult = ReturnType<typeof useGetCurrentTrackQuery>; 1038 + export type GetCurrentTrackLazyQueryHookResult = ReturnType<typeof useGetCurrentTrackLazyQuery>; 1039 + export type GetCurrentTrackSuspenseQueryHookResult = ReturnType<typeof useGetCurrentTrackSuspenseQuery>; 1040 + export type GetCurrentTrackQueryResult = Apollo.QueryResult<GetCurrentTrackQuery, GetCurrentTrackQueryVariables>; 1041 + export const GetNextTrackDocument = gql` 1042 + query GetNextTrack { 1043 + nextTrack { 1044 + id 1045 + title 1046 + artist 1047 + album 1048 + albumArt 1049 + artistId 1050 + albumId 1051 + length 1052 + year 1053 + yearString 1054 + } 1055 + } 1056 + `; 1057 + 1058 + /** 1059 + * __useGetNextTrackQuery__ 1060 + * 1061 + * To run a query within a React component, call `useGetNextTrackQuery` and pass it any options that fit your needs. 1062 + * When your component renders, `useGetNextTrackQuery` returns an object from Apollo Client that contains loading, error, and data properties 1063 + * you can use to render your UI. 1064 + * 1065 + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; 1066 + * 1067 + * @example 1068 + * const { data, loading, error } = useGetNextTrackQuery({ 1069 + * variables: { 1070 + * }, 1071 + * }); 1072 + */ 1073 + export function useGetNextTrackQuery(baseOptions?: Apollo.QueryHookOptions<GetNextTrackQuery, GetNextTrackQueryVariables>) { 1074 + const options = {...defaultOptions, ...baseOptions} 1075 + return Apollo.useQuery<GetNextTrackQuery, GetNextTrackQueryVariables>(GetNextTrackDocument, options); 1076 + } 1077 + export function useGetNextTrackLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetNextTrackQuery, GetNextTrackQueryVariables>) { 1078 + const options = {...defaultOptions, ...baseOptions} 1079 + return Apollo.useLazyQuery<GetNextTrackQuery, GetNextTrackQueryVariables>(GetNextTrackDocument, options); 1080 + } 1081 + export function useGetNextTrackSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<GetNextTrackQuery, GetNextTrackQueryVariables>) { 1082 + const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} 1083 + return Apollo.useSuspenseQuery<GetNextTrackQuery, GetNextTrackQueryVariables>(GetNextTrackDocument, options); 1084 + } 1085 + export type GetNextTrackQueryHookResult = ReturnType<typeof useGetNextTrackQuery>; 1086 + export type GetNextTrackLazyQueryHookResult = ReturnType<typeof useGetNextTrackLazyQuery>; 1087 + export type GetNextTrackSuspenseQueryHookResult = ReturnType<typeof useGetNextTrackSuspenseQuery>; 1088 + export type GetNextTrackQueryResult = Apollo.QueryResult<GetNextTrackQuery, GetNextTrackQueryVariables>; 1089 + export const GetPlaybackStatusDocument = gql` 1090 + query GetPlaybackStatus { 1091 + status 1092 + } 1093 + `; 1094 + 1095 + /** 1096 + * __useGetPlaybackStatusQuery__ 1097 + * 1098 + * To run a query within a React component, call `useGetPlaybackStatusQuery` and pass it any options that fit your needs. 1099 + * When your component renders, `useGetPlaybackStatusQuery` returns an object from Apollo Client that contains loading, error, and data properties 1100 + * you can use to render your UI. 1101 + * 1102 + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; 1103 + * 1104 + * @example 1105 + * const { data, loading, error } = useGetPlaybackStatusQuery({ 1106 + * variables: { 1107 + * }, 1108 + * }); 1109 + */ 1110 + export function useGetPlaybackStatusQuery(baseOptions?: Apollo.QueryHookOptions<GetPlaybackStatusQuery, GetPlaybackStatusQueryVariables>) { 1111 + const options = {...defaultOptions, ...baseOptions} 1112 + return Apollo.useQuery<GetPlaybackStatusQuery, GetPlaybackStatusQueryVariables>(GetPlaybackStatusDocument, options); 1113 + } 1114 + export function useGetPlaybackStatusLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetPlaybackStatusQuery, GetPlaybackStatusQueryVariables>) { 1115 + const options = {...defaultOptions, ...baseOptions} 1116 + return Apollo.useLazyQuery<GetPlaybackStatusQuery, GetPlaybackStatusQueryVariables>(GetPlaybackStatusDocument, options); 1117 + } 1118 + export function useGetPlaybackStatusSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<GetPlaybackStatusQuery, GetPlaybackStatusQueryVariables>) { 1119 + const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} 1120 + return Apollo.useSuspenseQuery<GetPlaybackStatusQuery, GetPlaybackStatusQueryVariables>(GetPlaybackStatusDocument, options); 1121 + } 1122 + export type GetPlaybackStatusQueryHookResult = ReturnType<typeof useGetPlaybackStatusQuery>; 1123 + export type GetPlaybackStatusLazyQueryHookResult = ReturnType<typeof useGetPlaybackStatusLazyQuery>; 1124 + export type GetPlaybackStatusSuspenseQueryHookResult = ReturnType<typeof useGetPlaybackStatusSuspenseQuery>; 1125 + export type GetPlaybackStatusQueryResult = Apollo.QueryResult<GetPlaybackStatusQuery, GetPlaybackStatusQueryVariables>; 797 1126 export const GetRockboxVersionDocument = gql` 798 1127 query GetRockboxVersion { 799 1128 rockboxVersion
+13
webui/rockbox/src/Types/track.ts
··· 11 11 artistId?: string; 12 12 discnum?: number; 13 13 }; 14 + 15 + export type CurrentTrack = { 16 + id?: string; 17 + album?: string; 18 + artist?: string; 19 + title?: string; 20 + cover?: string; 21 + duration: number; 22 + progress: number; 23 + isPlaying?: boolean; 24 + albumId?: string | null; 25 + artistId?: string | null; 26 + };