Advertisement
Guest User

Manga Raw and Sub Merger

a guest
Mar 1st, 2014
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. @echo off
  2. setlocal enableextensions enabledelayedexpansion
  3. echo ####################
  4. echo #Raw and Sub Merger#
  5. echo ####################
  6. echo.
  7. echo This batch file was created to merge a Manga with a translation overlay.
  8. echo.
  9. echo Known limitations include:
  10. echo All file names should be in the form of Manga[RAW].zip, Manga[SUB].zip and the output will be Manga.zip.
  11. echo The actual name has to match but need not be case sensitive in Windows.
  12. echo Subfolders within the zip file will probably not work.
  13. echo All image file names have to match for them to merge.
  14. echo Any image missing a matching overlay will probably cause an error.
  15. echo The files can use any compression method compatible with 7zip but the name needs to end in .zip.
  16. echo This batch file requies 7zip and ImageMagick installed to work.
  17. echo If 7zip fails, make sure you have the correct version (64 bit for 64 bit) installed for your OS and that it's in the %programfiles% folder.
  18. echo This has only been tested on Windows 7. Probably will not work for anything older than Win 2k.
  19. echo.
  20. set /P file_name="Enter the name of the manga you want merged or enter all to attempt to merge all manga in this folder: "
  21. IF /I "%file_name%"=="quit" (goto BatchEnd)
  22. IF /I "%file_name%"=="exit" (goto BatchEnd)
  23. IF /I "%file_name%"=="ALL" (
  24. call:MergeFolder
  25. ) ELSE (
  26. call:SubMerge %file_name%[RAW] %file_name%[SUB] %file_name%
  27. )
  28. pause
  29. goto BatchEnd
  30.  
  31. ::##############
  32. ::#Merge Folder#
  33. ::##############
  34.  
  35. :MergeFolder
  36. for %%b in (*.zip) do (
  37. call:CheckName %%~nb
  38. )
  39. goto:eof
  40.  
  41. :CheckName
  42. set str1=%1
  43. if /I not "x%str1:[RAW]=%"=="x%str1%" call:SubMerge %str1% %str1:[RAW]=[SUB]% %str1:[RAW]=%
  44. goto:eof
  45.  
  46. ::################
  47. ::#Merge Function#
  48. ::################
  49.  
  50. :SubMerge
  51. set PATH=%PATH%;%programfiles%\7-Zip\
  52. set RAW=%CD%\Raw
  53. set SUB=%CD%\Sub
  54. set MRG=%CD%\%~3
  55. md "%MRG%"
  56. echo Extracting %~1.zip ...
  57. echo.
  58. 7z e %~1.zip -o"%RAW%"
  59. echo Extracting %~2.zip ...
  60. echo.
  61. 7z e %~2.zip -o"%SUB%"
  62. echo Merging files ...
  63. echo.
  64. cd Raw
  65. for %%a in (*.png) do convert "%RAW%\%%a" "%SUB%\%%a" -composite "%MRG%\%%a"
  66. cd ..
  67. echo Creating archive ...
  68. echo.
  69. 7z a -tzip %~3.zip "%MRG%"
  70. echo Cleaning up ...
  71. echo.
  72. rmdir /s /q "%RAW%"
  73. rmdir /s /q "%SUB%"
  74. rmdir /s /q "%MRG%"
  75. echo Done.
  76. goto:eof
  77.  
  78. :BatchEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement