Active Topics

 


Reply
Thread Tools
Posts: 44 | Thanked: 25 times | Joined on May 2012 @ Karhula, Finland
#1
I'm planning to make my spare N900 to work as a media player as a part of my hometheater.

I want it to work with my remote (N9, PC and my girls N900). I'm looking for the basic functions like Play/pause, Stop, Next, Previous and Vol+/- .

Can I use the N900 to store music in itself and when PC is running it would see also the music files on PC and would be able to play them over LAN?

Also as a bonus I'd like to have a screensaver on N900 which shows the artist/album/song with some beautiful transition effects.

What will I need?
 
ffha's Avatar
Posts: 131 | Thanked: 170 times | Joined on May 2010 @ Netherlands
#2
There are a few dbus-commands to control the mediaplayer, but they're a pain to type out in full, so here's a script I made to simplify the process (though there are about a dozen in existance or so, but I like to write my own stuff):
Code:
#!/bin/sh
case $1 in
play ) if [ -z "${2}" ]
then dbus-send --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.play
else dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"file://${2}"
fi;;
stop ) dbus-send --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.stop;;
pause ) dbus-send --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.pause;;
resume ) dbus-send --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.resume;;
previous ) dbus-send --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.previous;;
next ) dbus-send --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.renderer.next;;
volume ) if [ -z "${2}" ]
then dbus-send --print-reply --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.get_extension_property string:volume|awk '/nt/ {print $3}'
else if [[ ${2} -ge 0 ]] && [[ ${2} -le 100 ]]
then dbus-send --type=method_call --dest=com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer /com/nokia/mafw/renderer/gstrenderer com.nokia.mafw.extension.set_extension_property string:volume variant:uint32:${2}
else echo "A value between 1-100 must be entered."
fi
fi;;
* ) echo "\"mpc play [full file path]\" | \"mpc stop\" | \"mpc pause\" | \"mpc resume\" | \"mpc next\" | \"mpc previous\" | \"mpc volume [1-100]\"
All options between brackets are optional.";;
esac
}
exit 0
I never intended to share it and never implemented any form of input sanitization at all, so keep in mind not to embrace the file path in double quotes. As long as you keep that in mind, you can easily use this script to control your mediaplayer remotely by ssh (which is how I used to control the N900 I turned into a home server before I wrote a dedicated QT-application for it).

I'll leave the other two questions to be answered by more knowledeable people (for example, I haven't updated my apt cache in ages, so I don't know if anything related to your third question already exists).

Good luck and happy hacking!

Edit: Oh, by the way, the script assumes the script is called "mpc", but it only shows in the help text. If it bothers you, just update it to reflect the name you've chosen for your own copy of the script.

Last edited by ffha; 2012-07-26 at 07:37.
 

The Following 6 Users Say Thank You to ffha For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 00:13.