From e3a25e24298bcc91c575ebd53990f454f862ecf5 Mon Sep 17 00:00:00 2001 From: psykose Date: Tue, 15 Oct 2024 23:16:43 +0200 Subject: [PATCH] put user agent in one place --- src/api.vala | 2 +- src/globalconf.vala | 3 +++ src/meson.build | 1 + src/playbin.vala | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/globalconf.vala diff --git a/src/api.vala b/src/api.vala index 7e721c2..00fbc20 100644 --- a/src/api.vala +++ b/src/api.vala @@ -142,7 +142,7 @@ public class Subsonic : Object { this.parameters = @"u=$(Uri.escape_string(username))&t=$(Uri.escape_string(token))&s=$(Uri.escape_string(salt))&v=1.16.1&c=eu.callcc.audrey"; this.session = new Soup.Session (); - this.session.user_agent = "audrey/linux"; + this.session.user_agent = Audrey.Const.user_agent; this.artist_list = new ListStore (typeof (Artist)); this.album_list = new ListStore (typeof (Album)); diff --git a/src/globalconf.vala b/src/globalconf.vala new file mode 100644 index 0000000..e031072 --- /dev/null +++ b/src/globalconf.vala @@ -0,0 +1,3 @@ +namespace Audrey.Const { + public const string user_agent = "audrey/linux"; +} diff --git a/src/meson.build b/src/meson.build index f8ff5ea..8786109 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,6 +1,7 @@ audrey_sources = [ 'api.vala', 'application.vala', + 'globalconf.vala', 'main.vala', 'mpris.vala', 'playbin.vala', diff --git a/src/playbin.vala b/src/playbin.vala index 1b40397..dc4bd71 100644 --- a/src/playbin.vala +++ b/src/playbin.vala @@ -41,7 +41,7 @@ class Playbin : Object { private bool next_gapless; private void source_setup (Gst.Element playbin, dynamic Gst.Element source) { - source.user_agent = "audrey/linux"; + source.user_agent = Audrey.Const.user_agent; } // ASSUMPTION: about-to-finish will be signalled exactly once per track