Skip to content

Commit

Permalink
Big changes, see description.
Browse files Browse the repository at this point in the history
This new version requires the new VARS.txt version.

- Fixed the script not working properly when there are spaces present in the file path

- Fixed VARS.txt not loading properly in the script

-Added version indicator to the title of every segment so that you know which version you're on
  • Loading branch information
mrblomblo authored Apr 25, 2024
1 parent 726edff commit f582287
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions run.bat
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
@echo OFF

REM Loading of VARS.txt
SETLOCAL EnableDelayedExpansion
set N=^
set CONTENT=
for /f "delims=" %%x in ('type %~dp0EXE\VARS.txt') do set "CONTENT=!CONTENT!%%x!N!"
setlocal enabledelayedexpansion

REM Start of dependency check
title Dependency check
title v2.7: Dependency check

REM Checks if necesssary folders exist and creates them if they don't exist
for %%d in (EXE Downloads Downloads\Audio Downloads\Video Downloads\Music) do (
Expand All @@ -34,11 +29,26 @@ REM End of dependency check

cls

REM Loading of VARS.txt

for /f "usebackq tokens=1,* delims=:" %%A in ("%~dp0EXE\VARS.txt") do (
set "key=%%A"
set "value=%%B"
REM Set the variables to the ones in VARS.txt
if "!key!"=="acodec" set "acodec=!value!"
if "!key!"=="vcodec" set "vcodec=!value!"
if "!key!"=="mcodec" set "mcodec=!value!"
if "!key!"=="aargs" set "aargs=!value!"
if "!key!"=="vargs" set "vargs=!value!"
if "!key!"=="margs" set "margs=!value!"
)

:s

title Enter URL to Download
title v2.7: Enter URL to Download

REM User input for URL

set /p "URL=URL: "

REM Gives the user a warning if the URL input was empty
Expand All @@ -61,7 +71,7 @@ IF NOT "%URL:~0,4%"=="http" IF NOT "%URL:~0,5%"=="https" (

cls

title Enter File Format
title v2.7: Enter File Format

:a

Expand Down Expand Up @@ -94,7 +104,7 @@ goto a

cls

title Downloading...
title v2.7: Downloading...

REM Downloads from the URL input with the file format that the user selected
if "%format%"=="a" %~dp0EXE\yt-dlp.exe -P %~dp0Downloads\Audio %aargs% -f "ba/b" -x --audio-format "mp3" -S acodec:%acodec% --embed-metadata --embed-thumbnail -o "%%(title)s.%%(ext)s" -w %URL% && @echo %date%: Audio - %URL%>>%~dp0log.txt
Expand All @@ -103,7 +113,7 @@ if "%format%"=="m" %~dp0EXE\yt-dlp.exe -P %~dp0Downloads\Music %margs% --sponsor

cls

title Download more?
title v2.7: Download more?

:l

Expand All @@ -130,7 +140,7 @@ goto l

:e
REM Part of the script that the dependency check skips to
title Dependency check
title v2.7: Dependency check
pause

cls
Expand Down

0 comments on commit f582287

Please sign in to comment.