Skip to content

Commit

Permalink
Other small pep8 style convention corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
misiektoja committed May 18, 2024
1 parent 180bf32 commit b855780
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spotify_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
SMTP_PASSWORD = "your_smtp_password"
SMTP_SSL = True
SENDER_EMAIL = "your_sender_email"
#SMTP_HOST = "your_smtp_server_plaintext"
#SMTP_PORT = 25
#SMTP_USER = "your_smtp_user"
#SMTP_PASSWORD = "your_smtp_password"
#SMTP_SSL = False
#SENDER_EMAIL = "your_sender_email"
# SMTP_HOST = "your_smtp_server_plaintext"
# SMTP_PORT = 25
# SMTP_USER = "your_smtp_user"
# SMTP_PASSWORD = "your_smtp_password"
# SMTP_SSL = False
# SENDER_EMAIL = "your_sender_email"
RECEIVER_EMAIL = "your_receiver_email"

# How often do we perform checks for user activity, you can also use -c parameter; in seconds
Expand Down Expand Up @@ -508,7 +508,7 @@ def spotify_get_friends_json(access_token):
def spotify_convert_uri_to_url(uri):
# add si parameter so link opens in native Spotify app after clicking
si = "?si=1"
# si=""
# si=""

url = ""
if "spotify:user:" in uri:
Expand Down Expand Up @@ -644,11 +644,11 @@ def spotify_get_playlist_info(access_token, playlist_uri):


def spotify_macos_play_song(sp_track_uri_id, method=SPOTIFY_MACOS_PLAYING_METHOD):
if method == "apple-script": # apple-script
if method == "apple-script": # apple-script
script = f'tell app "Spotify" to play track "spotify:track:{sp_track_uri_id}"'
proc = subprocess.Popen(['osascript', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
stdout, stderr = proc.communicate(script)
else: # trigger-url - just trigger track URL in the client
else: # trigger-url - just trigger track URL in the client
subprocess.call(('open', spotify_convert_uri_to_url(f"spotify:track:{sp_track_uri_id}")))


Expand All @@ -669,7 +669,7 @@ def spotify_linux_play_song(sp_track_uri_id, method=SPOTIFY_LINUX_PLAYING_METHOD
subprocess.call((f"dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri string:'spotify:track:{sp_track_uri_id}'"), shell=True)
elif method == "qdbus": # qdbus
subprocess.call((f"qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri spotify:track:{sp_track_uri_id}"), shell=True)
else: # trigger-url - just trigger track URL in the client
else: # trigger-url - just trigger track URL in the client
subprocess.call(('xdg-open', spotify_convert_uri_to_url(f"spotify:track:{sp_track_uri_id}")), stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)


Expand Down

0 comments on commit b855780

Please sign in to comment.