; ISS built by Richard Whidden ; Courtesy of Armchair Airlines Computer Services, Inc. [Code] var PythonFname: String; TwistedFname: String; NewsServerInfo: TInputQueryWizardPage; PythonInfo: TInputOptionWizardPage; procedure isxdl_AddFileSize(URL, Filename: PChar; Size: Cardinal); external 'isxdl_AddFileSize@files:isxdl.dll stdcall'; function isxdl_DownloadFiles(hWnd: Integer): Integer; external 'isxdl_DownloadFiles@files:isxdl.dll stdcall'; function isxdl_SetOption(Option, Value: PChar): Integer; external 'isxdl_SetOption@files:isxdl.dll stdcall'; procedure MakeConfFile; var basedir: string; cf: String; username: string; password: string; begin // Get relevant directory information. basedir := ExpandConstant('{app}\'); StringChangeEx(basedir,'\','\\',True); cf := ExpandConstant(CurrentFileName); // Get the username and password the user typed in... if (NewsServerInfo.Values[2] = '') then begin username := 'None'; password := 'None'; end else begin username := ''''+NewsServerInfo.Values[2]+''''; password := ''''+NewsServerInfo.Values[3]+''''; end; // Build it! SaveStringToFile(cf,'# Hellanzb Configuration' + #13#10,false); SaveStringToFile(cf,'# ----------------------' + #13#10,true); SaveStringToFile(cf,'# This is a barebones configuration that was generated by the install file. For more options,' + #13#10,true); SaveStringToFile(cf,'# please take a look at hellanzb.conf.example in this folder.' + #13#10#13#10,true); SaveStringToFile(cf,'# Prefix...' + #13#10,true); SaveStringToFile(cf,'Hellanzb.PREFIX_DIR = '''+basedir+'''' + #13#10#13#10,true); SaveStringToFile(cf,'# Where to put queued .nzb files' + #13#10,true); SaveStringToFile(cf,'Hellanzb.QUEUE_DIR = Hellanzb.PREFIX_DIR' + #13#10#13#10,true); SaveStringToFile(cf,'# Where the fully processed archives go' + #13#10,true); SaveStringToFile(cf,'Hellanzb.DEST_DIR = Hellanzb.PREFIX_DIR + ''finished\\''' + #13#10#13#10,true); SaveStringToFile(cf,'# The .nzb currently being downloaded is stored here' + #13#10,true); SaveStringToFile(cf,'Hellanzb.CURRENT_DIR = Hellanzb.PREFIX_DIR + ''system\\daemon.current\\''' + #13#10#13#10,true); SaveStringToFile(cf,'# The archive currently being downloaded is stored here' + #13#10,true); SaveStringToFile(cf,'Hellanzb.WORKING_DIR = Hellanzb.PREFIX_DIR + ''system\\daemon.working\\''' + #13#10#13#10,true); SaveStringToFile(cf,'# Archives interrupted in the middle of downloading are stored here temporarily' + #13#10,true); SaveStringToFile(cf,'Hellanzb.POSTPONED_DIR = Hellanzb.PREFIX_DIR + ''system\\daemon.postponed\\''' + #13#10#13#10,true); SaveStringToFile(cf,'# Archives currently being processed. May contains archive directories, or' + #13#10,true); SaveStringToFile(cf,'# symbolic links to archive directories' + #13#10,true); SaveStringToFile(cf,'Hellanzb.PROCESSING_DIR = Hellanzb.PREFIX_DIR + ''system\\daemon.processing\\''' + #13#10#13#10,true); SaveStringToFile(cf,'# Temp storage' + #13#10,true); SaveStringToFile(cf,'Hellanzb.TEMP_DIR = Hellanzb.PREFIX_DIR + ''system\\daemon.temp\\''' + #13#10#13#10,true); SaveStringToFile(cf,'# Filename to store hellanzb state in between CTRL-Cs. The state (includes the' + #13#10,true); SaveStringToFile(cf,'# order of the queue, and smart par recovery information) is intermittently' + #13#10,true); SaveStringToFile(cf,'# written out as XML to this file' + #13#10,true); SaveStringToFile(cf,'Hellanzb.STATE_XML_FILE = Hellanzb.PREFIX_DIR + ''system\\hellanzbState.xml''' + #13#10#13#10,true); SaveStringToFile(cf,'# Supply a path to the (un)rar command' + #13#10,true); SaveStringToFile(cf,'Hellanzb.UNRAR_CMD = Hellanzb.PREFIX_DIR + ''system\\bin\\UnRAR.exe''' + #13#10#13#10,true); SaveStringToFile(cf,'# Supply a path to the par2 command' + #13#10,true); SaveStringToFile(cf,'Hellanzb.PAR2_CMD = Hellanzb.PREFIX_DIR + ''system\\bin\\par2.exe''' + #13#10#13#10,true); SaveStringToFile(cf,'# Log output to this file, set to None (no single quotes) for no logging' + #13#10,true); SaveStringToFile(cf,'Hellanzb.LOG_FILE = Hellanzb.PREFIX_DIR + ''system\\logs\\hellanzb.log''' + #13#10#13#10,true); SaveStringToFile(cf,'# Server Definition'+#13#10,true); SaveStringToFile(cf,'defineServer(id=''newsserver'', hosts=['''+NewsServerInfo.Values[0]+':'+NewsServerInfo.Values[1]+ '''],username='+username+', password='+password+', connections=4, antiIdle = 4.5*60, ssl=False)' + #13#10,true); SaveStringToFile(cf,'Hellanzb.NOT_REQUIRED_FILE_TYPES = [ ''log'', ''m3u'', ''nfo'', ''nzb'', ''sfv'', ''txt'' ]' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.KEEP_FILE_TYPES = [ ''nfo'', ''txt'' ]' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.MAX_DECOMPRESSION_THREADS = 2' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.LOG_FILE_MAX_BYTES = 0' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.LOG_FILE_BACKUP_COUNT = 0' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.PROCESSED_SUBDIR = ''processed''' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.DELETE_PROCESSED = True' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.GROWL_NOTIFY = False' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.XMLRPC_SERVER = ''localhost''' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.XMLRPC_PORT = 8760' + #13#10#13#10,true); SaveStringToFile(cf,'Hellanzb.XMLRPC_PASSWORD = ''changeme''' + #13#10#13#10,true); end; procedure InitializeWizard; begin NewsServerInfo := CreateInputQueryPage(wpSelectProgramGroup, 'News Server Information', 'Info', 'Please fill in the fields below. If your news server does not require authentication, leave the username and password fields blank.'); NewsServerInfo.Add('News Server Address:', False); NewsServerInfo.Add('Port:', False); NewsServerInfo.Add('Username:', False); NewsServerInfo.Add('Password:', true); NewsServerInfo.Values[1] := '119'; PythonFname := ExpandConstant('{tmp}\python.msi'); TwistedFName := ExpandConstant('{tmp}\twisted.exe'); PythonInfo := CreateInputOptionPage(wpLicense,'Python','Info','Python 2.5 and the Twisted library are required and will be downloaded and installed automatically if the boxes are checked.',False,False); PythonInfo.Add('Download and Install Python? (10MB)'); PythonInfo.Add('Download and Install Twisted? (2MB)'); // If Python and/or Twisted are installed already, uncheck the boxes.... if RegKeyExists(HKEY_LOCAL_MACHINE,'SOFTWARE\Python\PythonCore\2.5') then PythonInfo.Values[0] := False else PythonInfo.Values[0] := True; if RegKeyExists(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Twisted (Python 2.5)_is1') then PythonInfo.Values[1] := False else PythonInfo.Values[1] := True; end; function NextButtonClick(CurPage: Integer): Boolean; var hWnd: Integer; retval: Integer; PythonURL: String; TwistedURL: String; dlcomplete: Boolean; begin if ((CurPage = PythonInfo.ID)) then begin dlcomplete := True; PythonURL := 'http://python.org/ftp/python/2.5.1/python-2.5.1.msi'; TwistedURL := 'http://tmrc.mit.edu/mirror/twisted/Twisted/2.5/Twisted_NoDocs-2.5.0.win32-py2.5.exe'; isxdl_SetOption('title', 'Downloading...'); if PythonInfo.Values[0] then isxdl_AddFileSize(PythonURL,PythonFname,10970624); if PythonInfo.Values[1] then isxdl_AddFileSize(TwistedURL,TwistedFname,2235700); hWnd := StrToInt(ExpandConstant('{wizardhwnd}')); if isxdl_DownloadFiles(hWnd) = 0 then begin dlcomplete := False; MsgBox('Download and installation of Python and/or Twisted failed, the file must be manually installed. '+ 'Python may be downloaded from www.python.org and Twisted may be downloaded from www.twistedmatrix.com', mbInformation, MB_OK); end; if PythonInfo.Values[0] and dlcomplete then if not ShellExec('', ExpandConstant(PythonFname),'/qb', '', SW_SHOW, ewWaitUntilTerminated, retval) then msgbox('An Error has occurred: '+SysErrorMessage(retval),mbInformation,MB_OK); if PythonInfo.Values[1] and dlcomplete then if not Exec(ExpandConstant(TwistedFname),'/SILENT', '', SW_SHOW, ewWaitUntilTerminated, retval) then msgbox('An Error has occurred: '+SysErrorMessage(retval),mbInformation,MB_OK); end; Result := True; end; function GetPythonPath(Param: String): String; begin Result := ''; Result := ExpandConstant('{reg:HKLM\Software\Python\PythonCore\2.5\InstallPath,|ACK}'); if CompareStr(Result, 'ACK')=0 then Result := ExpandConstant('{reg:HKCU\Software\Python\PythonCore\2.5\InstallPath,|ACK}'); if Result <> '' then Result := Result + '\python.exe'; end; [Setup] AppName=Hellanzb AppVerName=Hellanzb 0.13 DefaultDirName=c:\hellanzb DefaultGroupName=Hellanzb UninstallDisplayIcon={app}\MyProg.exe Compression=lzma SolidCompression=yes OutputDir=j:\WinWork\hellanzb OutputBaseFilename=hellasetup LicenseFile=c:\basehellanzb\system\Notes\alllicenses.txt [Files] Source: "c:\basehellanzb\*"; Excludes: "hellanzb.conf"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs Source: "c:\basehellanzb\system\etc\hellanzb.conf"; DestDir: "{app}\system\etc"; Flags: recursesubdirs; AfterInstall: MakeConfFile Source: "C:\Program Files\Inno Setup 5\Download DLL\isxdl.dll"; DestDir: "{tmp}"; Flags: dontcopy [Icons] Name: "{group}\Start Hellanzb"; Filename: "{code:GetPythonPath}"; WorkingDir: "{app}\system"; Parameters: "{app}\system\hellanzb.py" Name: "{group}\Hellanzb Status"; Filename: "cmd"; WorkingDir: "{app}\system"; Parameters: "/c {code:GetPythonPath} {app}\system\hellanzb.py status & pause" Name: "{group}\Edit hellanzb.conf"; Filename: "notepad"; Parameters: "{app}\system\etc\hellanzb.conf" Name: "{group}\Uninstall Hellanzb"; Filename: "{uninstallexe}"