PeteManchester / MediaPlayer

61 stars 20 forks source link

input selector #58

Closed humarf closed 8 years ago

humarf commented 8 years ago

Hello Pete,

just installed mediaplayer on my desktop and on my raspberry pi. I am very impressed of mediaplayer. Best software openhome renderer implementation so far.

Regarding imput selector I would like to suggest an enhancement. By now it can switch gpio pins of the raspberry pi. Would it be possible that optional an input select could simply run a command. I could select imputs on my amp via a network command. With this enhancement I would be able to switch inputs from my control point app. Please let me know what you think of that.

Installation on my desktop is a gentoo installation. It is using openrc for starting services. Here is a working start script. Maybe you would like to include it in your scripts directory:

#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/motion/files/motion.initd-r2,v 1.1 2011/10/02 18:48:35 ssuominen Exp $

DESC="OpenHome MediaPlayer"
NAME=mediaplayer.sh
DAEMON=/usr/local/bin/$NAME
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
SCRIPTNAME=/etc/init.d/$NAME
USER=mpd
GROUP=audio

extra_started_commands="reload"

_create_file_structure() {
        touch $PIDFILE $LOGFILE                                                                                                       
        chown root:$GROUP $PIDFILE $LOGFILE                                                                                           
        chmod 660 $PIDFILE $LOGFILE
}

depend() {
        need modules
        after mpd
}

start() {
        _create_file_structure

        ebegin "Starting openhome mediaplayer"
        start-stop-daemon --start -u ${USER} -g ${GROUP} --quiet --make-pidfile --pidfile $PIDFILE --background --exec ${DAEMON}
        eend $?
}

stop() {
        ebegin "Stopping openhome mediaplayer"
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
        eend $?                                                                                                                       
} 
PeteManchester commented 8 years ago

Hi,

Glad you like MediaPlayer and thanks for the Gentoo script and your suggestion.

There is already a Plugin that might be suitable for running a command when the input is changed.

Have a look at the LIRCIntegration Plugin

https://github.com/PeteManchester/MediaPlayer/wiki/Plugins-LIRCIntegration.

If you ignore the first bit about setting up LIRC, there are some details of how you can map SourceChanged events to different commands in the plugins LIRCConfig.xml

Any questions please ask.

Thanks again,

Pete.

humarf commented 8 years ago

Hi Pete,

Your hint let me do exactly what I wanted. Thanks a lot!

There were a few problems but I could sort them out: 1) In LIRCConfig.xml I could not directly post a curl command (maybe because of the " in it(?)). I had to wrap it into a bash script. 2) In the wiki it says that I have to put CustomInputSource.jar in plugins directory. This makes mediaplayer crash. Without it it's working. Maybe you already included that plugin during build. 3) There are mentioned two special input types PlayList and Radio. I guess there is a third one called Receiver. It worked when I tried it.

Maybe it's worth taking this into wiki. Just wanted to let you know.

But having this working now I can clearly say that this amazing piece of software clearly outperforms all other software UPNP/Openhome renderer implementations. Thanks a lot for that.

I wonder if you might share some of your thoughts what features you are planning to implement in the future?

Best regards Martin

PeteManchester commented 8 years ago

Thanks for the feedback Martin.

I'm not sure why it couldn't execute the curl command, I think other people are doing that, but maybe because they are using Debian OS.

I made some changes to the Wiki as you suggested.

At the moment I don't have any new plans for MediaPlayer, just keep it ticking over. It does everything I want it to and seems to do most of what everyone else wants it to do.

Thanks again,

Pete.

humarf commented 8 years ago

It definitely has a very good set of features. Did you ever think about adding a songcast sender? This would be an absolute killer feature.

PeteManchester commented 8 years ago

I did consider adding a Songcast sender, but at the moment I'm bogged down at worked and don't have much spare time. Also I would not be able to get the sender to sync with the receivers because I would have to sample the sound after it had been played by MPD instead of sampling the sound, delaying the playback and sending it to the receivers the playing back the sound

Cheers,

Pete.

imgrant commented 8 years ago

Doesn't MediaPlayer act as a sender with Songcast (and AirPlay?) streams it is receiving?

Is there any benefit to using MPD any more? At first, MediaPlayer used MPD (or mplayer) for Playlist and Radio functionality, but since then you have added direct play within MediaPlayer for AirPlay and Songcast (receiver) streams, perhaps a long term goal could be to use this for Playlist/Radio playback too?

Edit: no sooner had I clicked 'Comment' than I realised I guess with Playlist/Radio you have the issue of codecs, etc., to deal with, which currently relies on MPD handling directly. I suppose it would be a lot of work to reinvent the wheel for that.

PeteManchester commented 8 years ago

Hi Ian,

Yup, for Playlist and Radio it would be a huge amount of work implement all the different codec handling in Mediaplayer, it's much easier to use MPD. When i was first designing MediaPlayer I did look at implementing Codec handling, but it turned out to be a nightmare...