Skip to content

Commit

Permalink
Fix: Minor mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
LussacZheng committed Sep 7, 2019
1 parent 5d60723 commit 14bd3df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
20 changes: 12 additions & 8 deletions Deploy.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
@rem - Encoding:utf-8; Mode:Batch; Language:zh-CN,en; LineEndings:CRLF -
:: Video Downloaders (You-Get, Youtube-dl, Annie) One-Click Deployment Batch (Windows)
:: Author: Lussac (https://blog.lussac.net)
:: Version: 1.1.2
:: Last updated: 2019-09-02
:: Version: 1.1.3
:: Last updated: 2019-09-07
:: >>> Get updated from: https://github.com/LussacZheng/video-downloader-deploy <<<
:: >>> EDIT AT YOUR OWN RISK. <<<
@echo off
setlocal EnableDelayedExpansion
set version=1.1.2
set lastUpdated=2019-09-02
set version=1.1.3
set lastUpdated=2019-09-07
:: Remote resources url of 'sources.txt', 'wget.exe', '7za.exe'
set "_RemoteRes_=https://raw.githubusercontent.com/LussacZheng/video-downloader-deploy/master/res"


Expand Down Expand Up @@ -74,7 +75,7 @@ echo.&echo %str_opt5%
echo.&echo.
echo ====================================================
set choice=0
set /p choice=%str_please-choose%
set /p choice= %str_please-choose%
echo.
if "%choice%"=="1" goto InitDeploy
if "%choice%"=="11" goto InitDeploy-portable
Expand Down Expand Up @@ -160,7 +161,7 @@ if NOT exist "%anBin%\annie.exe" call :Setup_Annie
:edit-python_pth
cd "%pyBin%"
:: Get the full name of "python3*._pth" -> %py_pth%
for /f "delims=" %%i in ('dir /b python*._pth') do (set py_pth=%%i)
for /f "delims=" %%i in ('dir /b python*._pth') do ( set "py_pth=%%i" )
copy %py_pth% %py_pth%.bak > NUL
type nul > %py_pth%
for /f "delims=" %%i in (%py_pth%.bak) do (
Expand Down Expand Up @@ -214,7 +215,7 @@ cd download
for /f "delims=" %%i in ('dir /b /a:a ffmpeg*.zip') do ( set "ffZip=%%i" )
echo %str_unzipping% %ffZip% ...
7za x %ffZip% > NUL
set ffDir=%ffZip:~0,-4%
set "ffDir=%ffZip:~0,-4%"
move %ffDir% "%root%\usr\ffmpeg" > NUL

:ffmpeg-deploy-ok
Expand Down Expand Up @@ -277,6 +278,7 @@ if "%_isAnLatestVersion%"=="1" (

:: Re-create a pip3.cmd in case of the whole folder had been moved.
set "PATH=%root%\res\command;%pyBin%;%pyBin%\Scripts;%PATH%"
if NOT exist command md command
cd command
echo @"%pyBin%\python.exe" "%pyBin%\Scripts\pip3.exe" %%*> pip3.cmd
REM echo @python.exe ..\..\usr\python-embed\Scripts\pip3.exe %%*> pip3.cmd
Expand Down Expand Up @@ -421,7 +423,7 @@ goto :eof
:InitLog_Common
echo initialized: true> init.log
echo deployMode: %DeployMode%>> init.log
for /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') do set LDT=%%a
for /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') do ( set "LDT=%%a" )
set "formatedDateTime=%LDT:~0,4%-%LDT:~4,2%-%LDT:~6,2% %LDT:~8,2%:%LDT:~10,2%:%LDT:~12,2%"
echo time: %formatedDateTime%>> init.log
::echo time: %date:~0,10% %time:~0,8%>> init.log
Expand Down Expand Up @@ -505,6 +507,7 @@ echo %str_upgrading% youtube-dl...
del /Q download\youtube-dl*.tar.gz >NUL 2>NUL
:: %ydLatestVersion% was set in res\scripts\CheckUpdate.bat :CheckUpdate_youtubedl
set "ydLatestVersion_Url=https://github.com/ytdl-org/youtube-dl/releases/download/%ydLatestVersion%/youtube-dl-%ydLatestVersion%.tar.gz"
echo %ydLatestVersion_Url%>> download\to-be-downloaded.txt
wget -q --show-progress --progress=bar:force:noscroll --no-check-certificate -nc %ydLatestVersion_Url% -P download
rd /S /Q "%ydBin%" >NUL 2>NUL
cd download && call :Setup_YoutubeDL
Expand All @@ -518,6 +521,7 @@ echo %str_upgrading% annie...
del /Q download\annie*.zip >NUL 2>NUL
:: %anLatestVersion% was set in res\scripts\CheckUpdate.bat :CheckUpdate_annie
set "anLatestVersion_Url=https://github.com/iawia002/annie/releases/download/%anLatestVersion%/annie_%anLatestVersion%_Windows_%_SystemType_%-bit.zip"
echo %anLatestVersion_Url%>> download\to-be-downloaded.txt
wget -q --show-progress --progress=bar:force:noscroll --no-check-certificate -nc %anLatestVersion_Url% -P download
del /Q "%anBin%\annie.exe" >NUL 2>NUL
cd download && call :Setup_Annie
Expand Down
2 changes: 1 addition & 1 deletion res/scripts/LanguageSelector.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:: call res\scripts\LanguageSelector.bat
:: Get system language -> %_Language_%

chcp|find "936" >NUL && set "_Language_=zh" || set "_Language_=en"
chcp | find "936" >NUL && set "_Language_=zh" || set "_Language_=en"
goto :eof
::chcp 65001

Expand Down
18 changes: 9 additions & 9 deletions res/scripts/SourcesSelector.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
setlocal EnableDelayedExpansion


set ss_Input=%~1
set ss_Required=%~2
set ss_Region=%~3
set ss_SystemType=%~4
set "ss_Input=%~1"
set "ss_Required=%~2"
set "ss_Region=%~3"
set "ss_SystemType=%~4"
set "ss_Output=download\%ss_Input:.txt=%-%ss_Required%-%ss_Region%.txt"
set "ss_Final=%~5"

Expand All @@ -26,8 +26,8 @@ set "ss_Final=%~5"
:: 0: Nothing to do with next line;
:: 1: Switch on (delete '@' from) the next line.
:: 2: Switch off (add '@' to) the next line.
:: 3: Logical negation. Switch on/off (delete/add '@' from/to) the next line.
:: echo !ss_Temp! | findstr "@">nul && ( set "ss_Temp=!ss_Temp:@ =!") || (set "ss_Temp=!ss_Temp:http=@ http!")
:: 3(Unused now): Logical negation. Switch on/off (delete/add '@' from/to) the next line.
:: echo !ss_Temp! | findstr "@">nul && ( set "ss_Temp=!ss_Temp:@ =!" ) || ( set "ss_Temp=!ss_Temp:http=@ http!" )
:: }

set ss_Tag_required=0
Expand All @@ -51,9 +51,9 @@ for /f "eol=# skip=%ss_SkipLine% delims=" %%i in (%ss_Input%) do (
) else (
set "ss_Temp=%%i"
if !ss_Tag_switch!==1 (
echo !ss_Temp! | findstr "@">nul && ( set "ss_Temp=!ss_Temp:@ =!")
echo !ss_Temp! | findstr "@">nul && ( set "ss_Temp=!ss_Temp:@ =!" )
) else (
echo !ss_Temp! | findstr "@">nul || (set "ss_Temp=!ss_Temp:http=@ http!" )
echo !ss_Temp! | findstr "@">nul || ( set "ss_Temp=!ss_Temp:http=@ http!" )
)
echo !ss_Temp!>> %ss_Output%
set ss_Tag_switch=0
Expand All @@ -67,7 +67,7 @@ for /f "eol=# skip=%ss_SkipLine% delims=" %%i in (%ss_Input%) do (
:: Because "wget.exe" can identify whether a line is pure URL(switched on).
:: This step is just for the convenience of the user.
type nul > %ss_Final%
for /f "delims=" %%i in (' findstr /i /c:" http" %ss_Output%') do (
for /f "delims=" %%i in ('findstr /i /c:" http" %ss_Output%') do (
set "ss_Temp=%%i"
echo !ss_Temp: =!>> %ss_Final%
)
Expand Down

0 comments on commit 14bd3df

Please sign in to comment.