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

update import path for createHash and improve code formatting in sync script

+13 -13
+13 -13
apps/api/src/scripts/sync.ts
··· 1 1 import { equals } from "@xata.io/client"; 2 2 import chalk from "chalk"; 3 3 import { ctx } from "context"; 4 - import { createHash } from "crypto"; 4 + import { createHash } from "node:crypto"; 5 5 import { publishScrobble } from "nowplaying/nowplaying.service"; 6 6 7 7 const args = process.argv.slice(2); ··· 14 14 }) 15 15 .getPaginated({ 16 16 pagination: { 17 - size: process.env.SYNC_SIZE ? parseInt(process.env.SYNC_SIZE) : 20, 17 + size: process.env.SYNC_SIZE ? parseInt(process.env.SYNC_SIZE, 10) : 20, 18 18 }, 19 19 sort: [{ xata_createdat: "desc" }], 20 20 }); ··· 25 25 equals( 26 26 createHash("sha256") 27 27 .update( 28 - `${track.title} - ${track.artist} - ${track.album}`.toLowerCase(), 28 + `${track.title} - ${track.artist} - ${track.album}`.toLowerCase() 29 29 ) 30 - .digest("hex"), 31 - ), 30 + .digest("hex") 31 + ) 32 32 ) 33 33 .getFirst(); 34 34 ··· 40 40 equals( 41 41 createHash("sha256") 42 42 .update(`${track.album} - ${track.album_artist}`.toLowerCase()) 43 - .digest("hex"), 44 - ), 43 + .digest("hex") 44 + ) 45 45 ) 46 46 .getFirst(); 47 47 if (album) { ··· 59 59 equals( 60 60 createHash("sha256") 61 61 .update(track.album_artist.toLowerCase()) 62 - .digest("hex"), 63 - ), 62 + .digest("hex") 63 + ) 64 64 ) 65 65 .getFirst(); 66 66 if (artist) { ··· 76 76 equals( 77 77 createHash("sha256") 78 78 .update(`${track.album} - ${track.album_artist}`.toLowerCase()) 79 - .digest("hex"), 80 - ), 79 + .digest("hex") 80 + ) 81 81 ) 82 82 .getFirst(); 83 83 ··· 89 89 equals( 90 90 createHash("sha256") 91 91 .update(track.album_artist.toLowerCase()) 92 - .digest("hex"), 93 - ), 92 + .digest("hex") 93 + ) 94 94 ) 95 95 .getFirst(); 96 96 if (artist) {