From 92737cd04544baa638356e3443409a0ad0f56401 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 18 Apr 2021 18:10:05 +0200 Subject: [PATCH 01/52] Update requirements in README Add the minimum required version of GTK and MPD to the requirements in the README. --- README.textile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.textile b/README.textile index d8ce767..98c9d12 100644 --- a/README.textile +++ b/README.textile @@ -9,11 +9,12 @@ License: "GPL":http://www.gnu.org/licenses/gpl.html v3 Dependencies: * "Python":http://www.python.org 3 -* "GTK":http://www.gtk.org 3 ("python-gobject":https://live.gnome.org/PyGObject) +* "GTK":http://www.gtk.org 3 (>= 3.22) ("python-gobject":https://live.gnome.org/PyGObject) * "Avahi":http://www.avahi.org (optional) * "python-keyring":http://pypi.python.org/pypi/keyring (optional) * "python-setuptools":https://pypi.python.org/pypi/setuptools (building) +Additionally a "MPD":http://www.musicpd.org server (version >= 0.21.0) is required at runtime. h2. Building From 54717a3491c82efee6faf6abee69a09e6a09de84 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Thu, 25 Aug 2022 09:15:30 -0700 Subject: [PATCH 02/52] Fix build When doing a `python setup.py build` on my machine, I found that `build/lib` would not end up with a compiled gresource file until the second invocation of `python setup.py build`. Before: $ python setup.py build running build running build_py creating build creating build/lib creating build/lib/mcg copying mcg/connectionpanel.py -> build/lib/mcg copying mcg/shortcutsdialog.py -> build/lib/mcg copying mcg/serverpanel.py -> build/lib/mcg copying mcg/application.py -> build/lib/mcg copying mcg/window.py -> build/lib/mcg copying mcg/playlistpanel.py -> build/lib/mcg copying mcg/utils.py -> build/lib/mcg copying mcg/coverpanel.py -> build/lib/mcg copying mcg/infodialog.py -> build/lib/mcg copying mcg/librarypanel.py -> build/lib/mcg copying mcg/client.py -> build/lib/mcg copying mcg/zeroconf.py -> build/lib/mcg copying mcg/mcg.py -> build/lib/mcg copying mcg/__init__.py -> build/lib/mcg copying mcg/albumheaderbar.py -> build/lib/mcg package init file 'data/__init__.py' not found (or not a regular file) compiling gresources compiling gschemas $ ls build/lib/mcg/data/ ls: cannot access 'build/lib/mcg/data/': No such file or directory Note how there is no data directory at all. Now check out what happens on the second build: $ git status On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add ..." to include in what will be committed) data/gschemas.compiled data/xyz.suruatoel.mcg.gresource nothing added to commit but untracked files present (use "git add" to track) $ python setup.py build running build running build_py package init file 'data/__init__.py' not found (or not a regular file) creating build/lib/mcg/data copying data/xyz.suruatoel.mcg.gresource -> build/lib/mcg/data compiling gresources compiling gschemas $ ls build/lib/mcg/data/ xyz.suruatoel.mcg.gresource That's because the first build generated the compiled schemas and resources (you can see evidence of that in `git status`), and then the second build was able to copy the gresource file over according to the `package_data` rules. The fix I've introduced here is to just do the compilations *before* we call `super(...).run(...)`. There might be better ways of doing this, I'm not very familiar with packaging gtk python applications. Things were even worse for the gschemas.compiled file: in addition to the ordering issue it's not even mentioned in `data_files`, so even if it does exist, it doesn't have a chance to get copied over when installed. So I've added it to the `data_files` section. I don't know if that'll play nicely or not with the existing `--no-compile-schemas` flag. --- setup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6237487..9d400af 100644 --- a/setup.py +++ b/setup.py @@ -29,11 +29,14 @@ class build_mcg(build_py): def run(self, *args, **kwargs): - super(self.__class__, self).run(*args, **kwargs) self._build_gresources() if not self.distribution.no_compile_schemas: self._build_gschemas() + # This will copy the package_data and data_files, so we need to do this + # *after* we've compiled resources and schemas. + super(self.__class__, self).run(*args, **kwargs) + def _build_gresources(self): print("compiling gresources") @@ -92,7 +95,8 @@ setup( "data/icons/mcg.svg" ]), (os.path.join('share', 'glib-2.0', 'schemas'), [ - "data/xyz.suruatoel.mcg.gschema.xml" + "data/xyz.suruatoel.mcg.gschema.xml", + "data/gschemas.compiled", ]), (os.path.join('share', 'locale', 'en', 'LC_MESSAGES'), [ 'locale/en/LC_MESSAGES/mcg.mo' From e63a3f2d4d69eaecb80574075b4563bfb99066b0 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 11 Sep 2022 12:24:56 +0200 Subject: [PATCH 03/52] Fix volume button (close #84) Fix both the icon of the volume button and setting the volume if the mixer does not allow it by using -1 as default value instead of 0. --- data/ui/window.ui | 4 ---- mcg/client.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/data/ui/window.ui b/data/ui/window.ui index c1fea7f..1fb9a36 100644 --- a/data/ui/window.ui +++ b/data/ui/window.ui @@ -181,10 +181,6 @@ Adjust the volume none vertical - audio-volume-muted - audio-volume-high - audio-volume-low - audio-volume-medium diff --git a/mcg/client.py b/mcg/client.py index 166a18c..3367205 100644 --- a/mcg/client.py +++ b/mcg/client.py @@ -439,7 +439,7 @@ class Client(Base): if 'time' in status: time = int(status['time'].split(':')[0]) # Volume - volume = 0 + volume = -1 if 'volume' in status: volume = int(status['volume']) # Error From ff0eee8380c9ba534bf0304037cbd92ee08562fa Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 11 Sep 2022 12:28:24 +0200 Subject: [PATCH 04/52] Bump version to 3.0.2 --- data/ui/info-dialog.ui | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/ui/info-dialog.ui b/data/ui/info-dialog.ui index e2dc642..7fef32c 100644 --- a/data/ui/info-dialog.ui +++ b/data/ui/info-dialog.ui @@ -10,7 +10,7 @@ dialog center CoverGrid - 3.0.1 + 3.0.2 CoverGrid is a client for the Music Player Daemon, focusing on albums instead of single tracks. http://www.suruatoel.xyz/codes/mcg diff --git a/setup.py b/setup.py index 9d400af..4f03440 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ setup( 'build_py': build_mcg }, name = "mcg", - version = '3.0.1', + version = '3.0.2', description = "CoverGrid (mcg) is a client for the Music Player Daemon, focusing on albums instead of single tracks.", url = "http://www.suruatoel.xyz/codes/mcg", author = "coderkun", From fac7a85566b01c9180b28474ab488fd04b0ee060 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 5 Jun 2022 18:13:22 +0200 Subject: [PATCH 05/52] =?UTF-8?q?Use=20the=20build=20system=20=E2=80=9Cmes?= =?UTF-8?q?on=E2=80=9D=20(close=20#32)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the build system “setuptools” with “meson”. --- .gitignore | 6 +- README.textile | 54 +-- .../scalable/apps/xyz.suruatoel.mcg.svg} | 0 data/icons/meson.build | 7 + data/mcg.desktop | 2 +- data/meson.build | 34 ++ data/ui/info-dialog.ui | 2 +- data/ui/window.ui | 2 +- data/xyz.suruatoel.mcg.gresource.xml | 1 - mcg/mcg.py | 44 --- meson.build | 19 + po/LINGUAS | 1 + po/POTFILES | 29 ++ locale/de/LC_MESSAGES/mcg.mo => po/de.mo | Bin locale/de/LC_MESSAGES/mcg.po => po/de.po | 181 ++++++--- locale/en/LC_MESSAGES/mcg.mo => po/en.mo | Bin locale/en/LC_MESSAGES/mcg.po => po/en.po | 180 ++++++--- po/mcg.pot | 373 ++++++++++++++++++ po/meson.build | 3 + setup.py | 119 ------ {mcg => src}/__init__.py | 0 {mcg => src}/albumheaderbar.py | 0 {mcg => src}/application.py | 30 +- {mcg => src}/client.py | 0 {mcg => src}/connectionpanel.py | 0 {mcg => src}/coverpanel.py | 0 {mcg => src}/infodialog.py | 9 - {mcg => src}/librarypanel.py | 6 +- src/main.py | 11 + src/mcg.in | 25 ++ src/meson.build | 38 ++ {mcg => src}/playlistpanel.py | 0 {mcg => src}/serverpanel.py | 0 {mcg => src}/shortcutsdialog.py | 0 {mcg => src}/utils.py | 8 +- {mcg => src}/window.py | 25 +- {mcg => src}/zeroconf.py | 0 37 files changed, 848 insertions(+), 361 deletions(-) rename data/icons/{mcg.svg => hicolor/scalable/apps/xyz.suruatoel.mcg.svg} (100%) create mode 100644 data/icons/meson.build create mode 100644 data/meson.build delete mode 100755 mcg/mcg.py create mode 100644 meson.build create mode 100644 po/LINGUAS create mode 100644 po/POTFILES rename locale/de/LC_MESSAGES/mcg.mo => po/de.mo (100%) rename locale/de/LC_MESSAGES/mcg.po => po/de.po (61%) rename locale/en/LC_MESSAGES/mcg.mo => po/en.mo (100%) rename locale/en/LC_MESSAGES/mcg.po => po/en.po (60%) create mode 100644 po/mcg.pot create mode 100644 po/meson.build delete mode 100644 setup.py rename {mcg => src}/__init__.py (100%) rename {mcg => src}/albumheaderbar.py (100%) rename {mcg => src}/application.py (71%) rename {mcg => src}/client.py (100%) rename {mcg => src}/connectionpanel.py (100%) rename {mcg => src}/coverpanel.py (100%) rename {mcg => src}/infodialog.py (54%) rename {mcg => src}/librarypanel.py (99%) create mode 100644 src/main.py create mode 100755 src/mcg.in create mode 100644 src/meson.build rename {mcg => src}/playlistpanel.py (100%) rename {mcg => src}/serverpanel.py (100%) rename {mcg => src}/shortcutsdialog.py (100%) rename {mcg => src}/utils.py (90%) rename {mcg => src}/window.py (98%) rename {mcg => src}/zeroconf.py (100%) diff --git a/.gitignore b/.gitignore index 244c3ee..f42fdfe 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,5 @@ __pycache__/ *.py[cod] *$py.class -# Files created by setuptools -build/ -dist/ -*.egg-info/ +/build/ +/install/ diff --git a/README.textile b/README.textile index 98c9d12..ea0a822 100644 --- a/README.textile +++ b/README.textile @@ -12,62 +12,42 @@ Dependencies: * "GTK":http://www.gtk.org 3 (>= 3.22) ("python-gobject":https://live.gnome.org/PyGObject) * "Avahi":http://www.avahi.org (optional) * "python-keyring":http://pypi.python.org/pypi/keyring (optional) -* "python-setuptools":https://pypi.python.org/pypi/setuptools (building) +* "meson":https://mesonbuild.com/ and "ninja":https://ninja-build.org/ (building) Additionally a "MPD":http://www.musicpd.org server (version >= 0.21.0) is required at runtime. + h2. Building -Build the application with _setuptools_: +Build the application with _meson_ and _ninja_: -bc. $ python3 setup.py build +bc. $ meson build +$ ninja -C build h2. Running/Testing -For testing the application and running it without (system-wide) installation, donwload/clone the code, build it as described above and then use _setuptools_ to install it for the current user: +For testing the application and running it without (system-wide) installation, +donwload/clone the code, build it with the @--prefix@ option and install it +with @ninja@: -bc. $ python3 setup.py develop --user +bc. $ meson --prefix $(pwd)/install build +$ ninja -C build +$ ninja -C build install -After that you can run it with +After that you can run it with _meson’s_ @devenv@ command: -bc. $ ~/.local/bin/mcg - -or if _~/.local/bin/_ is on your PATH - -bc. $ mcg +bc. $ meson devenv -C build src/mcg h2. Installing -Install the application system-wide with _setuptools_: +Install the application system-wide with _meson_ (after building): -bc. # python3 setup.py install +bc. $ ninja -C build install -Note: _On Linux using the distribution’s package manager is the preferred way of installing applications system-wide._ - - -h2. Packaging - -Create a distribution package with _setuptools_: - -bc. $ python3 setup.py sdist - - -h2. Cover/image configuration - -Since MPD itself does not provide the cover/image/album art binaries, yet, _mcg_ has to look for them itself. In order to find the images a base folder has to be configured on the Connection tab as “Image Directory”. This value can either be a local (absolute) folder (e. g. /home/user/music/) or an http URL (e. g. http://localhost/music/). _mcg_ then adds the (relative) folder of the audio file to this paths and tries different names for the actual file: - -# the album name -# “cover” -# “folder” - -The following file extensions are used: - -# png -# jpg - -The first combination that results in an existing file is used as cover image. If no matching file exists, _mcg_ will try to traverse the directory for any image file as fallback—this is done for local paths only though, not for http URLs. +Note: _On Linux using the distribution’s package manager is the preferred way +of installing applications system-wide._ h2. Screenshots diff --git a/data/icons/mcg.svg b/data/icons/hicolor/scalable/apps/xyz.suruatoel.mcg.svg similarity index 100% rename from data/icons/mcg.svg rename to data/icons/hicolor/scalable/apps/xyz.suruatoel.mcg.svg diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 0000000..20bdb7c --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,7 @@ +application_id = 'xyz.suruatoel.mcg' + +scalable_dir = join_paths('hicolor', 'scalable', 'apps') +install_data( + join_paths(scalable_dir, ('@0@.svg').format(application_id)), + install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) +) diff --git a/data/mcg.desktop b/data/mcg.desktop index 81a2717..2b6067e 100644 --- a/data/mcg.desktop +++ b/data/mcg.desktop @@ -4,7 +4,7 @@ Name=CoverGrid (mcg) Comment=CoverGrid for the Music Player Daemon Keywords=mpd; Type=Application -Icon=mcg.svg +Icon=xyz.suruatoel.mcg Exec=mcg Categories=AudioVideo; StartupNotify=true diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..4de86c0 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,34 @@ +i18n = import('i18n') + +desktop_file = i18n.merge_file( + input: 'mcg.desktop', + output: 'mcg.desktop', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +desktop_utils = find_program('desktop-file-validate', required: false) +if desktop_utils.found() + test('Validate desktop file', desktop_utils, + args: [desktop_file] + ) +endif + +gnome = import('gnome') +pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) + +gnome.compile_resources('mcg', + 'xyz.suruatoel.mcg.gresource.xml', + gresource_bundle: true, + install: true, + install_dir: pkgdatadir, +) + +install_data('xyz.suruatoel.mcg.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') +) +gnome.compile_schemas(depend_files: files('xyz.suruatoel.mcg.gschema.xml')) + +subdir('icons') diff --git a/data/ui/info-dialog.ui b/data/ui/info-dialog.ui index 7fef32c..924c75f 100644 --- a/data/ui/info-dialog.ui +++ b/data/ui/info-dialog.ui @@ -13,7 +13,7 @@ 3.0.2 CoverGrid is a client for the Music Player Daemon, focusing on albums instead of single tracks. http://www.suruatoel.xyz/codes/mcg - + xyz.suruatoel.mcg gpl-3-0 diff --git a/data/ui/window.ui b/data/ui/window.ui index 1fb9a36..5e24217 100644 --- a/data/ui/window.ui +++ b/data/ui/window.ui @@ -4,7 +4,7 @@