DePhoegon icon

Audio RIP & Video Sort

DePhoegon | PRO | 02/17/20 11:07:28 AM UTC | 0 ⭐ | 458 👁️ | Never ⏰ | []
Batch |

3.17 KB

|

None

|

0 👍

/

0 👎

@echo off
mode con: cols=75 lines=15
:: setting window size to minimize space taken
set vext=111
:: vext set to control value
set aext=.wav
set tep=.ctmp
set resolve=C:\Users\kphoe\Documents\
set in=D:\Resolve\In\Sort\
set ain=D:\Resolve\audacity projects\In\
set atmp=%ain:~0, -3%%tep%\
:: -3 = the number of characters, & having the temp folder next to the import, rather then inside it.
:: Can use alternate path. Recommend Same partition for moving speed.
set RIP=C:\ffmpeg\bin\ffmpeg -hide_banner -loglevel quiet -stats -i
set RIPaug=-vn -acodec copy
set avc=0
 
if NOT EXIST "%atmp%" ( mkdir "%atmp%" )
:: Creating of Temp Folder for audio
if EXIST "%in%*%tep%" ( del "%in%*%tep%" )
if EXIST "%atmp%*%aext%" ( del "%atmp%*%aext%" )
:: Deleting Temp files That should have been deleted on prior runs
 
:LOOP
if %vext%==.mp4 ( set vext=done )
if %vext%==.avi ( set vext=.mp4 )
if %vext%==111 ( set vext=.avi )
if %vext%==done goto :eof
:: Fixed Order, Last video Format going on top, to prevent skipping of entire loops
:: Looping setup for multiple video types
 
for %%a in (%resolve%*%vext%) do (
@title = Audio Ripper and Video Mover - Running %vext%
call :AVC "%%a" "%%~na"
)
goto :LOOP
:: Calling AVC Label, with aurguemnts to pass on full path w/ file, & file name.  will pass Quote marks
:: Corrected Fatal Error with having a comment for loop, causing an exception.
:: Goes to LOOP & changes the video file extension.
 
:AVC
set filef=%1
set filen=%2
if EXIST "%ain%%filen:~1,-1%%aext%" goto :PRECOPY
:: Checks for the audio rip, uses character choping to remove the quotes from the variable.
@title = Ripping Audio from %filen% into Temp folder - Running %vext%
%RIP% %filef% %RIPaug% "%atmp%%filen:~1,-1%%aext%"
@title = Moving Audio from Temp folder - Running %vext%
move "%atmp%%filen:~1,-1%%aext%" "%ain%
cls
goto :COPY
 
:PRECOPY
:: If audio file rip was found (using same name)
@title = Duplicate Audio Detected - Running %vext%
if NOT EXIST "%resolve%DuplicateAUDIO.txt" echo Duplicates > "%resolve%DuplicateAUDIO.txt"
echo %ain%%filen:~1,-1%%aext% >> "%resolve%DuplicateAUDIO.txt"
 
:COPY
if EXIST "%in%%filen:~1,-1%%vext%" goto :POSTCOPY
@title = Copying Video into Destination - Running %vext%
esentutl /y %filef% /d "%in%%filen:~1,-1%%tep%"
:: Extensible Storage Engine Utilities for Microsoft(R) Windows(R) - provides good feedback & is great for a single file copy (similar to how this is used), allowing for exceptionally large files to be moved & feedback given, while taking up the same visual footprint a the smaller files.
:: Using an meaningless file extension to catch failed renames/interupted copies.  (renaming is exceptionally fast after copy)
rename "%in%%filen:~1,-1%%tep%" "%filen:~1,-1%%vext%"
@title = Removing source video - Running %vext%
del /f /q %filef%
cls
goto :eof
 
:POSTCOPY
::If Video file with same name was found in destination
@title = Duplicate Video Detected - Running %vext%
if NOT EXIST "%resolve%DuplicateVIDEO.txt" echo Duplicates > "%resolve%DuplicateVIDEO.txt"
echo %in%%filen:~1,-1%%vext% >> "%resolve%DuplicateVIDEO.txt"
goto :eof
:: Cleaned up, sized window & ensured switching file formats (tested avi to mp4)

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