A covergrid for the Music Player Daemon, focusing on albums instead of single tracks.
Go to file
Jeremy Fleischman ea71d96dd7
Don't assume that size file is valid
I don't know how my cache got into this state, but I had an empty size
file:

    $ cat ~/.cache/mcg/127.0.0.1/size

    $ stat ~/.cache/mcg/127.0.0.1/size
      File: /home/jeremy/.cache/mcg/127.0.0.1/size
      Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
    Device: 254,0	Inode: 18493061    Links: 1
    Access: (0644/-rw-r--r--)  Uid: ( 1000/  jeremy)   Gid: (  100/   users)
    Access: 2022-09-14 00:18:32.942885525 -0700
    Modify: 2022-09-07 12:32:44.151734944 -0700
    Change: 2022-09-07 12:32:44.151734944 -0700
     Birth: 2022-08-25 10:01:01.729717504 -0700

This was causing mcg's Library view to crash like this:

    (.mcg-wrapped:879276): Gtk-CRITICAL **: 00:19:15.727: gtk_window_add_accel_group: assertion 'GTK_IS_WINDOW (window)' failed
    Exception in thread Thread-1 (_set_playlist):
    Traceback (most recent call last):
      File "/nix/store/c1vb2z3c64i0sd92iz7fv0lb720qcvhb-python3-3.10.6/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
        self.run()
      File "/nix/store/c1vb2z3c64i0sd92iz7fv0lb720qcvhb-python3-3.10.6/lib/python3.10/threading.py", line 953, in run
        self._target(*self._args, **self._kwargs)
      File "/nix/store/l935dwmk93sq2chr4xxiipv9amyfcg43-CoverGrid-3.1/share/mcg/mcg/playlistpanel.py", line 256, in _set_playlist
        cache = client.MCGCache(host, size)
      File "/nix/store/l935dwmk93sq2chr4xxiipv9amyfcg43-CoverGrid-3.1/share/mcg/mcg/client.py", line 1279, in __init__
        self._read_size()
      File "/nix/store/l935dwmk93sq2chr4xxiipv9amyfcg43-CoverGrid-3.1/share/mcg/mcg/client.py", line 1293, in _read_size
        size = int(f.readline())
    ValueError: invalid literal for int() with base 10: ''

Maybe mcg crashed while writing the `size` file at some point? I see
that it writes directly to the size file, which seems potentially risky:
it would probably be safer to write to a temp file and then (atomically)
move it. Still, it seems like a good practice to be resilient here.

After this change, here's what I see get printed by mcg:

    (.mcg-wrapped:889856): Gtk-CRITICAL **: 00:37:00.045: gtk_window_add_accel_group: assertion 'GTK_IS_WINDOW (window)' failed
    2022-09-14 00:37:00,076 WARNING: invalid cache file: /home/jeremy/.cache/mcg/127.0.0.1/size, deleting file
    Traceback (most recent call last):
      File "/nix/store/vzgcfs00nq543hjk8hrk81k1rs8aqpqw-CoverGrid-3.1/share/mcg/mcg/client.py", line 1295, in _read_size
        size = int(f.readline())
    ValueError: invalid literal for int() with base 10: ''

And then the problem goes away =)
2022-09-14 00:37:52 -07:00
data Bump version to 3.1 2022-09-11 18:13:52 +02:00
po Use the build system “meson” (close #32) 2022-09-11 12:31:13 +02:00
src Don't assume that size file is valid 2022-09-14 00:37:52 -07:00
.gitignore Use the build system “meson” (close #32) 2022-09-11 12:31:13 +02:00
CONTRIBUTING.textile Fix links, inline code and typos in the contribution guide 2018-09-02 10:05:37 +00:00
LICENSE Update website, links and e‑mail address 2018-03-20 22:40:10 +01:00
meson.build Bump version to 3.1 2022-09-11 18:13:52 +02:00
README.md Use Markdown for README file (close #86) 2022-09-11 12:48:55 +02:00

CoverGrid

CoverGrid (mcg) is a client for the Music Player Daemon (MPD), focusing on albums instead of single tracks. It is not intended to be a replacement for your favorite MPD client but an addition to get a better album-experience.

Website: https://www.suruatoel.xyz/codes/mcg

License: GPL v3

Dependencies:

Additionally a MPD server (version >= 0.21.0) is required at runtime.

Building

Build the application with meson and ninja:

$ meson build
$ ninja -C build

Running/Testing

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:

$ meson --prefix $(pwd)/install build
$ ninja -C build
$ ninja -C build install

After that you can run it with mesons devenv command:

$ meson devenv -C build src/mcg

Installing

Install the application system-wide with meson (after building):

$ ninja -C build install

Note: On Linux using the distributions package manager is the preferred way of installing applications system-wide.

Screenshots

CoverGrid’s cover panel with album details and track list.

CoverGrid’s playlist panel with queued albums.

CoverGrid’s library panel showing the albums middle-sized.

CoverGrid’s library panel showing the albums small-sized.