Efertone 3 years ago
parent
commit
c223134ff9
No known key found for this signature in database GPG Key ID: F484939122A96110
  1. 34
      tmux-spotify-info

34
tmux-spotify-info

@ -0,0 +1,34 @@
#!/usr/bin/env osascript
# Returns the current playing song in Spotify for OSX
tell application "Spotify"
if it is running then
if player state is playing then
set track_name to name of current track
set artist_name to artist of current track
# Progress
set max to duration of current track
set pos to player position * 1000
#set blocks to {"▏", "▏","▎","▍","▌","▋","▊","▉","█"}
set blocks to {"▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"}
set progress to (round(pos/max*8))+1
set perBlock to item progress of blocks
set leftSep to "▕"
set rightSep to "▏"
set percentage to leftSep & "#[fg=colour89]" & perBlock & "#[fg=colour16]" & rightSep
# End Progress
if artist_name > 0
# If the track has an artist set and is therefore most likely a song rather than an advert
" ♫ " & percentage & artist_name & " - " & track_name
else
# If the track doesn't have an artist set and is therefore most likely an advert rather than a song
" ~ " & percentage & track_name
end if
end if
end if
end tell
Loading…
Cancel
Save