#!/bin/bash #set -x AMAROK () #{{{ { ARTIST=`qdbus org.mpris.amarok /Player GetMetadata|grep ^artist|awk -F": " '{print $NF}'` SONG=`qdbus org.mpris.amarok /Player GetMetadata|grep ^title|awk -F": " '{print $NF}'` ALBUM=`qdbus org.mpris.amarok /Player GetMetadata|grep ^album|awk -F": " '{print $NF}'` echo "This was written under the influence of the following: | Artist : $ARTIST | Song : $SONG | Album : $ALBUM" } #}}} MPC () #{{{ { mpc current -f "[This was written under the influence of the following:\n\ > [Artist : %artist%]\n\ > [Song : %title%]\n\ > [Album : %album%]\ ]" } #}}} STANDARD () #{{{ { # Show this if Amarok is not running cat ~/.signature/sig.slrn } #}}} TV () { FREQ=`/usr/bin/v4l2-ctl -F|awk -F\( '{print $NF}'|awk -F. '{print $1}'` case "$FREQ" in 495) CHAN="VRT Een";; 615) CHAN="VRT Canvas/Ketnet";; 479) CHAN="VTM";; 487) CHAN="2 be";; 245) CHAN="VT4";; 182) CHAN="Vijf TV";; 259) CHAN="BBC One";; 711) CHAN="BBC Two";; 463) CHAN="Discovery Channel";; 551) CHAN="National Geographic";; 719) CHAN="Vitaya";; *) CHAN="Some Channel";; esac echo "This was written under the influence of the following tv channel:" echo ">" echo "> The one and only ${CHAN} as there is nothing else on." } #Amarok test TEST=`qdbus org.mpris.amarok /Player GetMetadata` if [ -n "$TEST" ]; then PLAYER=amarok; fi #mpc test TEST=`mpc current -f %artist%%title%%album%|sed '/^$/d'` if [ -n "$TEST" ];then PLAYER=mpc ; fi #TV test TEST=`fuser /dev/video0` if [ -n "$TEST" ];then PLAYER=tv ; fi # Deciding what to do case "$PLAYER" in amarok) AMAROK;; mpc) MPC;; tv) TV;; *) STANDARD;; esac