subclient

Subsonic ncurses client
git clone https://git.e1e0.net/subclient.git
Log | Files | Refs | README | LICENSE

commit b354f301e77376b7860ca9f192bbf8327d19a7fc
parent 565655f2cce0358026afc9f7be5b8aeec7ca9d44
Author: Paco Esteban <paco@e1e0.net>
Date:   Fri, 19 Nov 2021 18:20:57 +0100

apply yapf formatting

Diffstat:
Msubclient/player.py | 7+++----
Msubclient/subclient.py | 13++++++++-----
Msubclient/subsonic.py | 7++++---
3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/subclient/player.py b/subclient/player.py @@ -26,7 +26,7 @@ class Player: if not os.path.isfile(filename): with open(filename, 'wb') as fp: while True: - chunk = stream.read(512*1024) + chunk = stream.read(512 * 1024) if not chunk: break fp.write(chunk) @@ -70,9 +70,8 @@ class Player: def get_list_info(self): playlist_total = self.mpv.playlist_count playlist_pos = self.mpv.playlist_pos_1 - if (playlist_total is None - or playlist_pos is None - or playlist_pos == -1): + if (playlist_total is None or playlist_pos is None + or playlist_pos == -1): return ' ' return f'{playlist_pos} of {playlist_total}' diff --git a/subclient/subclient.py b/subclient/subclient.py @@ -11,7 +11,6 @@ from subclient import subsonic from subclient import player from subclient import helpers - __version__ = 'v0.0.1' @@ -133,8 +132,8 @@ class SubClient: self.info_updater.start() def load_list(self): - for i, t in enumerate( - self.nav_list[self.nav_top:self.nav_top + self.nav_max_lines]): + for i, t in enumerate(self.nav_list[self.nav_top:self.nav_top + + self.nav_max_lines]): if i == self.nav_selected: self.listwin.addstr(i, 0, str(t), curses.A_REVERSE) else: @@ -229,7 +228,8 @@ class SubClient: self.nav_pages = self.nav_bottom // self.nav_max_lines def start_player(self): - self.playlist = self.nav_list[self.nav_top + self.nav_selected:self.nav_bottom] + self.playlist = self.nav_list[self.nav_top + + self.nav_selected:self.nav_bottom] self.player.play(self.playlist) def get_info(self): @@ -252,7 +252,10 @@ class SubClient: def clean_cache(self): cache_folder = helpers.get_cache_folder() - cache_folder_size = sum(os.path.getsize(f'{cache_folder}/{f}') for f in os.listdir(cache_folder) if os.path.isfile(f'{cache_folder}/{f}')) + cache_folder_size = sum( + os.path.getsize(f'{cache_folder}/{f}') + for f in os.listdir(cache_folder) + if os.path.isfile(f'{cache_folder}/{f}')) if cache_folder_size > int(self.config['subclient']['max_cache']): all_files = os.listdir(cache_folder) pl_files = [x.id for x in self.playlist] diff --git a/subclient/subsonic.py b/subclient/subsonic.py @@ -34,10 +34,11 @@ class Song: class Subsonic: - def __init__(self, config): - self.s = libsonic.Connection(config['url'], config['username'], - config['password'], port=443) + self.s = libsonic.Connection(config['url'], + config['username'], + config['password'], + port=443) def get_artists(self): artists = []