@@ -29,7 +29,7 @@ import { PlayerActions } from "./playerSchema.js";
29
29
import registerDebug from "debug" ;
30
30
import { resolveMusicDeviceEntity } from "../devices.js" ;
31
31
import { getUserDevices } from "../endpoints.js" ;
32
- import { getUserDataCompletions } from "../userData.js" ;
32
+ import { addUserDataStrings , getUserDataCompletions } from "../userData.js" ;
33
33
34
34
const debugSpotify = registerDebug ( "typeagent:spotify" ) ;
35
35
@@ -184,6 +184,18 @@ async function validateTrack(
184
184
album : string | undefined ,
185
185
context : IClientContext ,
186
186
) {
187
+ if ( artists === undefined && album === undefined ) {
188
+ const data = context . userData ?. data ;
189
+ if ( data && data . tracks ) {
190
+ if ( data . nameMap === undefined ) {
191
+ addUserDataStrings ( data ) ;
192
+ }
193
+ // if user data has exact match return true
194
+ if ( data . nameMap ! . get ( trackName . toLocaleLowerCase ( ) ) ) {
195
+ return true ;
196
+ }
197
+ }
198
+ }
187
199
const resolvedArtists = artists
188
200
? await resolveArtists ( artists , context )
189
201
: [ ] ;
@@ -254,6 +266,20 @@ async function validateAlbum(
254
266
}
255
267
256
268
async function validateArtist ( artistName : string , context : IClientContext ) {
269
+ // if user data has exact match return true
270
+ const userData = context . userData ;
271
+ if ( userData && userData . data ) {
272
+ const artists = userData . data . artists ;
273
+ if ( artists ) {
274
+ if ( ! userData . data . nameMap ) {
275
+ addUserDataStrings ( userData . data ) ;
276
+ }
277
+ if ( userData . data . nameMap ! . get ( artistName . toLocaleLowerCase ( ) ) ) {
278
+ return true ;
279
+ }
280
+ }
281
+ }
282
+
257
283
const data = await searchArtists ( artistName , context ) ;
258
284
259
285
if ( data && data . artists && data . artists . items . length > 0 ) {
0 commit comments