Cemu Version Archiver

Discussion in 'Computer Programming, Emulation, and Game Modding' started by MarioMasta64, Jul 26, 2017.

  1. MarioMasta64
    OP

    MarioMasta64 hi. i make batch stuff and portable shiz

    Member
    1,890
    408
    Dec 21, 2016
    United States
    i needed to find cemu archives
    so i was searching everywhere
    i found a link on reddit to 1.5.1
    it worked
    i wondered: will every version work
    i started downloading them manually then got tired
    so i decided to make a script
    i then added my automatic version detector code to find the latest release
    itll match each release link against the last one. once the last one is downloaded it stops.
    if it exists in .\extra\ (it will only be moved after download) itll skip it
    if it exists in root itll delete it then redownload it (since it hasnt been moved its incomplete)
    its very simple

    filename: cemu_archiver.bat
    Code:
    @echo off
    cls
    Color 0A
    
    set /a cycle1=0
    set /a cycle2=0
    set /a cycle3=-1
    
    if not exist .\extra\ mkdir .\extra\
    for /f "delims=" %%i in ('dir /b /s /a-d ^| findstr /i "cemu_*.zip"') do del "%%~i"
    
    if exist index.html del index.html
    wget.exe -q --show-progress http://cemu.info/
    if not exist index.html goto Start-Cemu
    for /f tokens^=2delims^=^" %%A in (
      'findstr /i /c:"http://cemu.info/releases/" /c:"http://cemu.info/releases/" index.html'
    ) Do > cemu_link.txt Echo:%%A
    set /p cemu_link=<cemu_link.txt
    if exist cemu_link.txt del cemu_link.txt
    if exist index.html del index.html
    
    :loop
    set /a cycle3+=1
    if %cycle3%==10 set /a cycle3=0 & set /a cycle2+=1
    if %cycle2%==10 set /a cycle2=0 & set /a cycle1+=1
    if %cycle1%==10 set /a cycle1=0 & echo done archiving & pause & exit
    call :download
    goto loop
    
    :download
    title Downloading http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip - Cemu Archiver - By MarioMasta64
    if exist cemu_%cycle1%.%cycle2%.%cycle3%.zip del /s /q cemu_%cycle1%.%cycle2%.%cycle3%.zip >nul
    if exist .\extra\cemu_%cycle1%.%cycle2%.%cycle3%.zip echo http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip is already archived
    if not exist .\extra\cemu_%cycle1%.%cycle2%.%cycle3%.zip wget.exe -q --show-progress http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip
    if exist cemu_%cycle1%.%cycle2%.%cycle3%.zip move cemu_%cycle1%.%cycle2%.%cycle3%.zip .\extra\cemu_%cycle1%.%cycle2%.%cycle3%.zip >nul
    if "http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip"=="%cemu_link%" echo done archiving & pause >nul & exit
    (goto) 2>nul
    requires wget.exe beside it
    wget.exe can be downloaded from: https://eternallybored.org/misc/wget/
     
    Last edited by MarioMasta64, Jul 26, 2017
  2. MarioMasta64
    OP

    MarioMasta64 hi. i make batch stuff and portable shiz

    Member
    1,890
    408
    Dec 21, 2016
    United States
    update (added changelog archiving):

    Code:
    @echo off
    cls
    Color 0A
    
    set /a cycle1=0
    set /a cycle2=0
    set /a cycle3=-1
    
    if not exist .\extra\ mkdir .\extra\
    for /f "delims=" %%i in ('dir /b /s /a-d ^| findstr /i "cemu_*.zip"') do del "%%~i"
    
    if exist index.html del index.html
    wget.exe -q --show-progress http://cemu.info/
    if not exist index.html goto Start-Cemu
    for /f tokens^=2delims^=^" %%A in (
      'findstr /i /c:"http://cemu.info/releases/" /c:"http://cemu.info/releases/" index.html'
    ) Do > cemu_link.txt Echo:%%A
    set /p cemu_link=<cemu_link.txt
    if exist cemu_link.txt del cemu_link.txt
    if exist index.html del index.html
    
    :loop
    set /a cycle3+=1
    if %cycle3%==10 set /a cycle3=0 & set /a cycle2+=1
    if %cycle2%==10 set /a cycle2=0 & set /a cycle1+=1
    if %cycle1%==10 set /a cycle1=0 & echo done archiving & pause & exit
    call :download
    goto loop
    
    :download
    title Downloading http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip - Cemu Archiver - By MarioMasta64
    if exist cemu_%cycle1%.%cycle2%.%cycle3%.zip del /s /q cemu_%cycle1%.%cycle2%.%cycle3%.zip >nul
    if exist .\extra\cemu_%cycle1%.%cycle2%.%cycle3%.zip echo http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip is already archived
    if not exist .\extra\cemu_%cycle1%.%cycle2%.%cycle3%.zip wget.exe -q --show-progress http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip
    if not exist .\extra\cemu_%cycle1%.%cycle2%.%cycle3%.zip wget.exe -q --show-progress http://cemu.info/changelog/cemu_%cycle1%_%cycle2%_%cycle3%.txt
    if exist cemu_%cycle1%.%cycle2%.%cycle3%.zip move cemu_%cycle1%.%cycle2%.%cycle3%.zip .\extra\cemu_%cycle1%.%cycle2%.%cycle3%.zip >nul
    if exist cemu_%cycle1%_%cycle2%_%cycle3%.txt move cemu_%cycle1%_%cycle2%_%cycle3%.txt .\extra\cemu_%cycle1%_%cycle2%_%cycle3%.txt >nul
    if "http://cemu.info/releases/cemu_%cycle1%.%cycle2%.%cycle3%.zip"=="%cemu_link%" echo done archiving & pause >nul & exit
    (goto) 2>nul
     
    Last edited by MarioMasta64, Aug 28, 2017