Here is my method of how i would try to solve this issue:
You can use "pnd_run.sh" (don't confuse this with "pnd_run" without ".sh") to build a small script that you assign in the same way that freamon specified his script. This is a bit of work. Let's take vlc as an example:
First of all, if you run "pnd_run.sh" without any argument in a terminal, then you get a quick overview about the parameters that "pnd_run.sh" takes.
Next I would start the pnd that contains the application. So in this case run vlc from the startmenu and leave it's window open in order to keep the pnd mounted. The plan is to get an idea where the pnd is mounted and which script is started.
The quickest way to find this out is to write the following in a terminal while the pnd is still running:
The output will look something like this:
Code:
5053 ? Ss 0:00 /bin/bash /usr/pandora/scripts/pnd_run.sh -p /media/trans8/pandora/menu//vlc.pnd -e scripts/vlc.sh -b vlc
5198 pts/2 S+ 0:00 grep pnd_run
We only care for the first line of the output and only for what comes after pnd_run.sh. The text behind "-e" shows which script is started and the text behind "-b" shows the mountpoint. So know we know that "scripts/vlc.sh" is started and that the mountpoint is "vlc"
With this knowledge and the fact that all pnds are being mounted in "/mnt/utmp/" you now can locate the startscript. It's always at "/mnt/utmp/<mountpoint>/<startscript_path>. So in this example "/mnt/utmp/vlc/scripts/vlc.sh". In order to get an idea what's going on in the script you take a look at it with either your favorite editor, or simply by using the "less"-command in a terminal:
Code:
less /mnt/utmp/vlc/scripts/vlc.sh
You don't have to understand everything of what's going on in this script. But you will see that some environmental-variables are being set ("export ...") and in the end vlc is being launched ("exec ./bin/vlc $*"). In general you will usually need such a startscript. So we will copy it over.
Now let's build our own script that runs a movie directly. I will be using the "pnd_run.sh"-command , the info about the start-script and the mountpoint and put it all together. Remember that you can type "pnd_run.sh" without anything else to get a quick help. The first line in the script is always needed. Also make sure to modify the paths to fit the location of your pnd. The script will:
- mount the pnd
- change the HOME-directory to the mountpoint so the application reads/writes it's configuration files there
- run a (in some cases modified) copy of the PNDs startscript
- unmount the pnd afterwards
Here's the script:
Code:
#!/bin/bash
#the following line mounts the pnd-without starting the application
/usr/pandora/scripts/pnd_run.sh -p /media/trans8/pandora/menu//vlc.pnd -b vlc -m
#change into the mountpoint and set the HOME-variable to that directory
cd /mnt/utmp/vlc
export HOME=.
#the following is a copy of the original start-script that we want to use
export PATH="/mnt/utmp/vlc/bin:${PATH:-"/usr/bin:/bin:/usr/local/bin"}"
export LD_LIBRARY_PATH="/mnt/utmp/vlc/lib:${LD_LIBRARY_PATH:-"/usr/lib:/lib"}"
export HOME="/mnt/utmp/vlc" XDG_CONFIG_HOME="/mnt/utmp/vlc"
if [ -d /mnt/utmp/vlc/share ];then
export XDG_DATA_DIRS=/mnt/utmp/vlc/share:$XDG_DATA_DIRS:/usr/share
fi
export SDL_AUDIODRIVER="alsa"
cd $HOME
[ -e "$HOME/scripts/pre_script.sh" ] && . $HOME/scripts/pre_script.sh
if [ -e "$HOME/scripts/post_script.sh" ];then
./bin/vlc "$*"
. $HOME/scripts/post_script.sh
else
./bin/vlc "$*"
fi
#end of start-script
#unmounting the pnd afterwards
/usr/pandora/scripts/pnd_run.sh -p /media/trans8/pandora/menu//vlc.pnd -b vlc -u
The only thing i modified in the section of the copied start-script was to remove the "exec" in front of of the line that starts vlc as it caused trouble when unmounting the pnd. Save the script using a name you prefer into your home-directory. I recommend to create a subfolder "scripts" for all future scripts you will write. I saved the script to "~/scripts/vlc-wrapper.sh".
Afterwards make the script executable just like freamon described:
Code:
chmod +x ~/scripts/vlc-wrapper.sh
In a terminal you can now test to pass a filename to the script. At this point you can also close the still running vlc that you left open before as mentioned in the beginning of the instructions. I used one with a rather ugly filename:
Code:
~/scripts/vlc-wrapper.sh /media/trans8/multimedia-data/movies/\[Demoscene\]\ Revision\ 2011\ -\ PC\ 05\ Flux\ by\ PandaCube\ \[PC\ Demo\ Competition\].mp4
The script should exit cleanly and executing "mount" manually afterwards should not show any signs of the mounted pnd anymore ("/mnt/utmp/vlc" in this case). So since this works nicely for me, I can now assign the script to movie-files. I'll copy freamons instruction on how to do that:
Right-click on a media file, choose "open with other application",choose "use a custom command" and type in "/home/lmx/scripts/vlc-wrapper.sh". Note: Using "~" instead of "/home/lmx" did not work for me. Also remember to replace "lmx" with your own username.
If this worked for you, then you can also try to modify the start-script to your needs. For example you can specify "-f" behind "./bin/vlc" to start vlc in fullscreen-mode:
I hope this works for you. With this information you should also be able to write similar wrapper-scripts for starting other pnds. Though you might have to make more advanced changes or will run into situations where the application does not take a filename as parameter at all. And by the way, you might want to use smplayer2 instead of vlc. Just try it all out.