22 lines
532 B
Python
22 lines
532 B
Python
from spotify_shortcuts.spotify_auth import authenticated_session
|
|
from spotify_shortcuts.config import load_config
|
|
|
|
|
|
def main():
|
|
cfg = load_config()
|
|
sp = authenticated_session(cfg)
|
|
|
|
if (playback := sp.current_playback()) is None:
|
|
print("No current playback found.")
|
|
return
|
|
|
|
if (uri := playback.get("item", {}).get("uri", None)) is None:
|
|
print("No track URI found in current playback.")
|
|
return
|
|
|
|
sp.current_user_saved_tracks_add(tracks=[uri])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|