You are not logged in.

#1 2005-03-12 10:33:00

kpiche
Forum Fellow
From: Ottawa, ON, Canada
Registered: 2004-03-30
Posts: 246
Website

cmus -> xosd script

Here's a helper script for cmus that displays song titles on the X display using xosd.  Naturally not useful for virtual consoles and you must have xosd installed.

#!/bin/bash
#---------------------------------------------------------------------
# cmus_osd - called from cmus to display song titles using xosd.
# 2005/03/12  K. Piche  Enjoy!
#
# Called from cmus as: cmus_osd key1 val1 key2 val2 ...
# EG: cmus_osd status playing file /music/foo.ogg title "Foo Bar" date "2005"
#
# Use cmus command ":set status_display_program=/path/cmus_osd" to use.
#---------------------------------------------------------------------

if [ -z $DISPLAY ]; then
        # X not running dont bother.
        exit 1;
fi
if [ ! -x /usr/bin/osd_cat ]; then
        echo -n Missing xosd package
        exit 1;
fi

#font='-*-lucida-*-*-*-*-*-240-*-*-*-*-*-*'
font='-*-courier-*-*-*-*-34-*-*-*-*-*-*-*'
col=green
off=30
pos=bottom
out=3
lines=2
delay=8

# convert key val arg pairs into variables.
while [[ $# -ge 2 ]]; do
        eval _$1="$2"
        shift
        shift
done

osd_cat -f $font -c $col -o $off -p $pos -O $out -l $lines -d $delay <<EOF
$_status
$_artist - $_title
EOF

To use, start cmus then enter the command ":set status_display_program=/path/to/cmus_osd".

Offline

#2 2011-02-16 07:32:10

elpresidento
Member
Registered: 2011-02-16
Posts: 1

Re: cmus -> xosd script

I found this great script for cmus, but it didnt work for me. I fix it and I remove freezing when OSD is displayed.

#!/bin/bash
#---------------------------------------------------------------------
# cmus_osd - called from cmus to display song titles using xosd.
# 2005/03/12  K. Piche  Enjoy!
# 2011/02/15  elPresidento - fixed eval, fixed freezing
#
# Called from cmus as: cmus_osd key1 val1 key2 val2 ...
# EG: cmus_osd status playing file /music/foo.ogg title "Foo Bar" date "2005"
#
# Use cmus command ":set status_display_program=/path/cmus_osd" to use.
# cmus v2.3.3 - status file artist album tracknumber title date duration
#---------------------------------------------------------------------

if [ -z $DISPLAY ]; then
        # X not running dont bother.
        exit 1;
fi
if [ ! -x /usr/bin/osd_cat ]; then
        echo -n Missing xosd package
        exit 1;
fi

#font='-*-lucida-*-*-*-*-*-240-*-*-*-*-*-*'
font='-*-courier-*-*-*-*-20-*-*-*-*-*-*-*'
col=yellow
off=30
pos=bottom
out=2
lines=3
delay=8

# convert key val arg pairs into variables.
while [[ $# -ge 2 ]]; do
        eval _$1='$2'
        shift
        shift
done
#osd_cat -f $font -c $col -o $off -p $pos -O $out -l $lines -d $delay <<EOF
#$_status
#$_album - $_date
#$_artist - $_title
#EOF
killall osd_cat
echo -e "$_status\n$_album - $_date\n$_artist - $_title" | osd_cat -f $font -c $col -o $off -p $pos -O $out -l $lines -d $delay &

Offline

Board footer

Powered by FluxBB