System Gen84 @ 2025-07-24-02:00:39 by jonas@monolith
This commit is contained in:
21
pkgs/spotify-shortcuts/spotify_shortcuts/spotify_like.py
Normal file
21
pkgs/spotify-shortcuts/spotify_shortcuts/spotify_like.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user