wireplumber/split-config-file.py

44 lines
1.6 KiB
Python
Raw Normal View History

#!/usr/bin/python3
import hashlib
import sys
Accepting request 1147639 from home:alarrosa:branches:multimedia:libs:devel - Add patch from upstream to remove the "clear-persistent" sub-command and add a "settings" sub-command: * 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch - Update to version 0.4.82 (0.5.0 pre-release 2) * Highlights: - Bluetooth auto-switching is now implemented with a virtual source node. When an application links to it, the actual device switches to the HSP/HFP profile to provide the real audio stream. This is a more robust solution that works with more applications and is more user-friendly than the previous application whitelist approach - Added support for dynamic log level changes via the PipeWire settings metadata. Also added support for log level patterns in the configuration file - The "persistent" (i.e. stored) settings approach has changed to use two different metadata objects: sm-settings and persistent-sm-settings. Changes in the former are applied in the current session but not stored, while changes in the latter are stored and restored at startup. Some work was also done to expose a wpctl interface to read and change these settings, but more is underway - Several WirePlumber-specific node properties that used to be called target.* have been renamed to node.* to match the PipeWire convention of node.dont-reconnect. These are also now fully documented * Other changes: - Many documentation updates - Added support for SNAP container permissions - Fixed multiple issues related to restoring the Route OBS-URL: https://build.opensuse.org/request/show/1147639 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=66
2024-02-20 09:29:47 +01:00
import re
def sha256_from_data(data):
hash_sha256 = hashlib.sha256()
hash_sha256.update(data)
return hash_sha256.hexdigest()
Accepting request 1147639 from home:alarrosa:branches:multimedia:libs:devel - Add patch from upstream to remove the "clear-persistent" sub-command and add a "settings" sub-command: * 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch - Update to version 0.4.82 (0.5.0 pre-release 2) * Highlights: - Bluetooth auto-switching is now implemented with a virtual source node. When an application links to it, the actual device switches to the HSP/HFP profile to provide the real audio stream. This is a more robust solution that works with more applications and is more user-friendly than the previous application whitelist approach - Added support for dynamic log level changes via the PipeWire settings metadata. Also added support for log level patterns in the configuration file - The "persistent" (i.e. stored) settings approach has changed to use two different metadata objects: sm-settings and persistent-sm-settings. Changes in the former are applied in the current session but not stored, while changes in the latter are stored and restored at startup. Some work was also done to expose a wpctl interface to read and change these settings, but more is underway - Several WirePlumber-specific node properties that used to be called target.* have been renamed to node.* to match the PipeWire convention of node.dont-reconnect. These are also now fully documented * Other changes: - Many documentation updates - Added support for SNAP container permissions - Fixed multiple issues related to restoring the Route OBS-URL: https://build.opensuse.org/request/show/1147639 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=66
2024-02-20 09:29:47 +01:00
lines = open('wireplumber.conf', 'r', encoding='utf-8').readlines()
Accepting request 1147639 from home:alarrosa:branches:multimedia:libs:devel - Add patch from upstream to remove the "clear-persistent" sub-command and add a "settings" sub-command: * 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch - Update to version 0.4.82 (0.5.0 pre-release 2) * Highlights: - Bluetooth auto-switching is now implemented with a virtual source node. When an application links to it, the actual device switches to the HSP/HFP profile to provide the real audio stream. This is a more robust solution that works with more applications and is more user-friendly than the previous application whitelist approach - Added support for dynamic log level changes via the PipeWire settings metadata. Also added support for log level patterns in the configuration file - The "persistent" (i.e. stored) settings approach has changed to use two different metadata objects: sm-settings and persistent-sm-settings. Changes in the former are applied in the current session but not stored, while changes in the latter are stored and restored at startup. Some work was also done to expose a wpctl interface to read and change these settings, but more is underway - Several WirePlumber-specific node properties that used to be called target.* have been renamed to node.* to match the PipeWire convention of node.dont-reconnect. These are also now fully documented * Other changes: - Many documentation updates - Added support for SNAP container permissions - Fixed multiple issues related to restoring the Route OBS-URL: https://build.opensuse.org/request/show/1147639 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=66
2024-02-20 09:29:47 +01:00
is_in_device_monitor = False
main_config_content = ''
device_monitors_content = ''
for line in lines:
if re.match(' *## Device monitors$', line):
main_config_content += line
main_config_content += ' # Section moved to a device-monitors.conf file which is provided by the wireplumber-audio package\n\n'
is_in_device_monitor = True
continue
elif re.match(' *## ', line):
is_in_device_monitor = False
if is_in_device_monitor:
device_monitors_content += line
else:
main_config_content += line
config_sha256 = sha256_from_data(device_monitors_content.encode('utf-8'))
verified_sha256 = 'bf33d018e5b924da71266636757fa264bc677b945c35e4dcd7f708da42731cc9'
if config_sha256 != verified_sha256:
print('The "Device monitors" section was modified, please verify that the contents are ok')
print('and if they are, modify the "verified_sha256" value in this script to')
print(f' {config_sha256}')
print('Current device monitors section is:')
print(device_monitors_content)
sys.exit(1)
Accepting request 1147639 from home:alarrosa:branches:multimedia:libs:devel - Add patch from upstream to remove the "clear-persistent" sub-command and add a "settings" sub-command: * 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch - Update to version 0.4.82 (0.5.0 pre-release 2) * Highlights: - Bluetooth auto-switching is now implemented with a virtual source node. When an application links to it, the actual device switches to the HSP/HFP profile to provide the real audio stream. This is a more robust solution that works with more applications and is more user-friendly than the previous application whitelist approach - Added support for dynamic log level changes via the PipeWire settings metadata. Also added support for log level patterns in the configuration file - The "persistent" (i.e. stored) settings approach has changed to use two different metadata objects: sm-settings and persistent-sm-settings. Changes in the former are applied in the current session but not stored, while changes in the latter are stored and restored at startup. Some work was also done to expose a wpctl interface to read and change these settings, but more is underway - Several WirePlumber-specific node properties that used to be called target.* have been renamed to node.* to match the PipeWire convention of node.dont-reconnect. These are also now fully documented * Other changes: - Many documentation updates - Added support for SNAP container permissions - Fixed multiple issues related to restoring the Route OBS-URL: https://build.opensuse.org/request/show/1147639 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=66
2024-02-20 09:29:47 +01:00
device_monitors_content = 'wireplumber.components = [\n' + device_monitors_content + ']'
Accepting request 1147639 from home:alarrosa:branches:multimedia:libs:devel - Add patch from upstream to remove the "clear-persistent" sub-command and add a "settings" sub-command: * 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch - Update to version 0.4.82 (0.5.0 pre-release 2) * Highlights: - Bluetooth auto-switching is now implemented with a virtual source node. When an application links to it, the actual device switches to the HSP/HFP profile to provide the real audio stream. This is a more robust solution that works with more applications and is more user-friendly than the previous application whitelist approach - Added support for dynamic log level changes via the PipeWire settings metadata. Also added support for log level patterns in the configuration file - The "persistent" (i.e. stored) settings approach has changed to use two different metadata objects: sm-settings and persistent-sm-settings. Changes in the former are applied in the current session but not stored, while changes in the latter are stored and restored at startup. Some work was also done to expose a wpctl interface to read and change these settings, but more is underway - Several WirePlumber-specific node properties that used to be called target.* have been renamed to node.* to match the PipeWire convention of node.dont-reconnect. These are also now fully documented * Other changes: - Many documentation updates - Added support for SNAP container permissions - Fixed multiple issues related to restoring the Route OBS-URL: https://build.opensuse.org/request/show/1147639 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=66
2024-02-20 09:29:47 +01:00
open('wireplumber.conf', 'w', encoding='utf-8').write(main_config_content)
open('wireplumber.conf.d/00-device-monitors.conf', 'w', encoding='utf-8').write(device_monitors_content)