diff --git a/libremsonic/app.py b/libremsonic/app.py index bbe56db..97a500f 100644 --- a/libremsonic/app.py +++ b/libremsonic/app.py @@ -1,4 +1,5 @@ import os +from os import environ import math import random @@ -50,8 +51,9 @@ class LibremsonicApp(Gtk.Application): config_file = config_file.get_bytestring().decode('utf-8') else: # Default to ~/.config/libremsonic. - config_folder = (os.environ.get('XDG_CONFIG_HOME') - or os.path.expanduser('~/.config')) + config_folder = (environ.get('XDG_CONFIG_HOME') + or environ.get('APPDATA') + or os.path.join(environ.get('HOME'), '.config')) config_folder = os.path.join(config_folder, 'libremsonic') config_file = os.path.join(config_folder, 'config.json') @@ -376,10 +378,10 @@ class LibremsonicApp(Gtk.Application): self.player.pause() self.chromecast_player.shutdown() self.mpv_player.shutdown() - CacheManager.should_exit = True self.state.save() self.save_play_queue() + CacheManager.shutdown() # ########## HELPER METHODS ########## # def show_configure_servers_dialog(self): diff --git a/libremsonic/cache_manager.py b/libremsonic/cache_manager.py index 6afb719..49530e9 100644 --- a/libremsonic/cache_manager.py +++ b/libremsonic/cache_manager.py @@ -71,6 +71,14 @@ class CacheManager(metaclass=Singleton): executor: ThreadPoolExecutor = ThreadPoolExecutor(max_workers=50) should_exit: bool = False + @staticmethod + def shutdown(): + # TODO fix this shutdown + CacheManager.should_exit = True + print('Shutdown start') + CacheManager.executor.shutdown() + print('Shutdown complete') + class CacheEncoder(json.JSONEncoder): def default(self, obj): if type(obj) == datetime: diff --git a/libremsonic/ui/artists.py b/libremsonic/ui/artists.py index 40564fb..8ed8e2b 100644 --- a/libremsonic/ui/artists.py +++ b/libremsonic/ui/artists.py @@ -323,6 +323,7 @@ class ArtistDetailPanel(Gtk.Box): label=text, name=name, halign=Gtk.Align.START, + xalign=0, **params, ) @@ -531,7 +532,7 @@ class AlbumWithSongs(Gtk.Box): allow_deselect = False def on_download_state_change(song_id=None): - GLib.idle_add(self.update_album_songs, self.album.id) + self.update_album_songs(self.album.id) # Use the new selection instead of the old one for calculating what # to do the right click on. diff --git a/libremsonic/ui/player_controls.py b/libremsonic/ui/player_controls.py index 31d233b..8ba817c 100644 --- a/libremsonic/ui/player_controls.py +++ b/libremsonic/ui/player_controls.py @@ -238,6 +238,7 @@ class PlayerControls(Gtk.ActionBar): return Gtk.Label( name=name, halign=Gtk.Align.START, + xalign=0, use_markup=True, ellipsize=Pango.EllipsizeMode.END, ) diff --git a/libremsonic/ui/util.py b/libremsonic/ui/util.py index 0a4c116..ec19fdd 100644 --- a/libremsonic/ui/util.py +++ b/libremsonic/ui/util.py @@ -157,8 +157,8 @@ def show_song_popover( # Determine if we should enable the download button. download_sensitive, remove_download_sensitive = False, False for song_id in song_ids: - details = CacheManager.get_song_details(song_id) - status = CacheManager.get_cached_status(details.result()) + details = CacheManager.get_song_details(song_id).result() + status = CacheManager.get_cached_status(details) if download_sensitive or status == SongCacheStatus.NOT_CACHED: download_sensitive = True