Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PS3 Media Server question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
SayusiAndo
n00b
n00b


Joined: 11 Jun 2013
Posts: 30
Location: Budapest, Hungary

PostPosted: Mon Jul 08, 2013 7:06 am    Post subject: PS3 Media Server question Reply with quote

Hi All,

I would like to ask some help regarding PS3 Media Server. I love this application to be honest, but I have issue with the configuration.

If you install it from portage then you have two options:

  • Install it as a service
  • Install it as a desktop application

I can use it as a desktop application but I would like to use it as a service. I found the configuration file under /etc/conf.d/ps3mediaserver

My question is that what is the purpose of this file? It always use the user config which is $HOME/$USER/.config/PMS/PMS.conf if I define the user in the configuration file. It is the normal way of the working? However, despite the fact the software uses the user's config it is not possible to browse the files. The directory structure is possible to browse on my TV but there are no files are listed e.g. mkv and avi file.

If I start it as a desktop application and it uses the same config than the media files are listed and possible to play them.

What is the difference between the two method? What is required to have this software working as a service? Is there a how to or description which can help me?

I appreciate your help![/list]
_________________
- -
-- Csanyi Andras/Sayusi Ando --
-- "Trust in God and keep the gunpowder dry!!" - Cromwell
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1248
Location: Adelaide/Australia

PostPosted: Wed Jul 10, 2013 2:05 am    Post subject: Reply with quote

I don't use this program you are discussing, I use MediaTomb, however, to run stuff as a service, you need a couple of things

You need a service control script, the name depends on the service, yours may be something like /etc/init.d/ps3media

Check the /etc/init.d/ directory to see if one already exists, if it does, things are a lot simpler.

This script could be cloned and hacked from a similar program, something like the following (which I simply cloned from proftpd and renamed every reference of proftpd to yourService - you may need to tweak the 'depends'
Code:
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/yourServiceName/files/yourServiceName.initd,v 1.5 2013/01/14 02:58:52 floppym Exp $

extra_started_commands="reload"

depend() {
   need net
   use logger dns mysql postgresql antivirus
}

check_configuration() {
   if [ ! -e $CONFIG ] ; then
      eerror "To execute the YourServiceName server you need a $CONFIG file (/etc/config.d/YourServiceName sets CONFIG)"
      return 1
   fi
   # Test the configuration, your program may not support this, in which case, remove it
   /usr/sbin/yourServiceName -t &>/dev/null
   if [ $? -ne 0 ] ; then
      eerror "The YourServiceName configuration file $CONFIG is invalid!"
      return 2
   fi
}

start() {
   checkpath -d /var/run/yourServiceName
   [ "${RC_CMD}" = "restart" ] || check_configuration || return 1
   ebegin "Starting YourServiceName"
   # Note the -c "$CONFIG" are parameters given to the service, not to start-stop-daemon
   start-stop-daemon --start --quiet \
      --exec /usr/sbin/yourServiceName \
      --pidfile /var/run/yourServiceName/yourServiceName.pid
      -- -c "$CONFIG"
   eend $?
}

stop() {
   [ "${RC_CMD}" != "restart" ] || check_configuration || return 1
   ebegin "Stopping YourServiceName"
   start-stop-daemon --stop --quiet --retry 20 \
      --pidfile /var/run/yourServiceName/yourServiceName.pid
   eend $?
}

reload() {
   check_configuration || return 1
   ebegin "Reloading YourServiceName"
   # Your service may not support being sent a SIGHUP Signal to reload configurations
   start-stop-daemon --quiet --signal HUP \
      --pidfile /var/run/yourServiceName/yourServiceName.pid
   eend $?
}

Obviously, you would tweak the code to point to the media server executable and the program may not support validation of the config file, so the configuration checks could be removed.

The above script assumes you also have a corresponding /etc/conf.d/yourServicename, which will make available as variables in this script, the values in the config file.

Check to see if one already exists!

If not, maybe something like
Code:
CONFIG=/etc/ps3media/ps3media.conf
where the /etc/ps3media/ps3media.conf would contain your $HOME/$USER/.config/PMS/PMS.conf

Then, you add yourService to the default run level, so it is automatically started.
Code:
rc-update add yourServiceName default


Finally, you start your service
Code:
/etc/init.d/yourServiceName start


Hope this helps :)
_________________
...Lyall
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum