Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Testing for program Install routine. Cross Platform Compatible.
#1
The following should work on all 3 major platforms   Linux, Windows & MACOS.

I'm hoping for people to test this though.   (I have no way of testing on MAC & Windows is actually
inconvenient (but possible) for me to test)

This little program should check if ffmpeg is installed and IF NOT, should facilitate it's installation.
(No way this is 100% Internet could be down, system might not be ready etc)

But this should be as good as possible.

Comments and results requested and appreciated.

Code: (Select All)

$Console:Only

Dim Shared Slash$
Dim Shared NULL$
Dim Shared CopyCmd$
Dim Shared MoveCmd$
Dim Shared SystemOpen$
Dim Shared HomeDir$


$If WINDOWS Then
    Slash$ = "\"
    NULL$ = "NUL"
    CopyCmd$ = "COPY "
    MoveCmd$ = "MOVE "
    SystemOpen$ = "START "
    HomeDir$=_DIR$("APPDATA")
    HomeDir$=LEFT$(HomeDir$,(LEN(HomeDir$)-1))
$Else
    Slash$ = "/"
    NULL$ = "/dev/null"
    CopyCmd$ = "cp "
    MoveCmd$ = "mv "
    HomeDir$ = Environ$("HOME")
    $If MAC Then
        SystemOpen$="open "
    $Else
        SystemOpen$ = "xdg-open "
    $End If
$End If

If IsInstalled("ffmpeg") Then
    Print "ffmpeg was found"
Else
    InstallFFMPEG
End If
End

Function IsInstalled% (trycmd$)
    Dim GetInstalled As Integer
    $If WINDOWS Then
      GetInstalled = (shell("where "+trycmd$)=0)
    $Else
        GetInstalled = (Shell("which " + trycmd$) = 0)
    $End If

    IsInstalled = GetInstalled
End Function


Sub InstallFFMPEG
    HomePage$ = "https://www.ffmpeg.org"
    X = _MessageBox("Open FFMPEG Home Page", "Missing ffmpeg or ffprobe." + Chr$(13) + "Do You want to Open the FFMPEG Home Page ?", "yesno", "question", 0)
    If X = 1 Then Shell SystemOpen$ + HomePage$

    $If WINDOWS Then
      J = _MessageBox("Attempt Direct Download of FFMPEG archive ", "Do You want to download Now ?", "yesno", "question", 0)
      if j = 1 then
        X = _MessageBox("Attempt Download of source #1", "Do You want to download from "+CHR$(13)+"https://github.com/BtbN/FFmpeg-Builds/", "yesno", "question", 0)
        If X = 1 then Shell("start  https://github.com/BtbN/FFmpeg-Builds/re...shared.zip")
        If X = 1 then GOTO EndWinInstall
        X = _MessageBox("Attempt Download of source #2", "Do You want to download from "+CHR$(13)+"https://www.gyan.dev", "yesno", "question", 0)
        If X = 1 then Shell("start https://www.gyan.dev/ffmpeg/builds/packa...s_build.7z")
        EndWinInstall:
        GOTO Finish_F_Install
      end if
    $End If

    $If LINUX Then
        If IsInstalled("apt") Then
            X = _MessageBox("Install with apt", "Attempt FFMPEG install with apt ?" + Chr$(13) + "(Must have a visible console Window)", "yesno", "question", 0)
            If X = 1 Then
                Shell ("apt install ffmpeg")
                GoTo FinishFInstall
            End If
        End If
        If IsInstalled("yum") Then
            X = _MessageBox("Install with Yum", "Attempt FFMPEG install with Yum ?" + Chr$(13) + "(Must have a visible console Window)", "yesno", "question", 0)
            If X = 1 Then
                Shell ("yum install ffmpeg")
                GoTo FinishFInstall
            End If
        End If
        If IsInstalled("brew") Then
            X = _MessageBox("Install with Brew", "Attempt FFMPEG install with HomeBrew ?" + Chr$(13) + "(Must have a visible console Window)", "yesno", "question", 0)
            If X = 1 Then
                Shell ("brew install ffmpeg")
                GoTo FinishFInstall
            End If
        End If
    $End If

    $If MAC Then
        If IsInstalled("brew") Then
            X = _MessageBox("Install with Brew", "Attempt FFMPEG install with HomeBrew ?" + Chr$(13) + "(Must have a visible console Window)", "yesno", "question", 0)
            If X = 1 Then
                Shell ("brew install ffmpeg")
                GoTo FinishFInstall
            End If
        End If
    $End If

    FinishFInstall:
    X = _MessageBox("X16 Movie Maker ", "Continue Opening X16 Movie Maker ? " + Chr$(13) + "(If you have installed the FFMPEG package.)", "yesno", "question", 0)
    If X <> 1 Then System
End Sub


Attached Files
.bas   installsub.bas (Size: 3.62 KB / Downloads: 9)
Reply


Messages In This Thread
Testing for program Install routine. Cross Platform Compatible. - by ahenry3068 - 05-13-2025, 09:38 PM



Users browsing this thread: 1 Guest(s)