From 6d34839b3c10a93226f5f17a9ce56d8285aac3c5 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Thu, 4 Jan 2024 19:52:42 +0100 Subject: [PATCH 01/12] checks: Rename wayland.py to linux.py Groundwork for future linux-specific checks similar to the Windows and MacOS specific checks. --- checks/{wayland.py => linux.py} | 0 loganalyzer.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename checks/{wayland.py => linux.py} (100%) diff --git a/checks/wayland.py b/checks/linux.py similarity index 100% rename from checks/wayland.py rename to checks/linux.py diff --git a/loganalyzer.py b/loganalyzer.py index c73ad0a..8f28e11 100755 --- a/loganalyzer.py +++ b/loganalyzer.py @@ -12,7 +12,7 @@ from checks.network import * from checks.plugins import * from checks.sources import * -from checks.wayland import * +from checks.linux import * from checks.windows import * from checks.utils.fetchers import * From f1fdcc8d9e658c85b83cbe5fd39018a2f7e6a51d Mon Sep 17 00:00:00 2001 From: Tarulia Date: Wed, 18 Oct 2023 19:35:03 +0200 Subject: [PATCH 02/12] linux: Move Snap package detection from core --- checks/core.py | 13 ------------- checks/linux.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/checks/core.py b/checks/core.py index 222ae47..e978343 100644 --- a/checks/core.py +++ b/checks/core.py @@ -148,16 +148,3 @@ def checkSafeMode(lines): else: return [LEVEL_WARNING, "Safe Mode Enabled", """You are running OBS in Safe Mode. Safe Mode disables third-party plugins and prevents scripts from running."""] - - -def checkSnapPackage(lines): - isDistroNix = search('Distribution:', lines) - - if len(isDistroNix) <= 0: - return - - distro = isDistroNix[0].split() - # Snap Package logs "Ubuntu Core" as distro, so it gets split halfway - if distro[2] == '"Ubuntu' and distro[3] == 'Core"': - return [LEVEL_WARNING, "Snap Package", - "You are using the Snap Package. This is a community-supported modified build of OBS Studio; please file issues on the Snapcrafters GitHub.

OBS may be unable to assist with issues arising out of the usage of this package and therefore recommends following our Install Instructions."] diff --git a/checks/linux.py b/checks/linux.py index 6168c7d..eb089ab 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -14,6 +14,19 @@ def getWindowSystemLine(lines): return windowSystem[0] +def checkSnapPackage(lines): + isDistroNix = search('Distribution:', lines) + + if len(isDistroNix) <= 0: + return + + distro = isDistroNix[0].split() + # Snap Package logs "Ubuntu Core" as distro, so it gets split halfway + if distro[2] == '"Ubuntu' and distro[3] == 'Core"': + return [LEVEL_WARNING, "Snap Package", + "You are using the Snap Package. This is a community-supported modified build of OBS Studio; please file issues on the Snapcrafters GitHub.

OBS may be unable to assist with issues arising out of the usage of this package. We recommend following our Install Instructions instead."] + + def checkWayland(lines): isDistroNix = search('Distribution:', lines) isFlatpak = search('Flatpak Runtime:', lines) From fd82f59b789f438a8803e4c3f2da838d13be345c Mon Sep 17 00:00:00 2001 From: Tarulia Date: Thu, 4 Jan 2024 22:39:21 +0100 Subject: [PATCH 03/12] linux: Log Wayland usage --- checks/linux.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/checks/linux.py b/checks/linux.py index eb089ab..6b64153 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -46,13 +46,16 @@ def checkWayland(lines): distro = isDistroNix[0].split() if distro[2] == '"Ubuntu"' and distro[3] == '"20.04"': return [LEVEL_CRITICAL, "Ubuntu 20.04 under Wayland", - "Ubuntu 20.04 does not provide the needed dependencies for OBS to capture under Wayland.
So OBS is able to capture only under X11/Xorg."] + "Ubuntu 20.04 does not provide the needed dependencies for OBS to capture under Wayland.
Capture will only function under X11/Xorg."] windowSystemLine = getWindowSystemLine(lines) # If there is no Window System, OBS is running under Wayland - if not windowSystemLine: - return - - # If there is, OBS is running under XWayland - return [LEVEL_CRITICAL, "Running under XWayland", - "OBS is running under XWayland, which prevents OBS from being able to capture.
To fix that, you will need to run OBS with the following command in a terminal:

obs -platform wayland

