diff --git a/cli/pipeline.ts b/cli/pipeline.ts index 15c8fa1..600504a 100644 --- a/cli/pipeline.ts +++ b/cli/pipeline.ts @@ -7,7 +7,7 @@ import { symbols } from "~/cli/formatter.ts"; import { dim, italic, yellow } from "@std/fmt/colors"; export const DAILY_SCROBBLE_LIMIT: number = 2880; -export const TIMESTAMP_LIMIT = 1_200_960; // ~13.9 days +export const TIMESTAMP_LIMIT = 10209600; // 14 days export type PipelineTrackMeta = ScrobblePayload; @@ -223,7 +223,7 @@ export async function runPipeline( * assigns a quasi-uniformly spaced timestamp to a track with a or date that's either older than 14 days * or missing. * - * t₀ = (now − 13.9 days), with fixed increment Δt = 30 s per track. + * t₀ = (now − 14 days), with fixed increment Δt = 30 s per track. */ export function generateTimestamp(index: number, jitter = 10): number { const t0 = Math.floor(Date.now() / 1_000) - TIMESTAMP_LIMIT; diff --git a/commands/tidy.ts b/commands/tidy.ts index 2b8d793..85dbe45 100644 --- a/commands/tidy.ts +++ b/commands/tidy.ts @@ -8,7 +8,7 @@ import { AppError } from "~/lib/errors.ts"; import { ensureBrowserSession } from "~/browser/session.ts"; import { normaliseArtistMetadata } from "~/api/lotus.ts"; import { deleteScrobble } from "~/browser/lastfm.ts"; -import { sleep } from "~/utils/retry.ts"; +import { sleep, withRetry } from "~/utils/retry.ts"; import { cyan, green, italic, red } from "@std/fmt/colors"; import { TIMESTAMP_LIMIT } from "~/cli/pipeline.ts"; @@ -38,7 +38,7 @@ export async function executeTidyCommand(args: string[]): Promise + deleteScrobble(browser, { + artist: track.artist, + timestamp: track.timestamp!, + track: track.title, + }) + ); if (!deletion.ok) { log.error(` ${dim("fail")} deletion + scrobble(session.value.apiKey, session.value.secret, session.value.sessionKey, { + ...metadata, + timestamp: track.timestamp!, + }) + ); if (!add.ok || !add.value.accepted) { log.error(` ${dim("fail")} resubmission qwq`);