├── README.md ├── cmus-artget.sh ├── cmus-up.sh └── cmus-feh.sh /README.md: -------------------------------------------------------------------------------- 1 | # cmus-scripts 2 | "cmus-feh.sh" is the main one. It's a status_display_program (https://github.com/cmus/cmus/wiki/status-display-programs) for showing cover art in a clean, efficient manner. It's the one thing Cmus desperately needs for an artwork lover such as myself. 3 | -------------------------------------------------------------------------------- /cmus-artget.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ## Download cover art for currently playing album in Cmus music player. 3 | 4 | ## Requires glyr 5 | 6 | ARTIST=$( cmus-remote -Q | grep "tag artist " | sed "s/tag artist //" ) 7 | ALBUM=$( cmus-remote -Q | grep "tag album " | sed "s/tag album //" ) 8 | FOLDER=$( cmus-remote -Q | grep "file" | sed "s/file //" | rev | \ 9 | cut -d"/" -f2- | rev ) 10 | 11 | glyrc cover -w "$FOLDER" -F "jpeg;png;jpg" --artist "$ARTIST" --album "$ALBUM" 12 | -------------------------------------------------------------------------------- /cmus-up.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ## Upload current track from Cmus to file host (in this case transfer.sh). 3 | ## Passing -t will transcode from FLAC to mp3 if applicable. 4 | ## Requires curl and ffmpeg. 5 | 6 | if ! cmus-remote -Q &>/dev/null; then 7 | echo "Cmus is not running." 8 | exit 9 | fi 10 | 11 | # Get path 12 | NP=$( cmus-remote -Q | grep "file" | sed "s/file //" ) 13 | echo -e "PATH: '$NP'\n" 14 | 15 | # If .flac AND if -t option passed, transcode to mp3 16 | if [[ "$1" == "-t" ]]; then 17 | if echo "$NP" | grep -q ".flac"; then 18 | echo -e "Transcoding FLAC to mp3...\n" 19 | ffmpeg -loglevel quiet -i "$NP" -qscale:a 0 "${NP[@]/%flac/mp3}" 20 | NP="${NP[@]/%flac/mp3}" 21 | MP3="1" 22 | fi 23 | fi 24 | 25 | # Get target 26 | NAME=$( echo "$NP"| rev | cut -d"/" -f1 | rev | sed "s| |%20|g" ) 27 | echo -e "TARGET: '$NAME'\n" 28 | 29 | # Upload 30 | curl --globoff --upload-file "$NP" "https://transfer.sh/$NAME" | xsel -i 31 | 32 | xsel -o 33 | 34 | if [[ "$MP3" == "1" ]]; then 35 | printf "\nRemoving temporary file..." 36 | rm "$NP" 37 | printf " Done." 38 | fi 39 | 40 | exit 41 | -------------------------------------------------------------------------------- /cmus-feh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ## 'status_display_program' for Cmus. Shows album art in a fixed size window. 3 | ## Use your window manager to automatically manipulate the window. 4 | ## There are several album art viewers for Cmus but this I believe is the most 5 | ## compatible with different setups as it is simpler. No weird hacks. 6 | 7 | ## Requires feh (light no-gui image viewer). 8 | 9 | FOLDER=$( cmus-remote -Q | grep "file" | sed "s/file //" | rev | \ 10 | cut -d"/" -f2- | rev ) 11 | 12 | FLIST=$( find "$FOLDER" -type f ) 13 | 14 | if echo "$FLIST" | grep -i ".jpeg\|.png\|.jpg" &>/dev/null; then 15 | ART=$( echo "$FLIST" | grep -i "cover.jpg\|cover.png\|front.jpg\|front.png\ 16 | \|folder.jpg\|folder.png" | head -n1 ) 17 | 18 | if [[ -z "$ART" ]]; then 19 | ART=$( echo "$FLIST" | grep -i ".png\|.jpg\|.jpeg" | head -n1 ) 20 | fi 21 | 22 | PROC=$( ps -eF | grep "feh" | grep -v "cmus\|grep" | cut -d"/" -f2- ) 23 | 24 | if [[ "/$PROC" == "$ART" ]]; then 25 | exit 26 | fi 27 | 28 | killall -q feh 29 | 30 | # '200x200' is the window size for the artwork. '+1160+546' is the offset. 31 | # For example, if you want a 250 by 250 window on the bottom right hand corner of a 1920 by 1080 screen: "250x250+1670+830" 32 | setsid feh -g 200x200+1160+546 -x --zoom fill "$ART" & 33 | else 34 | killall -q feh 35 | exit 36 | fi 37 | --------------------------------------------------------------------------------