Skip to content

Commit 4b1b0b3

Browse files
authored
feat: check PlaySpecificList text field for variables (#57)
1 parent 2d0f38d commit 4b1b0b3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: src/helpers.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export async function SeekPosition(
205205
export async function PlaySpecificList(
206206
instance: SpotifyInstanceBase,
207207
deviceId: string,
208-
context_uri: string,
208+
raw_uri: string,
209209
behavior: 'return' | 'resume' | 'force',
210210
attempt = 0
211211
): Promise<void> {
@@ -215,25 +215,25 @@ export async function PlaySpecificList(
215215
try {
216216
if (behavior !== 'force') {
217217
const data = await getMyCurrentPlaybackState(reqOptions)
218-
if (data.body?.context?.uri === context_uri) {
218+
if (data.body?.context?.uri === raw_uri) {
219219
if (behavior == 'return' || (behavior == 'resume' && data.body.is_playing)) {
220-
instance.log('warn', `Already playing that ${context_uri}`)
220+
instance.log('warn', `Already playing that ${raw_uri}`)
221221
} else if (behavior == 'resume') {
222222
await play(reqOptions, { deviceId })
223223
}
224224

225225
return
226226
}
227227
}
228-
228+
const context_uri = await instance.parseVariablesInString(raw_uri)
229229
await play(reqOptions, {
230230
deviceId,
231231
context_uri,
232232
})
233233
} catch (err) {
234234
const retry = await instance.checkIfApiErrorShouldRetry(err)
235235
if (retry && attempt <= MAX_ATTEMPTS) {
236-
return PlaySpecificList(instance, deviceId, context_uri, behavior, attempt + 1)
236+
return PlaySpecificList(instance, deviceId, raw_uri, behavior, attempt + 1)
237237
} else {
238238
throw err
239239
}

0 commit comments

Comments
 (0)