Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/api/spotify/playlists/[playlistId]/tracks/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ async function getPlaylistTracks(
images: track.album.images,
},
duration_ms: track.duration_ms,
duration: track.duration_ms, // Legacy fallback
uri: track.uri,
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ describe('GET /api/spotify/playlists/[playlistId]/tracks', () => {
name: 'Album 1',
},
duration_ms: 180000,
duration: 180000,
uri: 'spotify:track:t1',
})
})
Expand Down
19 changes: 3 additions & 16 deletions utils/socketManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ExtWebSocket,
HrmInputMessage,
} from '../types/websocket'
import { HrmStreamData, SpotifyCommandParameters } from '../types/core'
import { HrmStreamData } from '../types/core'
import {
MAX_CALORIE_JUMP_PER_UPDATE,
MAX_INITIAL_CALORIES,
Expand Down Expand Up @@ -426,22 +426,9 @@ const handleIncomingMessage = (
)

const spotifyService = services.spotifyService
const spotifyCommandParams: SpotifyCommandParameters = {}
if (commandMsg.deviceId)
spotifyCommandParams.deviceId = commandMsg.deviceId
if (commandMsg.volume !== undefined)
spotifyCommandParams.volume = commandMsg.volume
if (commandMsg.playlistUri)
spotifyCommandParams.playlistUri = commandMsg.playlistUri
if (commandMsg.contextUri)
spotifyCommandParams.contextUri = commandMsg.contextUri
if (commandMsg.uri) spotifyCommandParams.uri = commandMsg.uri
if (commandMsg.offset) {
spotifyCommandParams.offset =
commandMsg.offset as SpotifyCommandParameters['offset']
}
const { type: _type, command, ...spotifyCommandParams } = commandMsg

spotifyService.handleCommand(commandMsg.command, spotifyCommandParams)
spotifyService.handleCommand(command, spotifyCommandParams)
break
}
default: {
Expand Down
Loading