Elisa and MPD

vaquerito
2009-04-03
2012-12-10
  • vaquerito
    vaquerito
    2009-04-03

    Hi, I've found and (ugly) fixed two little issue so I'd like to share.

    1) In Elisa, the back button doesn't work due to bad mapping
    --> in /usr/share/anyremote/cfg-data/Server-mode/elisa.cfg replace the relative line with 0=Emulate(key,BackSpace);

    2) When using all-in-one_v2, mpd doesn't show up in the list, even if it is already started and with full playlist, in fact looking at ~/.anyRemote/AllInOneTmp.cfg it seems ignored
    I managed to get it in the list by adding the line relative to an icon and copying the position of Macro(ALLIN1MENU); from the mplayer.cfg
    --> replace /usr/share/anyremote/cfg-data/Server-mode/mpd.cfg with conf below
    I don't know if that's the way it should be done but it works.

    Hope it helps,
    vaquerito

    mpd.cfg
    [code]
    %
    % anyremote configuration file for MPD management (Server-mode)
    %
    % prerequisites: mpc client, mpd must be started already with playlist prepared
    %

    % STATUS stable
    % TODO who must start mpd and prepare playlist?
    % XTEST no
    % SOUND app
    % ENV no

    % Uncomment if needed
    %AutoRepeat=false
    %Baudrate=19200
    %Device=bluetooth:19
    %Log=true
    Screen=true

    GuiAppName=MPD
    GuiAppBinary=mpc
    GuiAppRun=echo 'P=`ps -ef|grep mpd|grep -v grep|grep -v anyremote|grep -v nedit|grep -v mpd.cfg`; if [ "x$P" == "x" ]; then echo NOK; else echo OK; fi' | bash -f -s
    GuiAppIcon=mplayer.png
    GuiAppType=Application
    GuiAppDesc=Music Player Daemon (MPD) allows remote access for playing music.

    [Aliases]
    % Cancel buttons on different phones
    -11=Cancel
    -8=Cancel
    69=Cancel
    [End]

    [Keys]

    (Init)=Macro(CheckMPC);\     Macro(CheckMPD);\     Macro(CheckPL);\     Make(var,home,echo $HOME);
       
    (Connect)=Make(mode,mpd);\     Load($(Home)/.anyRemote/hook_connect);

    Cancel=Exit

    CheckMPC=Exec(echo 'P=`which mpc 2> /dev/null|grep mpc|grep -v no|wc -l|tr -d " "`; if [ "x$P" == "x0" ]; then $(CfgDir)/Utils/message.sh "ERROR: mpc client is not installed"; fi'|bash -f -s);
    CheckMPD=Exec(echo 'P=`ps -ef|grep mpd|grep -v grep|grep -v mpd.cfg|wc -l|tr -d " "`; if [ "x$P" == "x0" ]; then $(CfgDir)/Utils/message.sh "ERROR: mpd is not run"; fi'|bash -f -s);
    CheckPL =Exec(echo 'P=`mpc playlist 2> /dev/null|wc -l|tr -d " "`; if [ "x$P" == "x0" ]; then $(CfgDir)/Utils/message.sh "ERROR: mpd playlist is empty"; fi'|bash -f -s);

    MPD_SETTILE=ExecAndSet(title,sleep 1;mpc|head  -1|sed "s/.*\///;s/(/-/g;s/)/-/g");

    [Mode]=mpd

    (EnterMode)=Make(var,mpd_volume,by_value,-1);\     Macro(FILLPLAYLIST);\     Set(icons,MPD,1,vol_down,2,mute,3,vol_up,4,rewind,5,play,6,forward,7,prev,8,stop,9,next,*,question,0,pause,#,no);\     Set(font,small);\     Set(menu,replace,Playlist,Toggle Shuffle,Toggle Repeat);\     Macro(ALLIN1MENU)

    (ExitMode) =Timer(MPD_SETTILE,cancel)

    Cancel        =Exit
    Back          =Set(text,close);Set(menu,replace,Playlist,Toggle Shuffle,Toggle Repeat);Macro(ALLIN1MENU);
    Toggle Shuffle=Exec(mpc shuffle);
    Toggle Repeat =Exec(mpc repeat);
    Playlist      =Make(mode,mpd_playlist);

    1=Exec(mpc volume -5)
    2=Make(var,mpd_volume,echo 'if [ "x$(mpd_volume)" == "x-1" ]; then mpc volume|tr -s " "|cut -f 2 -d " "|sed "s/%//";mpc volume 0 > /dev/null; else mpc volume $(mpd_volume) > /dev/null;echo "-1"; fi;'|bash -f -s)
    3=Exec(mpc volume +5)

    4=Exec(mpc seek -00:00:05)
    5=Exec(mpc play);Timer(MPD_SETTILE,5,0)
    6=Exec(mpc seek +00:00:05)

    7=Exec(mpc prev);Macro(MPD_SETTILE)
    8=Exec(mpc stop);Timer(MPD_SETTILE,cancel)
    9=Exec(mpc next);Macro(MPD_SETTILE)

    * *=Set(text,replace,Help,1 Vol-  2 Mute  3 Vol+\n4 Rew   5 Play  6 FF\n7 Prew  8 Stop  9 Next\n* Help  0 Pause);
    0=Exec(mpc toggle);
    #=Exec(mpd --kill);

    [ModeEnd]

    [Mode]=mpd_playlist

    (EnterMode)=Timer(MPD_SETTILE,cancel);Set(list,font,medium);ExecAndSet(list,replace,Playlist,mpc playlist|tr -d ','|tr -s ' '|cut -f 2,3,4,5,6,7 -d " "|sed "s/%20/ /g;s/$/,/;s/,/\r/g;s/(/-/g;s/)/-/g;s/$/,/");Set(menu,replace,Choose);
    (ExitMode) =Set(list,close);Macro(MPD_SETTILE);Timer(MPD_SETTILE,5,0);

    Back($$)  =Make(mode,mpd);Macro(ALLIN1MENU);
    Choose($$)=Exec(mpc play $(Index));Macro(ALLIN1MENU);

    [ModeEnd]
    [End]
    [/code]

     
    • vaquerito
      vaquerito
      2009-04-03

      sorry, remove [code] and [/code] ;) thanks

       
    • Mike
      Mike
      2009-04-04

      Thank You a lot for the patches !
      I'll test them and add to the next release.