Fixed an issue with Gonic not returning anything on getArtistInfo2 if no LastFM API key is specified

This commit is contained in:
Sumner Evans
2020-06-15 19:30:28 -06:00
parent 3017893756
commit fee0e4e507
4 changed files with 19 additions and 10 deletions

View File

@@ -538,9 +538,14 @@ class SubsonicAdapter(Adapter):
def get_artist(self, artist_id: str) -> API.Artist:
artist = self._get_json(self._make_url("getArtist"), id=artist_id).artist
assert artist, f"Error getting artist {artist_id}"
artist.augment_with_artist_info(
self._get_json(self._make_url("getArtistInfo2"), id=artist_id).artist_info
)
try:
artist.augment_with_artist_info(
self._get_json(
self._make_url("getArtistInfo2"), id=artist_id
).artist_info
)
except Exception:
pass
return artist
def get_ignored_articles(self) -> Set[str]:

View File

@@ -1010,6 +1010,8 @@ class SublimeMusicApp(Gtk.Application):
def do_update(f: Result[PlayQueue]):
play_queue = f.result()
if not play_queue:
return
play_queue.position = play_queue.position or timedelta(0)
new_play_queue = tuple(s.id for s in play_queue.songs)

View File

@@ -44,6 +44,12 @@ class PlayerManager:
self.device_id_type_map: Dict[str, Type] = {}
self._current_device_id: Optional[str] = None
def callback_wrapper(pde: PlayerDeviceEvent):
self.device_id_type_map[pde.id] = pde.player_type
player_device_change_callback(pde)
self.player_device_change_callback = callback_wrapper
self.players = {
player_type: player_type(
self.on_timepos_change,
@@ -55,12 +61,6 @@ class PlayerManager:
for player_type in PlayerManager.available_player_types
}
def callback_wrapper(pde: PlayerDeviceEvent):
self.device_id_type_map[pde.id] = pde.player_type
player_device_change_callback(pde)
self.player_device_change_callback = callback_wrapper
has_done_one_retrieval = multiprocessing.Value("b", False)
def shutdown(self):

View File

@@ -419,6 +419,8 @@ class PlayerControls(Gtk.ActionBar):
for i, (player_type, players) in enumerate(
app_config.state.available_players.items()
):
if len(players) == 0:
continue
if i > 0:
self.device_list.add(
Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
@@ -431,7 +433,7 @@ class PlayerControls(Gtk.ActionBar):
)
)
for player_id, player_name in sorted(players, key=lambda p: p[1]):
for player_id, player_name in players:
icon = (
"audio-volume-high-symbolic"
if player_id == self.current_device