From b21947af2e468e53ba0d67bd9859b8c618238973 Mon Sep 17 00:00:00 2001 From: Shiloh Fen Date: Tue, 24 Jun 2025 03:25:17 -0500 Subject: [PATCH] lyricfetch: Add basic file count to statusbar Signed-off-by: Shiloh Fen --- scripts/lyricfetch.nu | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/lyricfetch.nu b/scripts/lyricfetch.nu index 989e94b..eb8f11c 100755 --- a/scripts/lyricfetch.nu +++ b/scripts/lyricfetch.nu @@ -33,7 +33,8 @@ def main [ print "Indexing compatible files in library" let files = fd -g '*.flac' $library | lines - print $"(ansi blue)($files | length)(ansi reset) compatible files found" + let files_count = $files | length + print $"(ansi blue)($files_count)(ansi reset) compatible files found" if $clear { print "Clearing all lyrics from library" @@ -45,10 +46,13 @@ def main [ mut autosave = 0 - for file in $files { + for file in ($files | enumerate) { $autosave += 1 if $minimal_screen {print (ansi clear_entire_screen) ; print (ansi cursor_home)} + let index = $file.index + let file = $file.item + log debug "Performing database operations" let this = if $file in $db { $db | get $file @@ -89,7 +93,7 @@ def main [ } if not $minimal_screen {print} - print $"<- Fetching lyrics for (ansi green)($meta.artist) – ($meta.title)(ansi reset) ->" + print $"<- Fetching lyrics for (ansi green)($meta.artist) – ($meta.title)(ansi reset) \((ansi cyan)($index)(ansi reset)/(ansi purple)($files_count)(ansi reset)\) ->" fetch-lyrics dumb --instance $dumb_instance $meta.artist $meta.title | if $in == null { print $"(ansi red)No lyrics found for (ansi yellow)($meta.artist) – ($meta.title)(ansi reset)" -- 2.51.2