325 lines
14 KiB
Plaintext
325 lines
14 KiB
Plaintext
; Script generated by the Inno Setup Script Wizard.
|
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
|
|
|
#define MyAppName "TTW_Bot"
|
|
#define MyAppExeName "TTW_Bot_app.exe"
|
|
#define MyAppDir "C:\Delphi\d12\ttw_fmx_v10"
|
|
#define MyAppExePath MyAppDir + "\Win32\Release\" + MyAppExeName
|
|
#define MyAppVersion GetFileVersion(MyAppExePath)
|
|
#define MyAppPublisher "PTyTb, Inc."
|
|
#define MyAppURL "https://ptytb.ru/ttw_bot"
|
|
#define MyAppAssocName MyAppName + "_Files"
|
|
#define MyAppAssocExt ".myp"
|
|
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
|
|
|
[Setup]
|
|
LicenseFile={#MyAppDir}\license.rtf
|
|
DisableWelcomePage=no
|
|
AppId={{81A4FB77-4AE5-4FAC-A889-CA3CA7B8C687}}
|
|
AppName={#MyAppName}
|
|
AppVersion={#MyAppVersion}
|
|
AppPublisher={#MyAppPublisher}
|
|
AppPublisherURL={#MyAppURL}
|
|
AppSupportURL={#MyAppURL}
|
|
AppUpdatesURL={#MyAppURL}
|
|
DefaultDirName={autopf}\{#MyAppName}
|
|
ChangesAssociations=yes
|
|
DisableDirPage=auto
|
|
DisableProgramGroupPage=auto
|
|
OutputDir={#MyAppDir}\Win32\installer
|
|
OutputBaseFilename=TTW_Bot_setup
|
|
SetupIconFile={#MyAppDir}\install.ico
|
|
Compression=lzma2/ultra
|
|
SolidCompression=yes
|
|
WizardStyle=modern
|
|
|
|
[Languages]
|
|
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"; LicenseFile: "{#MyAppDir}\license.rtf"
|
|
|
|
[Tasks]
|
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
|
|
|
|
Name: "install_ytdlp"; Description: "Óñòàíîâèòü yt-dlp"; GroupDescription: "Êîìïîíåíòû äëÿ âîñïðîèçâåäåíèÿ ìóçûêè ïî ññûëêå"
|
|
Name: "install_ffmpeg"; Description: "Óñòàíîâèòü ffmpeg"; GroupDescription: "Êîìïîíåíòû äëÿ âîñïðîèçâåäåíèÿ ìóçûêè ïî ññûëêå"
|
|
|
|
Name: "install_ru_irina"; Description: "Ñêà÷àòü Ðó ãîëîñ Èðèíà"; GroupDescription: "Ìîäåëè ãîëîñîâ äëÿ îçâó÷êè"
|
|
Name: "install_ru_denis"; Description: "Ñêà÷àòü Ðó ãîëîñ Äåíèñ"; GroupDescription: "Ìîäåëè ãîëîñîâ äëÿ îçâó÷êè"
|
|
Name: "install_ru_dmitri"; Description: "Ñêà÷àòü Ðó ãîëîñ Äìèòðèé"; GroupDescription: "Ìîäåëè ãîëîñîâ äëÿ îçâó÷êè"
|
|
Name: "install_ru_ruslan"; Description: "Ñêà÷àòü Ðó ãîëîñ Ðóñëàí"; GroupDescription: "Ìîäåëè ãîëîñîâ äëÿ îçâó÷êè"
|
|
|
|
[Files]
|
|
Source: "{#MyAppDir}\Win32\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\bass.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\botapp.cfg"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\libcrypto-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\libssl-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\libssl32.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\SilentPlayer.exe"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "{#MyAppDir}\Win32\Release\stl\*"; DestDir: "{userappdata}\TTW_Bot\stl"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
Source: "{#MyAppDir}\Win32\Release\piper\*"; DestDir: "{app}\piper"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
Source: "{#MyAppDir}\Win32\Release\games\*"; DestDir: "{app}\games"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
Source: "{#MyAppDir}\license.rtf"; DestDir: "{app}"; Flags: ignoreversion
|
|
|
|
Source: "{#MyAppDir}\unzip.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall dontcopy
|
|
Source: "{tmp}\yt-dlp.exe"; DestDir: "{app}"; Flags: external deleteafterinstall; Tasks: install_ytdlp
|
|
Source: "{tmp}\ffmpeg.zip"; DestDir: "{app}"; Flags: external deleteafterinstall; Tasks: install_ffmpeg
|
|
|
|
; Ãîëîñ Èðèíû
|
|
Source: "{tmp}\ru_RU-irina-medium.onnx"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_irina
|
|
Source: "{tmp}\ru_RU-irina-medium.onnx.json"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_irina
|
|
|
|
; Ãîëîñ Äåíèñà
|
|
Source: "{tmp}\ru_RU-denis-medium.onnx"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_denis
|
|
Source: "{tmp}\ru_RU-denis-medium.onnx.json"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_denis
|
|
|
|
; Ãîëîñ Äìèòðèÿ
|
|
Source: "{tmp}\ru_RU-dmitri-medium.onnx"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_dmitri
|
|
Source: "{tmp}\ru_RU-dmitri-medium.onnx.json"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_dmitri
|
|
|
|
; Ãîëîñ Ðóñëàíà
|
|
Source: "{tmp}\ru_RU-ruslan-medium.onnx"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_ruslan
|
|
Source: "{tmp}\ru_RU-ruslan-medium.onnx.json"; DestDir: "{userappdata}\TTW_Bot\Voices"; Flags: external; Tasks: install_ru_ruslan
|
|
|
|
[Registry]
|
|
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
|
|
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
|
|
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
|
|
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
|
|
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""
|
|
|
|
[Icons]
|
|
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
|
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
|
|
|
[Run]
|
|
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
|
|
|
[Code]
|
|
var
|
|
DownloadPage: TDownloadWizardPage;
|
|
|
|
function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
|
|
begin
|
|
if Progress = ProgressMax then
|
|
Log(Format('Óñïåøíî çàãðóæåíî: %s', [FileName]));
|
|
Result := True;
|
|
end;
|
|
|
|
procedure InitializeWizard;
|
|
begin
|
|
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
|
|
end;
|
|
|
|
function NextButtonClick(CurPageID: Integer): Boolean;
|
|
var
|
|
HasDownloads: Boolean;
|
|
begin
|
|
if CurPageID = wpLicense then
|
|
begin
|
|
Result := WizardForm.LicenseAcceptedRadio.Checked;
|
|
if not Result then
|
|
MsgBox('Âû äîëæíû ïðèíÿòü óñëîâèÿ ëèöåíçèîííîãî ñîãëàøåíèÿ!', mbError, MB_OK);
|
|
end
|
|
else if CurPageID = wpReady then
|
|
begin
|
|
HasDownloads := False;
|
|
DownloadPage.Clear;
|
|
|
|
if WizardIsTaskSelected('install_ytdlp') then
|
|
begin
|
|
DownloadPage.Add('https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe', 'yt-dlp.exe', '');
|
|
HasDownloads := True;
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ffmpeg') then
|
|
begin
|
|
DownloadPage.Add('https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip', 'ffmpeg.zip', '');
|
|
HasDownloads := True;
|
|
end;
|
|
|
|
// Äîáàâëÿåì çàãðóçêó ãîëîñîâ
|
|
if WizardIsTaskSelected('install_ru_irina') then
|
|
begin
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/irina/medium/ru_RU-irina-medium.onnx?download=true', 'ru_RU-irina-medium.onnx', '');
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/irina/medium/ru_RU-irina-medium.onnx.json?download=true', 'ru_RU-irina-medium.onnx.json', '');
|
|
HasDownloads := True;
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ru_denis') then
|
|
begin
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/denis/medium/ru_RU-denis-medium.onnx?download=true', 'ru_RU-denis-medium.onnx', '');
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/denis/medium/ru_RU-denis-medium.onnx.json?download=true', 'ru_RU-denis-medium.onnx.json', '');
|
|
HasDownloads := True;
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ru_dmitri') then
|
|
begin
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.onnx?download=true', 'ru_RU-dmitri-medium.onnx', '');
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.onnx.json?download=true', 'ru_RU-dmitri-medium.onnx.json', '');
|
|
HasDownloads := True;
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ru_ruslan') then
|
|
begin
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.onnx?download=true', 'ru_RU-ruslan-medium.onnx', '');
|
|
DownloadPage.Add('https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.onnx.json?download=true', 'ru_RU-ruslan-medium.onnx.json', '');
|
|
HasDownloads := True;
|
|
end;
|
|
|
|
if HasDownloads then
|
|
begin
|
|
DownloadPage.Show;
|
|
try
|
|
DownloadPage.Download;
|
|
DownloadPage.Hide;
|
|
Result := True;
|
|
except
|
|
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
|
|
Result := False;
|
|
end;
|
|
end
|
|
else
|
|
Result := True;
|
|
end
|
|
else
|
|
Result := True;
|
|
end;
|
|
|
|
procedure InstallFiles;
|
|
var
|
|
ResultCode: Integer;
|
|
UnzipTool: string;
|
|
VoicesPath: string;
|
|
TempPath: string;
|
|
FindRec: TFindRec;
|
|
Found: Boolean;
|
|
begin
|
|
VoicesPath := ExpandConstant('{userappdata}\TTW_Bot\Voices');
|
|
if not DirExists(VoicesPath) then
|
|
ForceDirectories(VoicesPath);
|
|
|
|
|
|
if WizardIsTaskSelected('install_ytdlp') then
|
|
begin
|
|
if FileExists(ExpandConstant('{tmp}\yt-dlp.exe')) then
|
|
begin
|
|
FileCopy(ExpandConstant('{tmp}\yt-dlp.exe'), ExpandConstant('{app}\yt-dlp.exe'), False);
|
|
Log('yt-dlp óñòàíîâëåí');
|
|
end
|
|
else
|
|
Log('Îøèáêà: yt-dlp.exe íå íàéäåí âî âðåìåííîé ïàïêå');
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ffmpeg') then
|
|
begin
|
|
if FileExists(ExpandConstant('{tmp}\ffmpeg.zip')) then
|
|
begin
|
|
UnzipTool := ExpandConstant('{tmp}\unzip.exe');
|
|
if not FileExists(UnzipTool) then
|
|
begin
|
|
ExtractTemporaryFile('unzip.exe');
|
|
end;
|
|
|
|
// Ñîçäàåì âðåìåííóþ ïàïêó äëÿ ðàñïàêîâêè
|
|
TempPath := ExpandConstant('{tmp}\ffmpeg_temp');
|
|
ForceDirectories(TempPath);
|
|
|
|
// Ðàñïàêîâûâàåì àðõèâ âî âðåìåííóþ ïàïêó
|
|
Exec(UnzipTool, '-o "' + ExpandConstant('{tmp}\ffmpeg.zip') + '" -d "' + TempPath + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
|
|
|
// Èùåì ffmpeg.exe â ïîäïàïêàõ
|
|
Found := False;
|
|
if FindFirst(TempPath + '\*', FindRec) then
|
|
begin
|
|
try
|
|
repeat
|
|
if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and
|
|
(FindRec.Name <> '.') and (FindRec.Name <> '..') then
|
|
begin
|
|
// Ïðîâåðÿåì íàëè÷èå ffmpeg.exe â ïàïêå bin
|
|
if FileExists(TempPath + '\' + FindRec.Name + '\bin\ffmpeg.exe') then
|
|
begin
|
|
FileCopy(TempPath + '\' + FindRec.Name + '\bin\ffmpeg.exe',
|
|
ExpandConstant('{app}\ffmpeg.exe'), False);
|
|
Log('ffmpeg.exe íàéäåí è ñêîïèðîâàí èç ïàïêè: ' + FindRec.Name);
|
|
Found := True;
|
|
Break;
|
|
end;
|
|
end;
|
|
until not FindNext(FindRec);
|
|
finally
|
|
FindClose(FindRec);
|
|
end;
|
|
end;
|
|
|
|
if not Found then
|
|
Log('Îøèáêà: ffmpeg.exe íå íàéäåí â ðàñïàêîâàííûõ ôàéëàõ');
|
|
|
|
// Óäàëÿåì âðåìåííóþ ïàïêó
|
|
DelTree(TempPath, True, True, True);
|
|
end
|
|
else
|
|
Log('Îøèáêà: ffmpeg.zip íå íàéäåí âî âðåìåííîé ïàïêå');
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ru_irina') then
|
|
begin
|
|
if FileExists(ExpandConstant('{tmp}\ru_RU-irina-medium.onnx')) then
|
|
begin
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-irina-medium.onnx'), VoicesPath + '\ru_RU-irina-medium.onnx', False);
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-irina-medium.onnx.json'), VoicesPath + '\ru_RU-irina-medium.onnx.json', False);
|
|
Log('Ãîëîñ Èðèíà óñòàíîâëåí');
|
|
end
|
|
else
|
|
Log('Îøèáêà: Ãîëîñ Èðèíà íå íàéäåí âî âðåìåííîé ïàïêå');
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ru_denis') then
|
|
begin
|
|
if FileExists(ExpandConstant('{tmp}\ru_RU-denis-medium.onnx')) then
|
|
begin
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-denis-medium.onnx'), VoicesPath + '\ru_RU-denis-medium.onnx', False);
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-denis-medium.onnx.json'), VoicesPath + '\ru_RU-denis-medium.onnx.json', False);
|
|
Log('Ãîëîñ Äåíèñ óñòàíîâëåí');
|
|
end
|
|
else
|
|
Log('Îøèáêà: Ãîëîñ Äåíèñ íå íàéäåí âî âðåìåííîé ïàïêå');
|
|
end;
|
|
|
|
if WizardIsTaskSelected('install_ru_dmitri') then
|
|
begin
|
|
if FileExists(ExpandConstant('{tmp}\ru_RU-dmitri-medium.onnx')) then
|
|
begin
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-dmitri-medium.onnx'), VoicesPath + '\ru_RU-dmitri-medium.onnx', False);
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-dmitri-medium.onnx.json'), VoicesPath + '\ru_RU-dmitri-medium.onnx.json', False);
|
|
Log('Ãîëîñ Äìèòðèé óñòàíîâëåí');
|
|
end
|
|
else
|
|
Log('Îøèáêà: Ãîëîñ Äìèòðèé íå íàéäåí âî âðåìåííîé ïàïêå');
|
|
end;
|
|
|
|
|
|
|
|
if WizardIsTaskSelected('install_ru_ruslan') then
|
|
begin
|
|
if FileExists(ExpandConstant('{tmp}\ru_RU-ruslan-medium.onnx')) then
|
|
begin
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-ruslan-medium.onnx'), VoicesPath + '\ru_RU-ruslan-medium.onnx', False);
|
|
FileCopy(ExpandConstant('{tmp}\ru_RU-ruslan-medium.onnx.json'), VoicesPath + '\ru_RU-ruslan-medium.onnx.json', False);
|
|
Log('Ãîëîñ Ðóñëàí óñòàíîâëåí');
|
|
end
|
|
else
|
|
Log('Îøèáêà: Ãîëîñ Ðóñëàí íå íàéäåí âî âðåìåííîé ïàïêå');
|
|
end;
|
|
end;
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
begin
|
|
if CurStep = ssPostInstall then
|
|
begin
|
|
InstallFiles;
|
|
end;
|
|
end; |