A decentralized music tracking and discovery platform built on AT Protocol 🎵

[api] fix album uri issue

+28 -3
+26 -1
rockskyapi/rocksky-auth/src/nowplaying/nowplaying.service.ts
··· 482 ) 483 ) 484 .getFirst(); 485 - while (!existingTrack?.artist_uri && tries < 30) { 486 console.log( 487 `Artist uri not ready, trying again: ${chalk.magenta(tries + 1)}` 488 ); ··· 518 } 519 } 520 // end update artist uri 521 522 await new Promise((resolve) => setTimeout(resolve, 1000)); 523 tries += 1;
··· 482 ) 483 ) 484 .getFirst(); 485 + 486 + while ( 487 + !existingTrack?.artist_uri && 488 + !existingTrack?.album_uri && 489 + tries < 30 490 + ) { 491 console.log( 492 `Artist uri not ready, trying again: ${chalk.magenta(tries + 1)}` 493 ); ··· 523 } 524 } 525 // end update artist uri 526 + 527 + // start update album uri if it is not set 528 + if (existingTrack && !existingTrack.album_uri) { 529 + const album = await ctx.client.db.albums 530 + .filter( 531 + "sha256", 532 + equals( 533 + createHash("sha256") 534 + .update(`${track.album} - ${track.albumArtist}`.toLowerCase()) 535 + .digest("hex") 536 + ) 537 + ) 538 + .getFirst(); 539 + if (album) { 540 + await ctx.client.db.tracks.update(existingTrack.xata_id, { 541 + album_uri: album.uri, 542 + }); 543 + } 544 + } 545 + // end update album uri 546 547 await new Promise((resolve) => setTimeout(resolve, 1000)); 548 tries += 1;
+2 -2
rockskyweb/src/components/Handle/NowPlaying/NowPlaying.tsx
··· 214 {!!nowPlaying[did]?.artistUri?.split("at://")[1] && ( 215 <Link 216 to={`/${nowPlaying[did]?.artistUri?.split("at://")[1]}`} 217 - className="font-rockford-light text-[rgba(36, 49, 61, 0.65)] font-semibold truncate whitespace-nowrap text-sm" 218 style={{ color: "rgba(36, 49, 61, 0.65)" }} 219 > 220 {nowPlaying[did]?.artist} ··· 222 )} 223 {!nowPlaying[did]?.artistUri?.split("at://")[1] && ( 224 <div 225 - className="font-rockford-light text-[rgba(36, 49, 61, 0.65)] font-semibold truncate whitespace-nowrap text-sm" 226 style={{ 227 color: "rgba(36, 49, 61, 0.65)", 228 }}
··· 214 {!!nowPlaying[did]?.artistUri?.split("at://")[1] && ( 215 <Link 216 to={`/${nowPlaying[did]?.artistUri?.split("at://")[1]}`} 217 + className="text-[rgba(36, 49, 61, 0.65)] font-semibold truncate whitespace-nowrap text-sm" 218 style={{ color: "rgba(36, 49, 61, 0.65)" }} 219 > 220 {nowPlaying[did]?.artist} ··· 222 )} 223 {!nowPlaying[did]?.artistUri?.split("at://")[1] && ( 224 <div 225 + className="text-[rgba(36, 49, 61, 0.65)] font-semibold truncate whitespace-nowrap text-sm" 226 style={{ 227 color: "rgba(36, 49, 61, 0.65)", 228 }}