Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enableDelayedExpansion
- :: script globals
- set url="%1=%2"
- SET me=%~n0.cmd
- goto start_application
- exit /B %errorlevel%
- :start_application
- call :find_ytdl
- if !errorlevel! neq 0 (exit /b 1)
- call :find_ffmpeg
- if !errorlevel! neq 0 (exit /b 1)
- call :echo Trying to get !url!
- youtube-dl --extract-audio --audio-quality 0 --audio-format mp3 --output "%USERPROFILE%\Music\%%(title)s.%%(ext)s" !url!
- goto :eof
- :find_ytdl
- where youtube-dl > nul
- if %errorlevel% neq 0 (
- call :echo Could not locate youtube-dl binary in PATH
- exit /B 1
- ) else (
- call :echo Found youtube-dl^!
- exit /B 0
- )
- exit /B 0
- :find_ffmpeg
- where youtube-dl > nul
- if %errorlevel% neq 0 (
- call :echo Could not locate ffmpeg binary in PATH
- exit /B 1
- ) else (
- call :echo Found ffmpeg^!
- exit /B 0
- )
- exit /B 0
- :echo
- ECHO [47;30m[%me%][0m %*
- EXIT /B 0
- endlocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement