Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. color 3f
  4. set releaseDate=29.10.2016
  5. title fastscraper ver. !releaseDate!
  6.  
  7. :scraperEXE
  8. rem Check if scraper.exe is on root folder
  9. if exist scraper.exe goto scraperVersion
  10. echo scraper.exe missing
  11. set /p "download=Do you want to open the URL to download it? [Y/N]: "
  12. if /i "!download!"=="y" start https://github.com/sselph/scraper/releases & goto:eof
  13. if /i "!download!"=="n" goto:eof
  14. echo Incorrect input & goto scraperEXE
  15.  
  16. :scraperVersion
  17. rem Show scraper version
  18. echo scraper.exe's version found: & scraper.exe -version
  19.  
  20. rem Flags - Static parameters
  21. rem If true, add roms that are not found as an empty gamelist entry.
  22. set addNotFound=-add_not_found=false
  23.  
  24. rem Comma separated order to prefer images, s=snapshot, b=boxart, f=fanart, a=banner, l=logo, 3b=3D boxart. (default "b")
  25. set consoleIMG=-console_img="3b,b,s,"
  26.  
  27. rem Comma separated list of extensions to also include in the scraper.
  28. set extraExt=-extra_ext=".scummvm,.ipf,.mx1,.mx2,.exe,.ws,.wsc,.wad"
  29.  
  30. rem jpg or png, the format to write the images. (default "jpg")
  31. set imgFormat=-img_format="jpg"
  32.  
  33. rem The order to choose for language if there is more than one for a value. (en, fr, es, de, pt) (default "en")
  34. set langSS=-lang="de,en"
  35.  
  36. rem The path to use for images in gamelist.xml. (default "images")
  37. set imagePath=-image_path=".\downloaded_images"
  38.  
  39. rem The max width of images. Larger images will be resized. (default 400)
  40. set maxWidth=-max_width=400
  41.  
  42. rem Don't add thumbnails to the gamelist.
  43. set noThumb=-no_thumb=true
  44.  
  45. rem Information will be attempted to be downloaded again but won't remove roms that are not scraped.
  46. set refreshXML=-refresh=false
  47.  
  48. rem The order to choose for region if there is more than one for a value. (us, eu, jp, fr, xx) (default "us,eu,jp,fr,xx")
  49. set regionSS=-region="us,eu,jp,fr,xx"
  50.  
  51. rem Use the hash.csv and theGamesDB metadata. (default true)
  52. set useGDB=-use_gdb=false
  53.  
  54. rem Use the name in the No-Intro DB instead of the one in the GDB. (default true)
  55. set useNoIntroName=-use_nointro_name=true
  56.  
  57. rem Use the OpenVGDB if the hash isn't in hash.csv.
  58. set useOVGDB=-use_ovgdb=false
  59.  
  60. rem Use the ScreenScraper.fr as a datasource.
  61. set useSS=-use_ss=true
  62.  
  63. rem Use N worker threads to process roms. (default 1)
  64. set workersN=-workers=4
  65.  
  66. :systemSelection
  67. rem Select the system to scrape (type "all" to scrape all folders)
  68. set /p "system=Which system(s) do you want to scrape? All? "
  69. if "%system%"=="" echo Incorrect input & goto systemSelection
  70. if /i not "%system%"=="all" goto modeSelection
  71. set "system="
  72. for /f "delims=" %%f in ('dir /b /a:d') do set system=!system! %%f
  73.  
  74. :modeSelection
  75. rem Choose to append an existing (y) or create a new gamelist (n)
  76. if "!refreshXML!"=="-refresh=true" goto fullMode
  77. set /p "appendXML=Would you like to append existing gamelists? [Y/N]: "
  78. if /i "!appendXML!"=="y" goto appendMode
  79. if /i "!appendXML!"=="n" goto fullMode
  80. echo Incorrect input & goto modeSelection
  81.  
  82. :appendMode
  83. set "appendMode=-append" & goto neogeoMode
  84.  
  85. :fullMode
  86. set "appendMode=" & goto neogeoMode
  87.  
  88. :neogeoMode
  89. rem Select source for NeoGeo: mameDB.com (mame-mode) and theGamesDB.net (non-mame mode)
  90. echo %system%|findstr /lic:"neogeo" >nul
  91. if "%errorlevel%"=="0" (
  92. set /p "nonmameMode=Scrape NeoGeo in non-mame mode (use theGamesDB)? [Y/N]: "
  93. if /i "!nonmameMode!"=="y" goto startTime
  94. if /i "!nonmameMode!"=="n" goto startTime
  95. echo Incorrect input & goto neogeoMode
  96. )
  97.  
  98. :startTime
  99. rem Save start time
  100. set startTime=%time%
  101.  
  102. rem ******************** MAIN CODE SECTION
  103.  
  104. for %%i in (%system%) do (
  105.  
  106. rem Check if mame device is selected
  107. rem Comma separated order to prefer images, s=snap, t=title, m=marquee, c=cabinet. (default "t,m,s,c")
  108. set "arcade="
  109. echo %%i|findstr /lic:"fba" >nul && set arcade=-mame -mame_img="s,m,t"
  110. echo %%i|findstr /lic:"fba_libretro" >nul && set arcade=-mame -mame_img="s,m,t"
  111. echo %%i|findstr /lic:"mame" >nul && set arcade=-mame -mame_img="s,m,t"
  112. echo %%i|findstr /lic:"neogeo" >nul && set arcade=-mame -mame_img="s,m,t"
  113.  
  114. rem Change flags if NeoGeo in non-mame mode was selected
  115. rem Comma separated order to prefer images, s=snapshot, b=boxart, f=fanart, a=banner, l=logo, 3b=3D boxart. (default "b")
  116. echo %%i|findstr /lic:"neogeo" >nul && if "!nonmameMode!"=="y" set arcade=-console_img="b,s"
  117.  
  118. if "!arcade!"=="" (
  119. set imageMode=!consoleIMG!
  120. ) else (
  121. set "imageMode="
  122. )
  123.  
  124. echo.
  125. title Scraping %%i...
  126.  
  127. rem Scraping roms
  128. echo Scraping %%i in progress. Please wait...
  129. echo.
  130. scraper.exe !appendMode! !arcade! -rom_dir="%%i" !imagePath! -image_dir="%%i\!imagePath:~15,-1!" -output_file="%%i\gamelist.xml" -missing="%%i\_%%i_missing.txt" !addNotFound! !imageMode! !extraExt! !imgFormat! !langSS! !noThumb! !refreshXML! !regionSS! !maxWidth! !useGDB! !useNoIntroName! !useOVGDB! !useSS! !workersN!
  131. echo.
  132.  
  133. )
  134.  
  135. rem ******************** END MAIN CODE SECTION
  136.  
  137. title fastscraper ver. !releaseDate! - Scraping has finished
  138.  
  139. rem Save finish time
  140. set endTime=%time%
  141.  
  142. rem Change formatting for the start and end times
  143. for /F "tokens=1-4 delims=:.," %%a in ("%startTime%") do (
  144. set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
  145. )
  146.  
  147. for /F "tokens=1-4 delims=:.," %%a in ("%endTime%") do (
  148. set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
  149. )
  150.  
  151. rem Calculate the duration by subtracting values
  152. set /A elapsed=end-start
  153.  
  154. rem Correct if the measurement was in between days (8640000 centisec/day)
  155. if %end% lss %start% set /A elapsed=end-start+8640000
  156.  
  157. rem Format the results for output
  158. set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
  159. if %hh% lss 10 set hh=0%hh%
  160. if %mm% lss 10 set mm=0%mm%
  161. if %ss% lss 10 set ss=0%ss%
  162. if %cc% lss 10 set cc=0%cc%
  163.  
  164. set DURATION=%hh%:%mm%:%ss%,%cc%
  165.  
  166. echo Start : %startTime%
  167. echo Finish : %endTime%
  168. echo ---------------
  169. echo Duration : %DURATION%
  170.  
  171. pause >nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement