[setup] installer & external ffmpeg

This commit is contained in:
jscampucci 2024-08-26 10:20:18 +02:00
parent 103915dc77
commit 118f5e661b
4 changed files with 85 additions and 24 deletions

View File

@ -24,26 +24,6 @@ class ConverterService {
Future<void> _init() async {
tempDir = await getTemporaryDirectory();
if (Platform.isWindows) {
ffmpegPath = 'ffmpeg.exe';
} else if (Platform.isLinux) {
ffmpegPath = 'ffmpeg';
} else if (Platform.isMacOS) {
ffmpegPath = 'ffmpeg';
}
await checkFFmpeg();
}
Future<void> checkFFmpeg() async {
try {
var result = await Process.run(ffmpegPath, ['-version']);
if (result.exitCode == 0) {
FileLogger().d('FFmpeg is installed.');
return;
}
} catch (e) {
FileLogger().d('FFmpeg is not installed.');
}
}
Future<File?> getTmpFile(String filename) async {

View File

@ -39,7 +39,7 @@ class DLServices {
Future<void> _init() async {
tempDir = await getTemporaryDirectory();
if (Platform.isWindows) {
checkFFmpeg();
//checkFFmpeg();
assetName = 'yt-dlp.exe';
} else if (Platform.isLinux) {
checkFFmpeg();
@ -101,7 +101,7 @@ class DLServices {
Future<void> checkFFmpeg() async {
var result = await futureShell('ffmpeg -version');
FileLogger().d('$result');
if (result.exitCode == 0) {
if (result && result.exitCode == 0) {
FileLogger().d('FFmpeg is already installed.');
return;
}
@ -159,7 +159,7 @@ class DLServices {
var strType = convertedFormats.contains(video.format) ? 'tmp' : 'done';
var command =
'${video.url.trim()} --sub-langs "all,-live_chat" --embed-subs --embed-thumbnail --embed-metadata --progress -o "temp/${video.filename}_$strType.%(ext)s" -f "$formatCmd"';
'${video.url.trim()} --sub-langs "all,-live_chat" --embed-subs --embed-thumbnail --embed-metadata --progress -o "${tempDir.path}/${video.filename}_$strType.%(ext)s" -f "$formatCmd"';
var shellLinesController = ShellLinesController();
var shellErrorController = ShellLinesController();

View File

@ -3,7 +3,7 @@ description: noTube
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 0.0.23
version: 0.0.50
environment:
sdk: ">=3.0.0 <4.0.0"

81
windows-setup-script.iss Normal file
View File

@ -0,0 +1,81 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "noTube"
#define MyAppVersion "0.49"
#define MyAppPublisher "noTube"
#define MyAppURL "https://notube.lol/"
#define MyAppExeName "notube.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{C715B92D-00E4-48BD-954F-202DB362ED4C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run
; on anything but x64 and Windows 11 on Arm.
ArchitecturesAllowed=x64compatible
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the
; install be done in "64-bit mode" on x64 or Windows 11 on Arm,
; meaning it should use the native 64-bit Program Files directory and
; the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64compatible
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=C:\Users\Skapdat\Oth\buildNoTube
OutputBaseFilename=notube-windows
SetupIconFile=C:\Users\Skapdat\Projets\Dev\NoTube-Flutter\notube\build\windows\x64\runner\Release\data\flutter_assets\assets\images\favicon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Users\Skapdat\Projets\Dev\NoTube-Flutter\notube\build\windows\x64\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Skapdat\Projets\Dev\NoTube-Flutter\notube\build\windows\x64\runner\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\data\flutter_assets\assets\executable"; \
Check: NeedsAddPath('{app}\data\flutter_assets\assets\executable')
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', OrigPath)
then begin
Result := True;
exit;
end;
{ look for the path with leading and trailing semicolon }
{ Pos() returns 0 if not found }
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;