"] + if windowSystemLine: + # If there is, OBS is running under XWayland + return [LEVEL_CRITICAL, "Running under XWayland", + "OBS is running under XWayland, which prevents OBS from being able to capture.
To fix that, you will need to run OBS with the following command in a terminal:

obs -platform wayland

"] + + return [LEVEL_INFO, "Wayland", + """Window and Screen Captures are available via XDG Desktop Portal
. + Please note that the availability of captures and specific features depends on your Desktop Environment's implementation of these portals.

+ Global Keyboard Shortcuts are not currently available under Wayland."""] From 256b97237029db1a140d3dd98fb0fe0361731291 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Thu, 4 Jan 2024 23:08:37 +0100 Subject: [PATCH 04/12] linux: Log Flatpak usage --- checks/linux.py | 8 ++++++++ loganalyzer.py | 1 + 2 files changed, 9 insertions(+) diff --git a/checks/linux.py b/checks/linux.py index 6b64153..a52a1a3 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -14,6 +14,14 @@ def getWindowSystemLine(lines): return windowSystem[0] +def checkFlatpak(lines): + isFlatpak = search('Flatpak Runtime:', lines) + + if len(isFlatpak) > 0: + return [LEVEL_INFO, "Flatpak", + "You are using the Flatpak. Plugins are available as Flatpak extensions, which you can find in your Distribution's Software Center or via flatpak search com.obsproject.Studio. Installation of external plugins is not supported."] + + def checkSnapPackage(lines): isDistroNix = search('Distribution:', lines) diff --git a/loganalyzer.py b/loganalyzer.py index 8f28e11..e6e808a 100755 --- a/loganalyzer.py +++ b/loganalyzer.py @@ -183,6 +183,7 @@ def doAnalysis(url=None, filename=None): checkVantage(logLines), checkPortableMode(logLines), checkSafeMode(logLines), + checkFlatpak(logLines), checkSnapPackage(logLines), checkMacPermissions(logLines) ]) From 2f75e0e18bd3bd2346e1d7de4b3eefa5fe20c3fb Mon Sep 17 00:00:00 2001 From: Tarulia Date: Thu, 4 Jan 2024 23:16:20 +0100 Subject: [PATCH 05/12] linux: Detect unavailable PipeWire captures --- checks/linux.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/checks/linux.py b/checks/linux.py index a52a1a3..21dee1b 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -63,7 +63,15 @@ def checkWayland(lines): return [LEVEL_CRITICAL, "Running under XWayland", "OBS is running under XWayland, which prevents OBS from being able to capture.
To fix that, you will need to run OBS with the following command in a terminal:

obs -platform wayland

"] + hasNoPipewireCapture = search('[pipewire] No capture', lines) + if len(hasNoPipewireCapture) > 0: + return [LEVEL_CRITICAL, "No PipeWire capture on Wayland", + """In order to capture displays or windows under Wayland, OBS requires the appropriate PipeWire capture portal for your Desktop Environment.

+ An overview of available capture portals can be found on the Arch Linux Wiki:
+ XDG Desktop Portal
+ Note that the availability of Window and/or Display capture depends on your Desktop Environment's implementation of these portals."""] + return [LEVEL_INFO, "Wayland", - """Window and Screen Captures are available via XDG Desktop Portal
. + """Window and Display Captures are available via XDG Desktop Portal
. Please note that the availability of captures and specific features depends on your Desktop Environment's implementation of these portals.

Global Keyboard Shortcuts are not currently available under Wayland."""] From aa6e14852bee6a980e05654d3466f5a2a8839465 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Thu, 4 Jan 2024 23:28:20 +0100 Subject: [PATCH 06/12] linux: Detect PipeWire capture sources under X11 --- checks/linux.py | 30 ++++++++++++++++++++++++++++++ loganalyzer.py | 1 + 2 files changed, 31 insertions(+) diff --git a/checks/linux.py b/checks/linux.py index 21dee1b..b3bf351 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -75,3 +75,33 @@ def checkWayland(lines): """Window and Display Captures are available via XDG Desktop Portal
. Please note that the availability of captures and specific features depends on your Desktop Environment's implementation of these portals.

Global Keyboard Shortcuts are not currently available under Wayland."""] + + +def checkX11Captures(lines): + isDistroNix = search('Distribution:', lines) + isFlatpak = search('Flatpak Runtime:', lines) + + if (len(isDistroNix) <= 0) and (len(isFlatpak) <= 0): + return + + sessionTypeLine = getSessionTypeLine(lines) + if not sessionTypeLine: + return + + sessionType = sessionTypeLine.split()[3] + if sessionType != 'x11': + return + + # obsolete PW sources + hasPipewireCaptureDesktop = search('pipewire-desktop-capture-source', lines) + hasPipewireCaptureWindow = search('pipewire-window-capture-source', lines) + # unified PW source + hasPipewireCaptureScreen = search('pipewire-screen-capture-source', lines) + + if (len(hasPipewireCaptureDesktop) > 0) or (len(hasPipewireCaptureWindow) > 0) or (len(hasPipewireCaptureScreen) > 0): + return [LEVEL_WARNING, "PipeWire capture on X11", + """Most Desktop Environments do not implement the PipeWire capture portals on X11. This can result in being unable to pick a window or display, or the selected source will stay empty.

