Advertisement
Guest User

mrlss-SUD-v1b9.bat

a guest
Jun 25th, 2011
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 6.08 KB | None | 0 0
  1. @ECHO OFF
  2.  
  3. REM ----------- mrlss-SUD-v1b9.bat
  4. REM ----------- movie release sorter - Sort/Unrar/Delete - version 1 build 9
  5. REM ----------- sabnzbd - post-processing-script (windows)
  6. REM
  7. REM ----------- description: - checks for nfo file
  8. REM ------------------------ - creates sample, subs, proof and/or ac3 subfolders
  9. REM ------------------------ - moves files and/or RARs to its subfolders
  10. REM ------------------------ - extracts movie file/s to the main dir
  11. REM ------------------------ - deletes rar files and other stuff in main dir
  12. REM ------------------------ - get a nice report and status line at the end
  13. REM
  14. REM -- usage: - CHANGE "G:" TO YOUR HD-LETTER WHERE SABNZBD-DOWNLOAD-FOLDER IS LOCATED!
  15. REM ---------
  16. REM --------- - ADJUST THE WinRAR-INSTALL-PATH "%programfiles%\WinRAR\"
  17. REM --------- - FOR 64bit WIN VISTA/7 YOU CAN USE "%ProgramFiles(x86)%"
  18. REM ---------
  19. REM --------- - SAVE CHANGES! xD
  20. REM ---------
  21. REM --------- - GO TO SABNZBD CONFIG, MAKE A NEW CATEGORY, CHOOSE "+REPAIR"!!!,
  22. REM --------- - CHOOSE mrlss-SUD-v1b9.bat FROM SCRIPT FOLDER AND SAVE,
  23. REM --------- - USE THE NEW CATEGORY WHEN ADDING NZBS FROM MOVIE RELEASES. HF!
  24. REM
  25. REM ----------------- info: - use this script at your own risk (errors might occur)!
  26. REM ----------------------- - checkout sabnzbd forums and help to improve if u like! ;)
  27.  
  28. SetLocal EnableDelayedExpansion
  29.  
  30. :MAIN
  31.  
  32. REM ------------------------- adjust letter to your hard-drive here!!!
  33.  
  34. G:
  35. cd %1
  36.  
  37. REM variables for report at the end
  38. set nfovar=0
  39. set samplevar=0
  40. set proofvar=0
  41. set subsvar=0
  42. set ac3var=0
  43. set status=%7
  44. REM variables to delete old format rars later on
  45. FOR /L %%t IN (0,1,9) DO (
  46.     set num=%%t
  47.     if exist "*.rar" set rar=rar
  48.     if exist "*.r0!num!" set rar=r0x
  49. )
  50. FOR /L %%t IN (10,1,99) DO (
  51.     set num=%%t
  52.     if exist "*.r!num!" set rar=rxx
  53. )
  54.  
  55. REM checking for/printing jobname, nfo, sample, proof, subs and ac3addon
  56. REM if available creating subfolders and moving files
  57. REM subs and ac3addon files wont be extracted this way
  58. :RLS
  59. echo.
  60. echo Release....: %3
  61.  
  62. :NFO
  63. echo.
  64. if exist *.nfo echo NFO........: Yes & set nfovar=1 & goto SAMPLE
  65. echo NFO........: No
  66.  
  67. :SAMPLE
  68. echo.
  69. if exist *sample*.* echo Sample.....: Yes & goto sam1
  70. echo Sample.....: No
  71. goto PROOF
  72. :sam1
  73. set samplevar=1
  74. mkdir Sample >NUL 2>&1
  75. move *sample*.* Sample >NUL 2>&1
  76. :PROOF
  77. if exist *proof*.* echo Proof......: Yes & goto proof1
  78. echo Proof......: No
  79. goto SUBS
  80. :proof1
  81. set proofvar=1
  82. mkdir Proof >NUL 2>&1  
  83. move *proof*.* Proof >NUL 2>&1
  84. :SUBS
  85. if exist *subs*.* echo Subs.......: Yes & goto subs1
  86. echo Subs.......: No
  87. goto AC3
  88. :subs1
  89. set subsvar=1
  90. mkdir Subs >NUL 2>&1
  91. move *subs*.* Subs >NUL 2>&1
  92. :AC3
  93. if exist *ac3*.* echo AC3-Addon..: Yes & goto ac31
  94. echo AC3-Addon..: No
  95. goto RARFINDER
  96. :ac31
  97. set ac3var=1
  98. mkdir AC3 >NUL 2>&1
  99. move *ac3*.* AC3 >NUL 2>&1
  100.  
  101. :RARFINDER
  102. REM checks for rars in main dir for extraction
  103. if exist "*.rar" goto WINRARXP
  104. goto TRASH1
  105.  
  106. :WINRARXP
  107. REM ---------------------adjust the path to your winrar installation path here!!!
  108.  
  109. set path="%programfiles%\WinRAR\";%path%
  110. set directory=%1
  111. set location=%1
  112.  
  113. :RARTYPE
  114. REM big jump to another extraction procedure if rars are named/parted the normal way
  115. if exist "*.part1.rar" goto EXTR2
  116. if exist "*.part01.rar" goto EXTR2
  117. if exist "*.part001.rar" goto EXTR2
  118.  
  119.  
  120. :EXTR1
  121. REM calling extraction procedure for old format rars r00 etc
  122. pushd %directory%
  123. for /F %%i in ('dir /b *.rar') do call :DOEX1 "%%i"
  124. popd
  125.  
  126. :TRASH1
  127. REM deletes old format rars and other files in main dir as listed
  128. FOR /L %%t IN (0,1,9) DO (
  129.     set num=%%t
  130.     if exist "*.r0!num!" del "*.r0!num!"
  131. )
  132. FOR /L %%t IN (10,1,99) DO (
  133.     set num=%%t
  134.     if exist "*.r!num!" del "*.r!num!"
  135. )
  136. if exist "*.rar" del "*.rar" 2>nul
  137. if exist "*.sfv" del "*.sfv" 2>NUL
  138. if exist "*.nzb" del "*.nzb" 2>NUL
  139. if exist "*.par2" del "*.par2" 2>NUL
  140. if exist "*.url" del "*.url" 2>NUL
  141. if exist "*.txt" del "*.txt" 2>NUL
  142. if exist "*.1" del "*.1" 2>NUL
  143. if exist "*(1)" del "*(1)" 2>NUL
  144.  
  145. :REPORT1
  146. REM checks sabnzbd post process status 0 means ok
  147. if %status% EQU 0 goto NFOT1
  148. echo Post-Process-Error -SR-
  149. goto eof
  150.  
  151. :NFOT1
  152. REM cumulates the number of subfolders which were created and prints out the last line of report
  153. echo.
  154. set /a Summe=%samplevar%+%proofvar%+%subsvar%+%ac3var%
  155. if %nfovar% EQU 0 echo Script-Status: OK --- ( - MOVIE - ) - ( -- %Summe% -- Subfolder/s ) - ( - MiSSiNG NFO - )
  156. if %nfovar% EQU 1 echo Script-Status: OK --- ( - MOVIE - ) - ( -- %Summe% -- Subfolder/s ) - ( + NFO + )
  157.  
  158. goto eof
  159.  
  160. :DOEX1
  161. echo.
  162. echo.
  163. echo %time% Extracting archive %1...
  164. echo.
  165. unrar.exe e %1 %location%
  166. echo.
  167. echo.
  168. echo %time% Extraction complete.
  169. echo.
  170. echo.
  171. if %status% EQU 0 echo Post-Process-Status: OK -E1-
  172. if not %status% EQU 0 echo Post-Process-Error -E1-
  173. goto eof
  174.  
  175.  
  176. :EXTR2
  177. REM extraction procedure for rars named/parted the normal way ..the rest is the same as written before!
  178. pushd %directory%
  179. for /F %%i in ('dir /b *.part1.rar;*.part01.rar;*.part001.rar') do call :DOEX2 "%%i"
  180. popd
  181.  
  182. :TRASH2
  183. FOR /L %%t IN (0,1,9) DO (
  184.     set num=%%t
  185.     if exist "*.r0!num!" del "*.r0!num!"
  186. )
  187. FOR /L %%t IN (10,1,99) DO (
  188.     set num=%%t
  189.     if exist "*.r!num!" del "*.r!num!"
  190. )
  191. if exist "*.rar" del "*.rar" 2>nul
  192. if exist "*.sfv" del "*.sfv" 2>NUL
  193. if exist "*.nzb" del "*.nzb" 2>NUL
  194. if exist "*.par2" del "*.par2" 2>NUL
  195. if exist "*.url" del "*.url" 2>NUL
  196. if exist "*.txt" del "*.txt" 2>NUL
  197. if exist "*.1" del "*.1" 2>NUL
  198. if exist "*(1)" del "*(1)" 2>NUL
  199.  
  200. :REPORT2
  201. if %status% EQU 0 goto NFOT2
  202. echo Post-Process-Error -SR-
  203. goto eof
  204.  
  205. :NFOT2
  206. echo.
  207. set /a Summe=%samplevar%+%proofvar%+%subsvar%+%ac3var%
  208. if %nfovar% EQU 0 echo Script-Status: OK --- ( - MOVIE - ) - ( -- %Summe% -- Subfolder/s ) - ( - MiSSiNG NFO - )
  209. if %nfovar% EQU 1 echo Script-Status: OK --- ( - MOVIE - ) - ( -- %Summe% -- Subfolder/s ) - ( + NFO + )
  210.  
  211. goto eof
  212.  
  213. :DOEX2
  214. echo.
  215. echo.
  216. echo %time% Extracting archive %1...
  217. echo.
  218. unrar.exe e %1 %location%
  219. echo.
  220. echo.
  221. echo %time% Extraction complete.
  222. echo.
  223. echo.
  224. if %status% EQU 0 echo Post-Process-Status: OK -E2-
  225. if not %status% EQU 0 echo Post-Process-Error -E2-
  226.  
  227. :eof
  228. ENDLOCAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement