Modify my code below to add one more option to just get album cover without downloading…
- User
Modify my code below to add one more option to just get album cover without downloading the music file.
@echo off :menu echo. echo Select an option: echo 1. Download individual song ... "artist - title" echo 2. Download Entire Album ...... "trackNo title" echo 3. Start over echo 4. Quit set /p choice="Enter your choice: "
if "%choice%"=="1" goto option1 if "%choice%"=="2" goto option2 if "%choice%"=="3" goto start_over if "%choice%"=="4" exit
echo Invalid choice, please try again. goto menu
:option1 cls set /p URL="Enter YouTube URL: " :: Remove everything after "&si=" for /F "tokens=1 delims=&" %%A in ("%URL%") do set CLEAN_URL=%%A
echo Cleaned URL: %CLEAN_URL% ECHO :: Step 1: Download audio as M4A and the thumbnail yt-dlp --embed-metadata --parse-metadata "artist:%%(artist)s" --parse-metadata "title:%%(title)s" --parse-metadata "album:%%(album)s" -o "%%(artist)s - %%(title)s.%%(ext)s" --write-thumbnail -f 140 %CLEAN_URL%
::yt-dlp --write-thumbnail --skip-download %CLEAN_URL% ECHO :: Step 2: Processing the thumbnail for %%f in (*.webp) do ( magick "%%f" -gravity center -crop 720x720+0+0 +repage "cover.jpg" AtomicParsley "%%~nf.m4a" --artwork "cover.jpg" --overWrite del "%%f" cover.jpg )
goto menu
:option2 set /p URL="Enter YouTube URL: " :: Remove everything after "&si=" for /F "tokens=1 delims=&" %%A in ("%URL%") do set CLEAN_URL=%%A
echo Cleaned URL: %CLEAN_URL% ECHO download entire album yt-dlp --embed-metadata --parse-metadata "title:%%(title)s" --parse-metadata "artist:%%(artist)s" --parse-metadata "album:%%(album)s" -o "%%(playlist_index)s %%(title)s.%%(ext)s" --embed-thumbnail -f 140 %CLEAN_URL%
for %%f in (*.webp) do ( magick "%%f" -gravity center -crop 720x720+0+0 +repage "%%~nf.jpg" AtomicParsley "%%~nf.m4a" --artwork "%%~nf.jpg" --overWrite del "%%f" "%%~nf.jpg" ) goto menu
:start_over goto menu
:quit exit
Assistant
Here's the modified code with an additional option (5) to download only the album cover art without the music file:
@echo off :menu echo. echo Select an option: echo 1. Download individual song ... "artist - title" echo 2. Download Entire Album ...... "trackNo title" echo 3. Download Album Cover Only .. "cover.jpg" echo 4. Start over echo 5. Quit set /p choice="Enter your choice: " if "%choice%"=="1" goto option1 if "%choice%"=="2" goto option2 if "%choice%"=="3" goto option3 if "%choice%"=="4" goto start_over if "%choice%"=="5" exit echo Invalid choice, please try again. goto menu :option1 cls set /p URL="Enter YouTube URL: " :: Remove everything after "&si=" for /F "tokens=1 delims=&" %%A in ("%URL%") do set CLEAN_URL=%%A echo Cleaned URL: %CLEAN_URL% ECHO :: Step 1: Download audio as M4A and the thumbnail yt-dlp --embed-metadata --parse-metadata "artist:%%(artist)s" --parse-metadata "title:%%(title)s" --parse-metadata "album:%%(album)s" -o "%%(artist)s - %%(title)s.%%(ext)s" --write-thumbnail -f 140 %CLEAN_URL% ::yt-dlp --write-thumbnail --skip-download %CLEAN_URL% ECHO :: Step 2: Processing the thumbnail for %%f in (*.webp) do ( magick "%%f" -gravity center -crop 720x720+0+0 +repage "cover.jpg" AtomicParsley "%%~nf.m4a" --artwork "cover.jpg" --overWrite del "%%f" cover.jpg ) goto menu :option2 set /p URL="Enter YouTube URL: " :: Remove everything after "&si=" for /F "tokens=1 delims=&" %%A in ("%URL%") do set CLEAN_URL=%%A echo Cleaned URL: %CLEAN_URL% ECHO download entire album yt-dlp --embed-metadata --parse-metadata "title:%%(title)s" --parse-metadata "artist:%%(artist)s" --parse-metadata "album:%%(album)s" -o "%%(playlist_index)s %%(title)s.%%(ext)s" --embed-thumbnail -f 140 %CLEAN_URL% for %%f in (*.webp) do ( magick "%%f" -gravity center -crop 720x720+0+0 +repage "%%~nf.jpg" AtomicParsley "%%~nf.m4a" --artwork "%%~nf.jpg" --overWrite del "%%f" "%%~nf.jpg" ) goto menu :option3 set /p URL="Enter YouTube URL: " :: Remove everything after "&si=" for /F "tokens=1 delims=&" %%A in ("%URL%") do set CLEAN_URL=%%A echo Cleaned URL: %CLEAN_URL% ECHO :: Downloading thumbnail only yt-dlp --write-thumbnail --skip-download -f 140 %CLEAN_URL% for %%f in (*.webp) do ( magick "%%f" -gravity center -crop 720x720+0+0 +repage "cover.jpg" del "%%f" echo Album cover saved as "cover.jpg" ) goto menu :start_over cls goto menu :quit exitWhat's changed:
- Added a new option
3. Download Album Cover Only .. "cover.jpg"to the menu. - Created a new label
:option3to handle this new choice. - In
:option3, we're usingyt-dlpwith the--write-thumbnailand--skip-downloadoptions to download only the thumbnail (album cover art) without the audio file. - We're still processing the
.webpimage usingmagickto crop and resize it to 720x720 pixels, and saving it ascover.jpg. - Removed the unnecessary
AtomicParsleycommand since we're not embedding the artwork into an audio file. - Added a success message
echo Album cover saved as "cover.jpg"to let the user know the operation is complete. - Renumbered the original options
3and4to4and5, respectively, to accommodate the new option.
Now, when you select option
3, it will download only the album cover art from the provided YouTube URL and save it ascover.jpgin the current directory. Enjoy!- Added a new option
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.