+ We generally recommend using \"Window Capture (Xcomposite)\" on X11, as \"Display Capture (XSHM)\" can introduce bottlenecks depending on your setup."""] + + return [LEVEL_INFO, "X11", + "If you wish to capture a window or an entire display, captures are available via Xcomposite and XSHM respectively. We generally recommend sticking to \"Window Capture (Xcomposite)\" since \"Display Capture (XSHM)\" can introduce bottlenecks depending on your setup."] diff --git a/loganalyzer.py b/loganalyzer.py index e6e808a..586021c 100755 --- a/loganalyzer.py +++ b/loganalyzer.py @@ -185,6 +185,7 @@ def doAnalysis(url=None, filename=None): checkSafeMode(logLines), checkFlatpak(logLines), checkSnapPackage(logLines), + checkX11Captures(logLines), checkMacPermissions(logLines) ]) messages.extend(checkVideoSettings(logLines)) From 8aa8db962a552713b0f34033d57f7097a9144647 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Fri, 5 Jan 2024 00:13:45 +0100 Subject: [PATCH 07/12] linux: Log Distro info --- checks/linux.py | 13 +++++++++++++ loganalyzer.py | 1 + 2 files changed, 14 insertions(+) diff --git a/checks/linux.py b/checks/linux.py index b3bf351..a3e93d8 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -14,6 +14,19 @@ def getWindowSystemLine(lines): return windowSystem[0] +def checkDistro(lines): + isDistroNix = search('Distribution:', lines) + + if len(isDistroNix) <= 0: + return + + distro = isDistroNix[0].split() + distro = distro[2:] + distro = ' '.join(distro) + + return [LEVEL_INFO, distro, ""] + + def checkFlatpak(lines): isFlatpak = search('Flatpak Runtime:', lines) diff --git a/loganalyzer.py b/loganalyzer.py index 586021c..8b679eb 100755 --- a/loganalyzer.py +++ b/loganalyzer.py @@ -183,6 +183,7 @@ def doAnalysis(url=None, filename=None): checkVantage(logLines), checkPortableMode(logLines), checkSafeMode(logLines), + checkDistro(logLines), checkFlatpak(logLines), checkSnapPackage(logLines), checkX11Captures(logLines), From 8feff3fe34508c34946a1d28a3c26d9f32293bf1 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Sun, 26 May 2024 06:11:05 +0200 Subject: [PATCH 08/12] linux: Log Desktop Environment info --- checks/linux.py | 16 ++++++++++++++++ loganalyzer.py | 1 + 2 files changed, 17 insertions(+) diff --git a/checks/linux.py b/checks/linux.py index a3e93d8..cc0b62b 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -118,3 +118,19 @@ def checkX11Captures(lines): return [LEVEL_INFO, "X11", "If you wish to capture a window or an entire display, captures are available via Xcomposite and XSHM respectively. We generally recommend sticking to \"Window Capture (Xcomposite)\" since \"Display Capture (XSHM)\" can introduce bottlenecks depending on your setup."] + + +def checkDesktopEnvironment(lines): + isDistroNix = search('Distribution:', lines) + isFlatpak = search('Flatpak Runtime:', lines) + + if (len(isDistroNix) <= 0) and (len(isFlatpak) <= 0): + return + + desktopEnvironmentLine = search('Desktop Environment:', lines) + desktopEnvironment = desktopEnvironmentLine[0].split() + desktopEnvironment = desktopEnvironment[3:] + desktopEnvironment = ' '.join(desktopEnvironment) + + if (len(desktopEnvironment) > 0): + return [LEVEL_INFO, desktopEnvironment, ''] diff --git a/loganalyzer.py b/loganalyzer.py index 8b679eb..8d3e041 100755 --- a/loganalyzer.py +++ b/loganalyzer.py @@ -187,6 +187,7 @@ def doAnalysis(url=None, filename=None): checkFlatpak(logLines), checkSnapPackage(logLines), checkX11Captures(logLines), + checkDesktopEnvironment(logLines), checkMacPermissions(logLines) ]) messages.extend(checkVideoSettings(logLines)) From 13d68e898e96c43dfc80edf3dda08585707556f6 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Fri, 31 May 2024 15:27:08 +0200 Subject: [PATCH 09/12] linux: List and count missing default plugins --- checks/linux.py | 23 +++++++++++++++++++++++ loganalyzer.py | 1 + 2 files changed, 24 insertions(+) diff --git a/checks/linux.py b/checks/linux.py index cc0b62b..6473d33 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -134,3 +134,26 @@ def checkDesktopEnvironment(lines): if (len(desktopEnvironment) > 0): return [LEVEL_INFO, desktopEnvironment, ''] + + +def checkMissingModules(lines): + isDistroNix = search('Distribution:', lines) + + if (len(isDistroNix) <= 0): + return + + modulesMissingList = [] + modulesCheckList = ('obs-browser.so', 'obs-websocket.so', 'vlc-video.so') + + for module in modulesCheckList: + if not search(module, lines): + modulesMissingList.append(module) + + if len(modulesMissingList): + modulesMissingString = str(modulesMissingList) + modulesMissingString = modulesMissingString.replace("', '", "
  • ") + modulesMissingString = modulesMissingString[2:] + modulesMissingString = modulesMissingString[:-2] + + return [LEVEL_INFO, "Missing Modules (" + str(len(modulesMissingList)) + ")", + """You are missing the following default modules:
    • """ + modulesMissingString + "
    "] diff --git a/loganalyzer.py b/loganalyzer.py index 8d3e041..650031f 100755 --- a/loganalyzer.py +++ b/loganalyzer.py @@ -188,6 +188,7 @@ def doAnalysis(url=None, filename=None): checkSnapPackage(logLines), checkX11Captures(logLines), checkDesktopEnvironment(logLines), + checkMissingModules(logLines), checkMacPermissions(logLines) ]) messages.extend(checkVideoSettings(logLines)) From c50a0a6b5883cbc8966ac6fc4c2fe91b3d103f27 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Fri, 31 May 2024 18:04:18 +0200 Subject: [PATCH 10/12] linux: Detect unavailable Virtual Cam --- checks/linux.py | 15 +++++++++++++++ loganalyzer.py | 1 + 2 files changed, 16 insertions(+) diff --git a/checks/linux.py b/checks/linux.py index 6473d33..6fc7081 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -157,3 +157,18 @@ def checkMissingModules(lines): return [LEVEL_INFO, "Missing Modules (" + str(len(modulesMissingList)) + ")", """You are missing the following default modules:
    • """ + modulesMissingString + "
    "] + + +def checkLinuxVCam(lines): + isDistroNix = search('Distribution:', lines) + isFlatpak = search('Flatpak Runtime:', lines) + + if (len(isDistroNix) <= 0) and (len(isFlatpak) <= 0): + return + + hasV4L2Module = search('v4l2loopback not installed', lines) + + if len(hasV4L2Module) > 0: + return [LEVEL_INFO, "Virtual Camera not available", + """Using the Virtual Camera requires the v4l2loopback kernel module to be installed.
    + If required, please refer to our Install Instructions on how to install this on your distribution."""] diff --git a/loganalyzer.py b/loganalyzer.py index 650031f..58a4570 100755 --- a/loganalyzer.py +++ b/loganalyzer.py @@ -189,6 +189,7 @@ def doAnalysis(url=None, filename=None): checkX11Captures(logLines), checkDesktopEnvironment(logLines), checkMissingModules(logLines), + checkLinuxVCam(logLines), checkMacPermissions(logLines) ]) messages.extend(checkVideoSettings(logLines)) From da544053012005af6d6a9d1e345a02d1897b5dc0 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Sat, 23 Nov 2024 01:18:24 +0100 Subject: [PATCH 11/12] linux: Fix potential `IndexError` issues --- checks/linux.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/checks/linux.py b/checks/linux.py index 6fc7081..6d43282 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -41,9 +41,7 @@ def checkSnapPackage(lines): if len(isDistroNix) <= 0: return - distro = isDistroNix[0].split() - # Snap Package logs "Ubuntu Core" as distro, so it gets split halfway - if distro[2] == '"Ubuntu' and distro[3] == 'Core"': + if '"Ubuntu Core"' in isDistroNix[0]: return [LEVEL_WARNING, "Snap Package", "You are using the Snap Package. This is a community-supported modified build of OBS Studio; please file issues on the Snapcrafters GitHub.

    OBS may be unable to assist with issues arising out of the usage of this package. We recommend following our Install Instructions instead."] @@ -59,13 +57,11 @@ def checkWayland(lines): if not sessionTypeLine: return - sessionType = sessionTypeLine.split()[3] - if sessionType != 'wayland': + if 'wayland' not in sessionTypeLine: return if len(isDistroNix) > 0: - distro = isDistroNix[0].split() - if distro[2] == '"Ubuntu"' and distro[3] == '"20.04"': + if '"Ubuntu" "20.04"' in isDistroNix[0]: return [LEVEL_CRITICAL, "Ubuntu 20.04 under Wayland", "Ubuntu 20.04 does not provide the needed dependencies for OBS to capture under Wayland.
    Capture will only function under X11/Xorg."] @@ -101,8 +97,7 @@ def checkX11Captures(lines): if not sessionTypeLine: return - sessionType = sessionTypeLine.split()[3] - if sessionType != 'x11': + if 'x11' not in sessionTypeLine: return # obsolete PW sources @@ -129,8 +124,12 @@ def checkDesktopEnvironment(lines): desktopEnvironmentLine = search('Desktop Environment:', lines) desktopEnvironment = desktopEnvironmentLine[0].split() - desktopEnvironment = desktopEnvironment[3:] - desktopEnvironment = ' '.join(desktopEnvironment) + + if (len(desktopEnvironment) > 3): + desktopEnvironment = desktopEnvironment[3:] + desktopEnvironment = ' '.join(desktopEnvironment) + else: + desktopEnvironment = '' if (len(desktopEnvironment) > 0): return [LEVEL_INFO, desktopEnvironment, ''] @@ -151,12 +150,12 @@ def checkMissingModules(lines): if len(modulesMissingList): modulesMissingString = str(modulesMissingList) + modulesMissingString = modulesMissingString.replace("['", "
    • ") modulesMissingString = modulesMissingString.replace("', '", "
    • ") - modulesMissingString = modulesMissingString[2:] - modulesMissingString = modulesMissingString[:-2] + modulesMissingString = modulesMissingString.replace("']", "
    ") return [LEVEL_INFO, "Missing Modules (" + str(len(modulesMissingList)) + ")", - """You are missing the following default modules:
    • """ + modulesMissingString + "
    "] + """You are missing the following default modules:
    """ + modulesMissingString] def checkLinuxVCam(lines): From 7a9865af00d9455a7b9c8139b0a7b8d7a92cdf7e Mon Sep 17 00:00:00 2001 From: Tarulia Date: Sat, 14 Dec 2024 00:49:51 +0100 Subject: [PATCH 12/12] linux: Remove helptexts for X11 and Wayland --- checks/linux.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/checks/linux.py b/checks/linux.py index 6d43282..ae35ab1 100644 --- a/checks/linux.py +++ b/checks/linux.py @@ -80,10 +80,7 @@ def checkWayland(lines): XDG Desktop Portal
    Note that the availability of Window and/or Display capture depends on your Desktop Environment's implementation of these portals."""] - return [LEVEL_INFO, "Wayland", - """Window and Display Captures are available via XDG Desktop Portal
    . - Please note that the availability of captures and specific features depends on your Desktop Environment's implementation of these portals.

    - Global Keyboard Shortcuts are not currently available under Wayland."""] + return [LEVEL_INFO, "Wayland", ""] def checkX11Captures(lines): @@ -111,8 +108,7 @@ def checkX11Captures(lines): """Most Desktop Environments do not implement the PipeWire capture portals on X11. This can result in being unable to pick a window or display, or the selected source will stay empty.

    We generally recommend using \"Window Capture (Xcomposite)\" on X11, as \"Display Capture (XSHM)\" can introduce bottlenecks depending on your setup."""] - return [LEVEL_INFO, "X11", - "If you wish to capture a window or an entire display, captures are available via Xcomposite and XSHM respectively. We generally recommend sticking to \"Window Capture (Xcomposite)\" since \"Display Capture (XSHM)\" can introduce bottlenecks depending on your setup."] + return [LEVEL_INFO, "X11", ""] def checkDesktopEnvironment(lines):