From 54a32061db9b1f2ac8d952b34d768cac66a08f9666e58e5625a67fe86a2ee803 Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Mon, 26 Feb 2018 11:56:28 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/pulseaudio-equalizer?expand=0&rev=15 --- 0001-pulse-path.patch | 78 +++++++++++----------- 0002-remove-preamp.patch | 10 +-- 0003-force-default-persistence-value.patch | 4 +- 0005-window-icon.patch | 13 ++-- 0007-pygobject3-port.patch | 32 +++++---- 0008-fix-locale-issues.patch | 2 +- pulseaudio-equalizer.changes | 6 +- 7 files changed, 74 insertions(+), 71 deletions(-) diff --git a/0001-pulse-path.patch b/0001-pulse-path.patch index beb2fdd..2cbcb4c 100644 --- a/0001-pulse-path.patch +++ b/0001-pulse-path.patch @@ -6,17 +6,17 @@ -PRESET_DIR1=$HOME/.pulse/presets +if [ -z "$XDG_CONFIG_HOME" ]; then -+ PULSE_DIR="$HOME/.config/pulse" ++ CONFIG_DIR="$HOME/.config/pulse" +else -+ PULSE_DIR="$XDG_CONFIG_HOME/pulse" ++ CONFIG_DIR="$XDG_CONFIG_HOME/pulse" +fi -+PRESET_DIR1="$PULSE_DIR/presets" ++PRESET_DIR1="$CONFIG_DIR/presets" PRESET_DIR2=/usr/share/pulseaudio-equalizer/presets SCRIPT_NAME=pulseaudio-equalizer SCRIPT_VERSION="2.7 (05/02/2010)" -CONFIG_NAME=$HOME/.pulse/equalizerrc -LOG_NAME=$HOME/Desktop/pulseaudio-equalizer.log -+CONFIG_NAME="$PULSE_DIR/equalizerrc" ++CONFIG_NAME="$CONFIG_DIR/equalizerrc" +LOG_NAME="$HOME/pulseaudio-equalizer.log" # Don't execute the script with elevated privileges @@ -29,8 +29,8 @@ - if [ "$(cat $HOME/.pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then - PA_EQUALIZER_PERSISTENCE=1 - fi -+if [ -f "$PULSE_DIR/default.pa" ]; then -+ if [ "$(cat "$PULSE_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then ++if [ -f "$CONFIG_DIR/default.pa" ]; then ++ if [ "$(cat "$CONFIG_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then + PA_EQUALIZER_PERSISTENCE=1 + fi else @@ -45,8 +45,8 @@ - if [ -f $HOME/.pulse/default.pa ]; then - tail -n7 $HOME/.pulse/default.pa -+ if [ -f "$PULSE_DIR/default.pa" ]; then -+ tail -n7 "$PULSE_DIR/default.pa" ++ if [ -f "$CONFIG_DIR/default.pa" ]; then ++ tail -n7 "$CONFIG_DIR/default.pa" fi echo "---" @@ -58,10 +58,10 @@ - if [ "$(cat $HOME/.pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then - echo "Equalizer definition detected in file '$HOME/.pulse/default.pa', deleting..." - rm $HOME/.pulse/default.pa -+ if [ -f "$PULSE_DIR/default.pa" ]; then -+ if [ "$(cat "$PULSE_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then -+ echo "Equalizer definition detected in file '$PULSE_DIR/default.pa', deleting..." -+ rm "$PULSE_DIR/default.pa" ++ if [ -f "$CONFIG_DIR/default.pa" ]; then ++ if [ "$(cat "$CONFIG_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then ++ echo "Equalizer definition detected in file '$CONFIG_DIR/default.pa', deleting..." ++ rm "$CONFIG_DIR/default.pa" fi fi @@ -70,19 +70,19 @@ - echo "Found '$HOME/.pulse/default.pa', making a copy..." - cp $HOME/.pulse/default.pa $HOME/.pulse/default.pa.noeq - CFG_SOURCE_FILE="$HOME/.pulse/default.pa.noeq" -+ if [ -f "$PULSE_DIR/default.pa" ]; then -+ echo "Found '$PULSE_DIR/default.pa', making a copy..." -+ cp "$PULSE_DIR/default.pa" "$PULSE_DIR/default.pa.noeq" -+ CFG_SOURCE_FILE="$PULSE_DIR/default.pa.noeq" ++ if [ -f "$CONFIG_DIR/default.pa" ]; then ++ echo "Found '$CONFIG_DIR/default.pa', making a copy..." ++ cp "$CONFIG_DIR/default.pa" "$CONFIG_DIR/default.pa.noeq" ++ CFG_SOURCE_FILE="$CONFIG_DIR/default.pa.noeq" fi # Decide which file to use as the configuration source - if [ -f $HOME/.pulse/default.pa.noeq ]; then - echo "Found '$HOME/.pulse/default.pa.noeq'..." - CFG_SOURCE_FILE="$HOME/.pulse/default.pa.noeq" -+ if [ -f "$PULSE_DIR/default.pa.noeq" ]; then -+ echo "Found '$PULSE_DIR/default.pa.noeq'..." -+ CFG_SOURCE_FILE="$PULSE_DIR/default.pa.noeq" ++ if [ -f "$CONFIG_DIR/default.pa.noeq" ]; then ++ echo "Found '$CONFIG_DIR/default.pa.noeq'..." ++ CFG_SOURCE_FILE="$CONFIG_DIR/default.pa.noeq" else CFG_SOURCE_FILE="/etc/pulse/default.pa" fi @@ -91,27 +91,27 @@ # Modify module-stream-restore line to disable cached sinks - cat $CFG_SOURCE_FILE | sed 's/load-module module-stream-restore/load-module module-stream-restore restore_device=false/g' >$HOME/.pulse/default.pa -+ cat "$CFG_SOURCE_FILE" | sed 's/load-module module-stream-restore/load-module module-stream-restore restore_device=false/g' >"$PULSE_DIR/default.pa" ++ cat "$CFG_SOURCE_FILE" | sed 's/load-module module-stream-restore/load-module module-stream-restore restore_device=false/g' >"$CONFIG_DIR/default.pa" # Add module-ladspa-sink definition - echo "" >>$HOME/.pulse/default.pa - echo "### BEGIN: Equalized audio configuration" >>$HOME/.pulse/default.pa - echo "### Generated from: $SCRIPT_NAME" >>$HOME/.pulse/default.pa - echo "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS" >>$HOME/.pulse/default.pa -+ echo "" >>"$PULSE_DIR/default.pa" -+ echo "### BEGIN: Equalized audio configuration" >>"$PULSE_DIR/default.pa" -+ echo "### Generated from: $SCRIPT_NAME" >>"$PULSE_DIR/default.pa" -+ echo "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS" >>"$PULSE_DIR/default.pa" ++ echo "" >>"$CONFIG_DIR/default.pa" ++ echo "### BEGIN: Equalized audio configuration" >>"$CONFIG_DIR/default.pa" ++ echo "### Generated from: $SCRIPT_NAME" >>"$CONFIG_DIR/default.pa" ++ echo "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS" >>"$CONFIG_DIR/default.pa" # Set LADSPA sink as default sink & set appropriate master sink (preamp) volume - echo "set-default-sink $PA_LADSPA_SINK" >>$HOME/.pulse/default.pa - echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>$HOME/.pulse/default.pa - echo "set-sink-mute $PA_MASTER_SINK 0" >>$HOME/.pulse/default.pa - echo "### END: Equalized audio configuration" >>$HOME/.pulse/default.pa -+ echo "set-default-sink $PA_LADSPA_SINK" >>"$PULSE_DIR/default.pa" -+ echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>"$PULSE_DIR/default.pa" -+ echo "set-sink-mute $PA_MASTER_SINK 0" >>"$PULSE_DIR/default.pa" -+ echo "### END: Equalized audio configuration" >>"$PULSE_DIR/default.pa" ++ echo "set-default-sink $PA_LADSPA_SINK" >>"$CONFIG_DIR/default.pa" ++ echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>"$CONFIG_DIR/default.pa" ++ echo "set-sink-mute $PA_MASTER_SINK 0" >>"$CONFIG_DIR/default.pa" ++ echo "### END: Equalized audio configuration" >>"$CONFIG_DIR/default.pa" echo "Equalizer setting saved (enable-config)." echo "-------------------------------------" @@ -122,9 +122,9 @@ - if [ -f $HOME/.pulse/default.pa.noeq ]; then - echo "Found '$HOME/.pulse/default.pa.noeq', moving..." - mv $HOME/.pulse/default.pa.noeq $HOME/.pulse/default.pa -+ if [ -f "$PULSE_DIR/default.pa.noeq" ]; then -+ echo "Found '$PULSE_DIR/default.pa.noeq', moving..." -+ mv "$PULSE_DIR/default.pa.noeq" "$PULSE_DIR/default.pa" ++ if [ -f "$CONFIG_DIR/default.pa.noeq" ]; then ++ echo "Found '$CONFIG_DIR/default.pa.noeq', moving..." ++ mv "$CONFIG_DIR/default.pa.noeq" "$CONFIG_DIR/default.pa" fi # If equalizer configuration is present, delete file @@ -132,10 +132,10 @@ - if [ "$(cat $HOME/.pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then - echo "Equalizer definition detected, deleting '$HOME/.pulse/default.pa'..." - rm $HOME/.pulse/default.pa -+ if [ -f "$PULSE_DIR/default.pa" ]; then -+ if [ "$(cat "$PULSE_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then -+ echo "Equalizer definition detected, deleting '$PULSE_DIR/default.pa'..." -+ rm "$PULSE_DIR/default.pa" ++ if [ -f "$CONFIG_DIR/default.pa" ]; then ++ if [ "$(cat "$CONFIG_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then ++ echo "Equalizer definition detected, deleting '$CONFIG_DIR/default.pa'..." ++ rm "$CONFIG_DIR/default.pa" fi fi @@ -145,8 +145,8 @@ - if [ -f $HOME/.pulse/default.pa ]; then - if [ "$(cat $HOME/.pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then -+ if [ -f "$PULSE_DIR/default.pa" ]; then -+ if [ "$(cat "$PULSE_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then ++ if [ -f "$CONFIG_DIR/default.pa" ]; then ++ if [ "$(cat "$CONFIG_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then echo "Equalizer configuration status: [enabled]" else echo "Equalizer configuration status: [disabled]" @@ -156,8 +156,8 @@ - if [ -f $HOME/.pulse/default.pa ]; then - if [ "$(cat $HOME/.pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then -+ if [ -f "$PULSE_DIR/default.pa" ]; then -+ if [ "$(cat "$PULSE_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then ++ if [ -f "$CONFIG_DIR/default.pa" ]; then ++ if [ "$(cat "$CONFIG_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then echo "Equalizer configuration status: [enabled]" echo "Equalizer plugin: [$PA_LADSPA_PLUGIN/$PA_LADSPA_LABEL]" echo "Equalizer control: [$PA_LADSPA_CONTROLS]" diff --git a/0002-remove-preamp.patch b/0002-remove-preamp.patch index fe64641..7adfe06 100644 --- a/0002-remove-preamp.patch +++ b/0002-remove-preamp.patch @@ -3,11 +3,11 @@ @@ -293,7 +293,7 @@ if [ "$1" = "enable-config" ]; then # Set LADSPA sink as default sink & set appropriate master sink (preamp) volume - echo "set-default-sink $PA_LADSPA_SINK" >>"$PULSE_DIR/default.pa" -- echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>"$PULSE_DIR/default.pa" -+ #echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>"$PULSE_DIR/default.pa" - echo "set-sink-mute $PA_MASTER_SINK 0" >>"$PULSE_DIR/default.pa" - echo "### END: Equalized audio configuration" >>"$PULSE_DIR/default.pa" + echo "set-default-sink $PA_LADSPA_SINK" >>"$CONFIG_DIR/default.pa" +- echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>"$CONFIG_DIR/default.pa" ++ #echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>"$CONFIG_DIR/default.pa" + echo "set-sink-mute $PA_MASTER_SINK 0" >>"$CONFIG_DIR/default.pa" + echo "### END: Equalized audio configuration" >>"$CONFIG_DIR/default.pa" @@ -383,7 +383,7 @@ if [ "$1" = "enable" ]; then diff --git a/0003-force-default-persistence-value.patch b/0003-force-default-persistence-value.patch index 3546a39..b11fb9c 100644 --- a/0003-force-default-persistence-value.patch +++ b/0003-force-default-persistence-value.patch @@ -1,8 +1,8 @@ --- a/usr/bin/pulseaudio-equalizer +++ b/usr/bin/pulseaudio-equalizer @@ -133,6 +133,8 @@ fi - if [ -f "$PULSE_DIR/default.pa" ]; then - if [ "$(cat "$PULSE_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then + if [ -f "$CONFIG_DIR/default.pa" ]; then + if [ "$(cat "$CONFIG_DIR/default.pa" | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then PA_EQUALIZER_PERSISTENCE=1 + else + PA_EQUALIZER_PERSISTENCE=0 diff --git a/0005-window-icon.patch b/0005-window-icon.patch index 4721827..b3357f4 100644 --- a/0005-window-icon.patch +++ b/0005-window-icon.patch @@ -1,6 +1,6 @@ --- a/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py +++ b/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py -@@ -364,7 +364,19 @@ class Equalizer: +@@ -364,7 +364,16 @@ class Equalizer: self.window.connect("destroy", self.destroy_equalizer) self.window.set_title(windowtitle + " [" + realstatus + "]") self.window.set_border_width(0) @@ -8,16 +8,13 @@ + + icon_theme = Gtk.icon_theme_get_default() + if icon_theme.has_icon("multimedia-volume-control"): -+ icon = icon_theme.load_icon("multimedia-volume-control", 16, 0) -+ self.window.set_icon(icon) ++ self.window.set_icon_name("multimedia-volume-control") + elif icon_theme.has_icon("gnome-volume-control"): -+ icon = icon_theme.load_icon("gnome-volume-control",16,0) -+ self.window.set_icon(icon) ++ self.window.set_icon_name("gnome-volume-control") + elif icon_theme.has_icon("stock_volume"): -+ icon = icon_theme.load_icon("stock_volume",16,0) -+ self.window.set_icon(icon) ++ self.window.set_icon_name("stock_volume") + else: -+ print("No icon found, window will be iconless") ++ print("No icon found, the window will be iconless") menu = Gtk.Menu() diff --git a/0007-pygobject3-port.patch b/0007-pygobject3-port.patch index 39c205b..d8fcc72 100644 --- a/0007-pygobject3-port.patch +++ b/0007-pygobject3-port.patch @@ -64,9 +64,9 @@ - icon_theme = Gtk.icon_theme_get_default() + icon_theme = Gtk.IconTheme.get_default() if icon_theme.has_icon("multimedia-volume-control"): - icon = icon_theme.load_icon("multimedia-volume-control", 16, 0) - self.window.set_icon(icon) -@@ -380,42 +385,59 @@ class Equalizer: + self.window.set_icon_name("multimedia-volume-control") + elif icon_theme.has_icon("gnome-volume-control"): +@@ -377,42 +382,61 @@ class Equalizer: menu = Gtk.Menu() @@ -130,6 +130,8 @@ - preampscale = Gtk.VScale() + if GTK_VERSION >= (3, 2, 0): + preampscale = Gtk.Scale(orientation=Gtk.Orientation.VERTICAL) ++ preampscale.set_hexpand(True) ++ preampscale.set_vexpand(True) + else: + preampscale = Gtk.VScale() preampscale.set_draw_value(0) @@ -139,7 +141,7 @@ preampscale.set_range(0.0, 2.0) preampscale.set_increments(1, 0.1) preampscale.set_digits(1) -@@ -426,16 +448,25 @@ class Equalizer: +@@ -423,16 +447,25 @@ class Equalizer: label.set_markup("Preamp") preampscalevalue = Gtk.Label() preampscalevalue.set_markup(str(preampscale.get_value()) + "x") @@ -151,9 +153,9 @@ + grid.attach(preampscale, 1, 1, 1, 1) + grid.attach(preampscalevalue, 1, 2, 1, 1) + else: -+ grid.attach(label, 1, 2, 0, 1) -+ grid.attach(preampscale, 1, 2, 1, 2) -+ grid.attach(preampscalevalue, 1, 2, 2, 3) ++ grid.attach(label, 1, 2, 0, 1, yoptions=Gtk.AttachOptions.SHRINK) ++ grid.attach(preampscale, 1, 2, 1, 2, yoptions=(Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL)) ++ grid.attach(preampscalevalue, 1, 2, 2, 3, yoptions=Gtk.AttachOptions.SHRINK) #label.show() #preampscale.show() #preampscalevalue.show() @@ -170,13 +172,15 @@ #separator.show() # Equalizer bands -@@ -444,11 +475,14 @@ class Equalizer: +@@ -441,11 +474,16 @@ class Equalizer: self.labels = {} self.scalevalues = {} for x in range(1,num_ladspa_controls+1): - scale = Gtk.VScale() + if GTK_VERSION >= (3, 2, 0): + scale = Gtk.Scale(orientation=Gtk.Orientation.VERTICAL) ++ scale.set_hexpand(True) ++ scale.set_vexpand(True) + else: + scale = Gtk.VScale() self.scales[x] = scale @@ -187,7 +191,7 @@ scale.set_range(float(ranges[0]), float(ranges[1])) scale.set_increments(1, 0.1) scale.set_digits(1) -@@ -462,67 +496,79 @@ class Equalizer: +@@ -459,67 +497,80 @@ class Equalizer: scalevalue = Gtk.Label() self.scalevalues[x] = scalevalue scalevalue.set_markup("" + str(scale.get_value()) + "\ndB") @@ -199,9 +203,9 @@ + grid.attach(scale, x + 2, 1, 1, 1) + grid.attach(scalevalue, x + 2, 2, 1, 1) + else: -+ grid.attach(label, x + 2, x + 3, 0, 1) -+ grid.attach(scale, x + 2, x + 3, 1, 2) -+ grid.attach(scalevalue, x + 2, x + 3, 2, 3) ++ grid.attach(label, x + 2, x + 3, 0, 1, yoptions=Gtk.AttachOptions.SHRINK) ++ grid.attach(scale, x + 2, x + 3, 1, 2, yoptions=(Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL)) ++ grid.attach(scalevalue, x + 2, x + 3, 2, 3, yoptions=Gtk.AttachOptions.SHRINK) label.show() scale.show() scalevalue.show() @@ -211,13 +215,15 @@ - vbox2 = Gtk.VBox(True, 1) - vbox2.set_border_width(10) +- hbox1.add(vbox2) + if GTK_VERSION >= (3, 0, 0): + vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=True, spacing=1) + vbox2.props.margin = 10 ++ hbox1.add(vbox2) + else: + vbox2 = Gtk.VBox(homogeneous=True, spacing=1) + vbox2.set_border_width(10) - hbox1.add(vbox2) ++ hbox1.pack_start(vbox2, False, True, 0) vbox2.show() presetslabel = Gtk.Label() diff --git a/0008-fix-locale-issues.patch b/0008-fix-locale-issues.patch index eefb7fa..192db5e 100644 --- a/0008-fix-locale-issues.patch +++ b/0008-fix-locale-issues.patch @@ -6,7 +6,7 @@ +LC_MESSAGES=C if [ -z "$XDG_CONFIG_HOME" ]; then - PULSE_DIR="$HOME/.config/pulse" + CONFIG_DIR="$HOME/.config/pulse" else @@ -113,20 +114,20 @@ fi diff --git a/pulseaudio-equalizer.changes b/pulseaudio-equalizer.changes index 3cb4c39..56e43cd 100644 --- a/pulseaudio-equalizer.changes +++ b/pulseaudio-equalizer.changes @@ -2,13 +2,13 @@ Sun Feb 25 18:16:05 UTC 2018 - sor.alexei@meowr.ru - Add 0000-add-python3-compat.patch: Add Python3 compatibility. -- Rebase and improve 0001-pulse-path.patch. +- Rebase and improve 0001-pulse-path.patch, 0005-window-icon.patch. - Squash 0007-remove-all-preamp.patch into 0002-remove-preamp.patch. - Rebase 0003-force-default-persistence-value.patch, - 0004-do-not-crash-on-missing-preset.patch, 0005-window-icon.patch, + 0004-do-not-crash-on-missing-preset.patch, 0008-fix-locale-issues.patch, 0009-do-not-zero-volume.patch. - Add 0007-pygobject3-port.patch: Port to PyGObject3 and GTK+3. -- Unwrap pulseaudio-equalizer-gtk. +- Do not use a wrapper for pulseaudio-equalizer-gtk. - Switch to Python3. -------------------------------------------------------------------