From 5f3ac0b45362bb0bc9f6d19fa612bb0449eedda7 Mon Sep 17 00:00:00 2001 From: Nightdavisao Date: Sat, 16 May 2026 15:47:34 -0300 Subject: [PATCH] Implement option to *not* write skip markers when importing CSVs --- cli/csv-runner.ts | 4 ++-- cli/pipeline.ts | 1 + commands/import.ts | 12 ++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cli/csv-runner.ts b/cli/csv-runner.ts index a27f703..eabe33f 100644 --- a/cli/csv-runner.ts +++ b/cli/csv-runner.ts @@ -33,7 +33,7 @@ export async function runCsvPipeline( return runPipeline(pending, { ...opts, - commitSuccess: async ({ lineIndex }) => { + commitSuccess: opts.noSkipMarker ? async ({ lineIndex }) => { const skip = await markSkipped(doc, lineIndex); if (skip.ok) { doc = skip.value; @@ -43,6 +43,6 @@ export async function runCsvPipeline( ); } return skip; - }, + } : void 0, }); } diff --git a/cli/pipeline.ts b/cli/pipeline.ts index a46c5f5..66d7ceb 100644 --- a/cli/pipeline.ts +++ b/cli/pipeline.ts @@ -15,6 +15,7 @@ export interface PipelineOptions { readonly config: Omit, "password">; readonly dryRun?: boolean; readonly delayMs?: number; + readonly noSkipMarker?: boolean; /** * optional callback invoked after a track is successfully scrobbled. diff --git a/commands/import.ts b/commands/import.ts index b755fd9..e7760b1 100644 --- a/commands/import.ts +++ b/commands/import.ts @@ -13,22 +13,25 @@ const HELP_TEXT = ` Usage: scrobkit import [options...] Arguments: - Path to either a .scrobbler.log or .csv file. + Path to either a .scrobbler.log or .csv file. Options: - -n, --dry-run Simulate the import without scrobbling or modifying the file - -h, --help Show this help message + -n, --dry-run Simulate the import without scrobbling or modifying the file + -s, --no-skip-marker Don't mark any track as skipped after importing (doesn't touch the provided file in any way) + -h, --help Show this help message `; export async function executeImportCommand(args: string[] = Deno.args): Promise> { const flags = parseArgs(args, { - boolean: ["dry-run", "help"], + boolean: ["dry-run", "help", "no-skip-marker"], alias: { n: "dry-run", h: "help", + s: "no-skip-marker" }, default: { "dry-run": false, + "no-skip-marker": false }, }); @@ -51,6 +54,7 @@ export async function executeImportCommand(args: string[] = Deno.args): Promise< const opts: PipelineOptions = { config: session.value, dryRun: flags["dry-run"], + noSkipMarker: flags["no-skip-marker"] }; try { -- 2.51.2