Fixed activating playlist over dbus
This commit is contained in:
@@ -306,14 +306,13 @@ class SublimeMusicApp(Gtk.Application):
|
|||||||
playlist = CacheManager.get_playlist(playlist_id).result()
|
playlist = CacheManager.get_playlist(playlist_id).result()
|
||||||
|
|
||||||
# Calculate the song id to play.
|
# Calculate the song id to play.
|
||||||
song_id = playlist.entry[0].id
|
song_idx = 0
|
||||||
if self.state.shuffle_on:
|
if self.state.shuffle_on:
|
||||||
rand_idx = random.randint(0, len(playlist.entry) - 1)
|
song_idx = random.randint(0, len(playlist.entry) - 1)
|
||||||
song_id = playlist.entry[rand_idx].id
|
|
||||||
|
|
||||||
self.on_song_clicked(
|
self.on_song_clicked(
|
||||||
None,
|
None,
|
||||||
song_id,
|
song_idx,
|
||||||
[s.id for s in playlist.entry],
|
[s.id for s in playlist.entry],
|
||||||
{'active_playlist_id': playlist_id},
|
{'active_playlist_id': playlist_id},
|
||||||
)
|
)
|
||||||
|
@@ -87,7 +87,8 @@ class Server:
|
|||||||
def _subsonic_error_to_exception(self, error) -> Exception:
|
def _subsonic_error_to_exception(self, error) -> Exception:
|
||||||
return Exception(f'{error.code}: {error.message}')
|
return Exception(f'{error.code}: {error.message}')
|
||||||
|
|
||||||
def _get(self, url, timeout=(3.05, 2), **params):
|
# def _get(self, url, timeout=(3.05, 2), **params):
|
||||||
|
def _get(self, url, **params):
|
||||||
params = {**self._get_params(), **params}
|
params = {**self._get_params(), **params}
|
||||||
print(f'[START] get: {url}')
|
print(f'[START] get: {url}')
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ class Server:
|
|||||||
url,
|
url,
|
||||||
params=params,
|
params=params,
|
||||||
verify=not self.disable_cert_verify,
|
verify=not self.disable_cert_verify,
|
||||||
timeout=timeout,
|
# timeout=timeout,
|
||||||
)
|
)
|
||||||
# TODO make better
|
# TODO make better
|
||||||
if result.status_code != 200:
|
if result.status_code != 200:
|
||||||
@@ -144,7 +145,7 @@ class Server:
|
|||||||
def do_download(self, url, **params) -> bytes:
|
def do_download(self, url, **params) -> bytes:
|
||||||
print('download', url)
|
print('download', url)
|
||||||
download = self._get(url, **params)
|
download = self._get(url, **params)
|
||||||
if 'json' in download.get('Content-Type'):
|
if 'json' in download.headers.get('Content-Type'):
|
||||||
# TODO make better
|
# TODO make better
|
||||||
raise Exception("Didn't expect JSON.")
|
raise Exception("Didn't expect JSON.")
|
||||||
return download.content
|
return download.content
|
||||||
|
Reference in New Issue
Block a user