Created
July 5, 2010 18:50
-
-
Save RobertAudi/464598 to your computer and use it in GitHub Desktop.
Script used to show info about the song playing in moc using GeekTool on OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # First let's check if moc is running... | |
| if [[ $(ps aux | grep mocp | grep -v grep | wc -l) -gt 0 ]]; | |
| then | |
| out=$(/opt/local/bin/mocp -i) | |
| # Parse mocp output. | |
| while IFS=: read -r field value; do | |
| case $field in | |
| Artist) artist=$value;; | |
| Album) album=$value;; | |
| SongTitle) title=$value;; | |
| esac | |
| done <<< "$out" | |
| if [[ $1 ]] | |
| then | |
| case "$1" in | |
| 'artist'|'ARTIST'|'Artist') | |
| echo $artist | |
| ;; | |
| 'song'|'SONG'|'Song') | |
| echo $title | |
| ;; | |
| 'album'|'ALBUM'|'Album') | |
| echo $album | |
| ;; | |
| *) | |
| echo "$1" | |
| ;; | |
| esac | |
| else | |
| echo "$title by $artist (album: $album)" | |
| fi | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment