Commit Graph

285 Commits

Author SHA1 Message Date
coderkun 6ba8bc550f Bump version to 3.2.1 2023-02-28 13:18:07 +01:00
coderkun 21bd0f5832 Fix setting sort type on Library panel at startup (close #95) 2023-02-28 12:55:26 +01:00
coderkun bfb8eac62d Bump version to 3.2 2023-01-21 17:18:41 +01:00
coderkun 44fb332c62 Read cover with1 “readpicture” command if “albumart” is not found (close #90) 2023-01-21 15:37:29 +01:00
coderkun e976e05efe Fix setting sort order on Library panel (close #91) 2023-01-18 17:27:27 +01:00
coderkun a1e87e8994 Add new dependency “python-dateutil” to README 2023-01-18 17:27:27 +01:00
coderkun 8607bf15a9 Add option to sort by last modification date (close #88)
Store the metadate “last-modified” for a track and an album and add an
option sort by it.
2023-01-18 17:27:27 +01:00
coderkun 5618c9016c Always return tuple by get_albumart_now() (close #89) 2023-01-15 15:18:35 +01:00
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
coderkun 48b1d90fc8 Bump version to 3.1 2022-09-11 18:13:52 +02:00
coderkun 37b8701361 Use Markdown for README file (close #86) 2022-09-11 12:48:55 +02:00
coderkun fac7a85566 Use the build system “meson” (close #32)
Replace the build system “setuptools” with “meson”.
2022-09-11 12:31:13 +02:00
coderkun ff0eee8380 Bump version to 3.0.2 2022-09-11 12:28:24 +02:00
coderkun e63a3f2d4d 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.
2022-09-11 12:24:56 +02:00
Jeremy Fleischman 54717a3491 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 <file>..." 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.
2022-09-11 12:12:20 +02:00
coderkun 92737cd045 Update requirements in README
Add the minimum required version of GTK and MPD to the requirements in
the README.
2021-04-18 18:10:05 +02:00
coderkun ac14c8c7c7 Bump version to 3.0.1 2021-04-18 18:04:34 +02:00
coderkun 16030a2053 Fix icon path in setup.py 2021-04-18 18:03:55 +02:00
coderkun b90ce3299f Bump version to 3.0 2021-04-18 17:14:04 +02:00
coderkun 04effa0ec1 Fix error handling to operate on error number
Fix the handling of MPD errors to compare the error number instead of
the complete, unparsed error message.
2021-04-18 17:09:35 +02:00
coderkun f843cc629d Set logo for info dialog via code
Set the logo for the info dialog via code instead of UI file to fix
sizing issue.
2021-04-18 16:50:43 +02:00
coderkun faec824e8b Upate GTK UI files
Upate all GTK UI files by saving them with Glade 3.38.
2021-04-17 13:40:47 +02:00
coderkun 0a631877df Fix setting albumart on UI widgets 2020-10-24 14:58:28 +02:00
coderkun 8714d7a309 Update translation catalogues 2020-10-24 14:43:00 +02:00
coderkun 83082c3265 Add back shortcut to search the library 2020-10-24 14:37:38 +02:00
coderkun 32d02f2d9b Update GTK resources and schema to new domain (close #66) 2020-08-09 11:09:53 +02:00
coderkun ba373ddf4e Use GTK Composite Templates (close #62)
Use GTK Composite Templates for GUI elements to clean up and simplify
the code for widgets and all UI elements. This includes splitting the
large “gtk.glade” file into smaller .ui files and the large “widgets.py”
file into smaller .py files.
2020-08-09 10:57:01 +02:00
coderkun f4b545369c Merge release v2.1.2 2020-08-03 16:29:17 +02:00
coderkun 17fe4ee8ca Bump version to 2.1.2 2020-08-03 16:27:31 +02:00
coderkun 973d3dd921 Load playlist before status (close #72)
Load the playlist before loading the status for the idle event “changed”
to make sure the playlist information is attached to the current album
correctly.
2020-08-02 17:39:04 +02:00
coderkun bb8b816e8f Support “albumart” command (close #30)
Load the album covers using MPD’s new “albumart” command instead of
reading the covers from the harddrive. Remove the corresponding UI
elements and configuration option.
2020-07-26 09:40:33 +02:00
coderkun c53681ea82 Use custom buffer for reading from socket
Use the recv() method to read data from the socket instead of makefile()
to allow reading of binary data that is not text. This requires using a
custom buffer.
2020-07-26 09:40:33 +02:00
coderkun 83990c8796 Bump version to 2.1.1 2020-07-26 09:26:57 +02:00
coderkun ddf8368bfd Fix shortcut to exit fullscreen mode (close #71)
Fix the shortcut for fullscreen mode to also exit it. Additionally fix
the shortcuts window to show the correct shortcut for fullscreen mode.
2020-07-25 14:25:29 +02:00
coderkun 9ad3086ace Bump version to 2.1 2020-03-22 15:43:28 +01:00
coderkun 4708344d4d Fix localization in Utils class
Fix the localization in the Utils class by using the “gettext” instead
of the “locale” module.
2020-03-22 15:39:58 +01:00
coderkun 704fa3278a Show album length on Playlist and Library panel (close #57)
Show the length of an album in the tooltip on the Playlist and the
Library panel.
2020-03-22 11:19:03 +01:00
coderkun 477f89cc0b Init progress bar on Library panel (close #49)
Introduce two new callbacks for this: one when initializing the loading
of albums and another one on handling the loading of each album. Use the
first one to initialize and the second one to pulse the progress bar on
the Library panel.

Additionally use the text of the progress as status label instead of a
separate label widget.
2020-03-22 11:14:45 +01:00
coderkun 14d56452b6 Set max width for tracks on Cover panel (close #64) 2020-03-22 11:10:41 +01:00
coderkun 8ecc7176d7 Configure icon for application window (close #61) 2020-03-21 22:39:20 +01:00
coderkun 21f37dc62c Bump version to 2.0.2 2020-03-15 15:23:08 +01:00
coderkun aa196aa994 Save file “gtk.glade” with Glade 3.22.2 2020-03-15 15:22:40 +01:00
coderkun 6801dc9edd Fix setting default image
Fix setting the default image (if the selected/current album does not
has a cover) for the Cover panel, the Playlist panel and the Library
panel by using the default image instead of clearing the image widget.
Additionally fix the check for the empty URL String.
2020-03-15 15:19:04 +01:00
coderkun c8e24dc8c1 Update screenshots in readme 2019-03-23 18:14:36 +00:00
coderkun 02c859ec22 Bump version to 2.0.1 2019-02-17 00:08:28 +01:00
coderkun 202bfb424c Use “gettext” instead of “locale” for L10N
As the documentation on the “locale” module states, the “gettext” module
should be used instead. Therefore adjust the localization calls to use
gettext instead.

Additionally fix one button label which did not use localization at all
and update the message catalogues.
2019-02-17 00:03:57 +01:00
coderkun c22ce2557c Bump version to 2.0 2018-12-22 16:34:22 +01:00
coderkun 047f6d0a5c Force redrawing image when setting new cover 2018-12-22 16:28:42 +01:00
coderkun d5ca0126e5 Merge release v1.3.5 2018-11-10 16:36:35 +01:00
coderkun 424f9f200b Bump version to 1.3.5 2018-11-10 16:34:06 +01:00