DePhoegon

Audio RIP & Video Sort

Feb 17th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.17 KB | None | 0 0
  1. @echo off
  2. mode con: cols=75 lines=15
  3. :: setting window size to minimize space taken
  4. set vext=111
  5. :: vext set to control value
  6. set aext=.wav
  7. set tep=.ctmp
  8. set resolve=C:\Users\kphoe\Documents\
  9. set in=D:\Resolve\In\Sort\
  10. set ain=D:\Resolve\audacity projects\In\
  11. set atmp=%ain:~0, -3%%tep%\
  12. :: -3 = the number of characters, & having the temp folder next to the import, rather then inside it.
  13. :: Can use alternate path. Recommend Same partition for moving speed.
  14. set RIP=C:\ffmpeg\bin\ffmpeg -hide_banner -loglevel quiet -stats -i
  15. set RIPaug=-vn -acodec copy
  16. set avc=0
  17.  
  18. if NOT EXIST "%atmp%" ( mkdir "%atmp%" )
  19. :: Creating of Temp Folder for audio
  20. if EXIST "%in%*%tep%" ( del "%in%*%tep%" )
  21. if EXIST "%atmp%*%aext%" ( del "%atmp%*%aext%" )
  22. :: Deleting Temp files That should have been deleted on prior runs
  23.  
  24. :LOOP
  25. if %vext%==.mp4 ( set vext=done )
  26. if %vext%==.avi ( set vext=.mp4 )
  27. if %vext%==111 ( set vext=.avi )
  28. if %vext%==done goto :eof
  29. :: Fixed Order, Last video Format going on top, to prevent skipping of entire loops
  30. :: Looping setup for multiple video types
  31.  
  32. for %%a in (%resolve%*%vext%) do (
  33. @title = Audio Ripper and Video Mover - Running %vext%
  34. call :AVC "%%a" "%%~na"
  35. )
  36. goto :LOOP
  37. :: Calling AVC Label, with aurguemnts to pass on full path w/ file, & file name.  will pass Quote marks
  38. :: Corrected Fatal Error with having a comment for loop, causing an exception.
  39. :: Goes to LOOP & changes the video file extension.
  40.  
  41. :AVC
  42. set filef=%1
  43. set filen=%2
  44. if EXIST "%ain%%filen:~1,-1%%aext%" goto :PRECOPY
  45. :: Checks for the audio rip, uses character choping to remove the quotes from the variable.
  46. @title = Ripping Audio from %filen% into Temp folder - Running %vext%
  47. %RIP% %filef% %RIPaug% "%atmp%%filen:~1,-1%%aext%"
  48. @title = Moving Audio from Temp folder - Running %vext%
  49. move "%atmp%%filen:~1,-1%%aext%" "%ain%
  50. cls
  51. goto :COPY
  52.  
  53. :PRECOPY
  54. :: If audio file rip was found (using same name)
  55. @title = Duplicate Audio Detected - Running %vext%
  56. if NOT EXIST "%resolve%DuplicateAUDIO.txt" echo Duplicates > "%resolve%DuplicateAUDIO.txt"
  57. echo %ain%%filen:~1,-1%%aext% >> "%resolve%DuplicateAUDIO.txt"
  58.  
  59. :COPY
  60. if EXIST "%in%%filen:~1,-1%%vext%" goto :POSTCOPY
  61. @title = Copying Video into Destination - Running %vext%
  62. esentutl /y %filef% /d "%in%%filen:~1,-1%%tep%"
  63. :: 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.
  64. :: Using an meaningless file extension to catch failed renames/interupted copies.  (renaming is exceptionally fast after copy)
  65. rename "%in%%filen:~1,-1%%tep%" "%filen:~1,-1%%vext%"
  66. @title = Removing source video - Running %vext%
  67. del /f /q %filef%
  68. cls
  69. goto :eof
  70.  
  71. :POSTCOPY
  72. ::If Video file with same name was found in destination
  73. @title = Duplicate Video Detected - Running %vext%
  74. if NOT EXIST "%resolve%DuplicateVIDEO.txt" echo Duplicates > "%resolve%DuplicateVIDEO.txt"
  75. echo %in%%filen:~1,-1%%vext% >> "%resolve%DuplicateVIDEO.txt"
  76. goto :eof
  77. :: Cleaned up, sized window & ensured switching file formats (tested avi to mp4)
Add Comment
Please, Sign In to add comment