I guess I should've checked the forum first, but I too made a upload batch file with curl. Perhaps you guys could link to one in the download section? Thats where I looked.
What can mine do:
- Upload data from CharacterProfiler, GroupCalendar and PvPLog
- compress with gzip
- update the saved signatures
- nice progress bar from curl
What it can't do:
- I don't have passwords, so I didn't implement them
Edit: Fixed gzip issue.
So, if anyone is interested, here it comes:
- Code: Select all
ECHO OFF
ECHO.
ECHO Author: Jakob Lenfers (jakob@drss.de)
ECHO LICENCE: Creative Commons: Attribution-Share Alike 3.0 Unported
ECHO http://creativecommons.org/licenses/by-sa/3.0/
ECHO.
REM Please set the variables according to your environment.
REM You'll need curl from http://curl.haxx.se/ in and set
REM the path accordingly.
REM If you want your uploads to be faster, download gzip
REM from http://gnuwin32.sourceforge.net/packages/gzip.htm and set
REM the path. But thats optional. (only gzip.exe is needed from above
REM package.)
REM ###
REM ### General settings
REM ###
REM url of the roster without http:// and the trailing slash
SET WOWROSTERURL=roster.example.de
REM WoW directory
SET WOW=d:\world of warcraft
REM your WoW username
SET ACCOUNT=WOWUSERNAME
REM directory with curl in it
SET CURL=%ProgramFiles%\curl
REM directory with gzip in it. Optional, leave empty if
REM you don't want compression.
SET GZIP=%ProgramFiles%\gzip
REM do you want the result of your upload in your %TEMP% dir?
REM ("%TEMP%.\%WOWROSTERURL%-output.html")
SET SAVETEMP=FALSE
REM ###
REM ### Updating saved images settings
REM ###
REM Set to TRUE to update saved images. Needs the chars and sigs set up below.
SET SAVEDIMG=FALSE
REM charnames seperated by space, commas or semicolons. The code
REM might need more work for sites with multiple guilds...
SET CHARS=Char1;Char2;Char3
REM The available signatures from your roster, seperated just
REM like the chars with comma, semicolon or space.
SET SIGS=avatar;signature
REM ###
REM ### Other settings, shouldn't need no tweaking
REM ###
REM check curl doku for more info on some settings.
SET SAVEDVARS=%WOW%\wtf\account\%ACCOUNT%\savedvariables
SET STATS=-w "\nTime: %%{time_total}s\nDownloaded: %%{size_download}b (%%{speed_download}b/s)\nUploaded: %%{size_upload}b (%%{speed_upload}b/s)\n\n"
IF X%SAVETEMP%==XTRUE (
SET OUTPUT=-o "%TEMP%.\%WOWROSTERURL%-output.html"
) ELSE (
SET OUTPUT=-o "nul"
)
REM ###
REM ### Code
REM ###
REM check for curl, without it we can't do jack.
IF NOT EXIST "%CURL%\curl.exe" (
ECHO Couldn't find curl.
ECHO Please set up this script by editing it and filling
ECHO out the variables at the top.
pause
exit
)
REM check what extensions are used and can be uploaded
IF EXIST "%SAVEDVARS%\CharacterProfiler.lua" (
ECHO characterProfiler.lua found, uploading character data.
IF NOT "X%GZIP%"==X IF EXIST "%GZIP%" (
"%GZIP%\gzip" -c "%SAVEDVARS%\characterProfiler.lua" > "%SAVEDVARS%\CharacterProfiler.lua.gz" 2> nul
SET FORMS=%FORMS% -F "characterprofiler=@%SAVEDVARS%\characterProfiler.lua.gz"
) ELSE (
SET FORMS=%FORMS% -F "characterprofiler=@%SAVEDVARS%\characterProfiler.lua"
)
)
IF EXIST "%SAVEDVARS%\GroupCalendar.lua" (
ECHO GroupCalendar.lua found, uploading calendar data.
IF NOT "X%GZIP%"==X IF EXIST "%GZIP%" (
"%GZIP%\gzip" -c "%SAVEDVARS%\GroupCalendar.lua" > "%SAVEDVARS%\GroupCalendar.lua.gz" 2> nul
SET FORMS=%FORMS% -F "groupcalendar=@%SAVEDVARS%\GroupCalendar.lua.gz"
) ELSE (
SET FORMS=%FORMS% -F "groupcalendar=@%SAVEDVARS%\GroupCalendar.lua"
)
)
IF EXIST "%SAVEDVARS%\PvPLog.lua" (
ECHO PvPLog.lua found, uploading PvP data.
IF NOT "X%GZIP%"==X IF EXIST "%GZIP%" (
"%GZIP%\gzip" -c "%SAVEDVARS%\PvPLog.lua" > "%SAVEDVARS%\PvPLog.lua.gz" 2> nul
SET FORMS=%FORMS% -F "pvplog=@%SAVEDVARS%\PvPLog.lua.gz"
) ELSE (
SET FORMS=%FORMS% -F "pvplog=@%SAVEDVARS%\PvPLog.lua"
)
)
ECHO.
ECHO Uploading...
"%CURL%\curl.exe" %FORMS% -F "process=process" --progress-bar %OUTPUT% %STATS% "http://%WOWROSTERURL%/index.php?p=update"
ECHO Updating images
IF X%SAVEDIMG%==XTRUE (
FOR %%I IN (%CHARS%) DO (
ECHO Updating saved images for %%I.
FOR %%J IN (%SIGS%) DO (
"%CURL%\curl.exe" -s -o "nul" "http://%WOWROSTERURL%/index.php?p=util-siggen-%%J&etag=0&member=%%I&saveonly=1"
)
)
)
ECHO.
ECHO Cleaning up.
FOR %%I IN (CharacterProfiler;GroupCalendar;PvPLog) DO (
IF EXIST "%SAVEDVARS%\%%I.lua.gz" (
DEL "%SAVEDVARS%\%%I.lua.gz"
)
)
ECHO.
pause
Jakob