diff --git a/spotfm.example.toml b/spotfm.example.toml index 7f71061..badf06b 100644 --- a/spotfm.example.toml +++ b/spotfm.example.toml @@ -7,3 +7,8 @@ password_hash = "" [spotify] client_id = "" client_secret = "" + +excluded_playlists = [ + # , + # ... +] \ No newline at end of file diff --git a/spotfm/cli.py b/spotfm/cli.py index a017401..c2f66e9 100644 --- a/spotfm/cli.py +++ b/spotfm/cli.py @@ -21,8 +21,8 @@ def count_tracks_by_playlists(): print(f"{playlist}: {count}") -def update_playlists(client): - client.update_playlists() +def update_playlists(client, excluded_playlists): + client.update_playlists(excluded_playlists) def lastfm_cli(args, config): @@ -51,7 +51,7 @@ def spotify_cli(args, config): case "count-tracks": count_tracks(args.playlists) case "update-playlists": - update_playlists(client) + update_playlists(client, config["spotify"]["excluded_playlists"]) def main(): diff --git a/spotfm/spotify.py b/spotfm/spotify.py index 7ec7e1c..1a8152c 100644 --- a/spotfm/spotify.py +++ b/spotfm/spotify.py @@ -27,7 +27,7 @@ def __init__(self, client_id, client_secret, redirect_uri=REDIRECT_URI, scope=SC redirect_uri=redirect_uri, scope=scope, cache_handler=handler, - ) + ), ) def get_playlists_id(self, excluded_playlists=[]): @@ -49,8 +49,8 @@ def filter_playlists(playlists): return playlists_ids - def update_playlists(self): - playlists_id = self.get_playlists_id() + def update_playlists(self, excluded_playlists=[]): + playlists_id = self.get_playlists_id(excluded_playlists) utils.query_db(utils.DATABASE, ["DELETE FROM playlists", "DELETE FROM playlists_tracks"]) for playlist_id in playlists_id: Playlist(playlist_id, self.client)