This repository has been archived by the owner on Jun 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlcmp4.bat
61 lines (53 loc) · 1.56 KB
/
vlcmp4.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@echo off
setlocal
set VLC_HOME=C:\PortableApps\PortableApps\VLCPortable\App\vlc
set OUT_PATH=C:\PortableApps\tmp
set OUT_FILE=%OUT_PATH%\vlcmp4-out.mp4
set BAD_LOG=%OUT_PATH%\vlcmp4-bad.log
if [%1]==[/f] (
set FORCE=1
if [%2]==[] (goto USEERR) else (set URL=%2)
if [%3]==[] (goto USEERR) else (set "TITLE=%~3")
) else (
if [%1]==[] (goto USEERR) else (set URL=%1)
if [%2]==[] (goto USEERR) else (set "TITLE=%~2")
if [%3]==[/f] (set FORCE=1) else (set FORCE=0)
)
if [%FORCE%]==[1] (
if exist "%TITLE%.old.mp4" (
del /f "%TITLE%.old.mp4"
)
)
if exist %OUT_FILE% (
del /f %OUT_FILE%
)
if exist "%TITLE%.mp4" (
if exist "%TITLE%.old.mp4" (
echo.
echo ERROR! Cannot run: "%TITLE%.mp4" exists with 1 backup
goto:eof
) else (
echo.
echo WARNING! "%TITLE%.mp4" exists renaming to "%TITLE%.old.mp4"
ren "%TITLE%.mp4" "%TITLE%.old.mp4"
)
)
rem Run VLC...
"%VLC_HOME%\vlc.exe" --qt-start-minimized --no-qt-privacy-ask %URL% :sout=#file{dst=%OUT_FILE:\=\\%,no-overwrite} :sout-all :sout-keep vlc://quit
if exist %OUT_FILE% (
ren %OUT_FILE% "%TITLE%.mp4"
if errorlevel 1 (
echo.
echo ERROR! Cannot rename: "%TITLE%.mp4"
) else (
echo.
echo SUCCESS! Video saved to "%TITLE%.mp4"
)
)
goto:eof
rem -----------------------------------------------------------------
:USEERR
echo.
echo ERROR! Usage: %0 [/f] URL TITLE [/f]
echo /f optional force deletion of existing backup file
goto:eof