View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 10 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sat Dec 15, 2007 9:37 pm 
Offline
Joined: Fri Jan 27, 2006 3:43 pm
Posts: 17
Is it possible to change the default player in utilities/setup -> setup -> media settings -> video settings -> player settings so it calls a script? What I am trying to do is when I go to watch a movie and select the movie, it will call the script, which will turn the lights off, via X10, then start the movie with mplayer.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 9:48 pm 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
Absolutely. I use a script to determine the type of file based on the extension, do whatever is necessary then play it (back before Xine could play a .iso directly).

Just be sure to enter the entire path in the player definition. If it requires root access you may need to prefice it with sudo and include the script in your /etc/sudoers file.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 10:05 pm 
Offline
Joined: Fri Jan 27, 2006 3:43 pm
Posts: 17
it still will not work, I have checked the full path several times and still nothing works. when i select the movie the screen turns black and the script does not execute. the first thing the script is suppose to do is log to a file for testing purposes, and it does not do that. it is almost like it is not getting called. And anyone can execute the script and mythtv is the owner/creator


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 8:21 am 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
brplut40 wrote:
it still will not work, I have checked the full path several times and still nothing works. when i select the movie the screen turns black and the script does not execute. the first thing the script is suppose to do is log to a file for testing purposes, and it does not do that. it is almost like it is not getting called. And anyone can execute the script and mythtv is the owner/creator
But what is the script doing? If whatever it does requires root access, be sure to
slowtolearn wrote:
prefice it with sudo and include the script in your /etc/sudoers file.
If you open an Xterm and run the script (as the mythtv user) do you see errors? If it's not too long perhaps you could post the script.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 7:44 pm 
Offline
Joined: Fri Jan 27, 2006 3:43 pm
Posts: 17
I would be happy to post the script.

Code:
#!/usr/bin/perl
#this is so I know it runs
open (NFILE, '>logger.txt');
print (NFILE "light turned off");
close (NFILE);


#turn lights off via writing to a file that misterhouse checks every second
open (MYFILE, '>house_cmd.txt');
print (MYFILE "lamp off");
close (MYFILE);

#start movie with mplayer
#currently commented out until I can get the first part working
#my $foo = `mplayer -fs -zoom -quiet -vo xv $ARGV[0] -ao alsa -ac hwac3 -cache 10000`;
#exec "mplayer -fs -zoom -quiet -vo xv $ARGV[0] -ao alsa -ac hwac3 -cache 10000";


As you can see it writes to a file "logger.txt" to verify it has ran. then writes to another file "house_cmd.txt" which misterhouse checks and runs the commands written to the file. The last part is commented out until the lights turn off and the script will run. If I run the script from the command line as the mythtv user, the light turns off just fine. That is why I am confused as to why it will not run when called from myth. It will not even write to the first file to verify it runs.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 11:28 pm 
Offline
Joined: Tue Mar 22, 2005 9:18 pm
Posts: 1422
Location: Brisbane, Queensland, Australia
I will preface this advise with: I am not an experienced programmer, but I have an idea of what I am doing.

As to your script, I suspect it is permissions/directories. What I mean is when you run the script from the command line it works as it knows what directory to place the txt files in, the current one. When you call the script from within Myth I personally don't know what the current directory is, so you might find that your script is trying to write the txt files to a directory it doesn't have permission.

Could I suggest you explicitly define the paths for the txt files to a location that you know the MythTV user has permission too.

I hope this helps.

_________________
Girkers


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 17, 2007 9:00 am 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
As Girkers mentioned, best to absolute path your files. You may be writing to a logger.txt file, but in a different directory than you expect (or you can't write to the current directory, so the script exits). Something like
Code:
#!/usr/bin/perl
#this is so I know it runs
open (NFILE, '>/home/mythtv/logger.txt');
print (NFILE "light turned off");
close (NFILE);

#turn lights off via writing to a file that misterhouse checks every second
open (MYFILE, '>/home/mythtv/house_cmd.txt');
print (MYFILE "lamp off");
etc, etc.

This way you always know where your files should be.

What is the name of your script and where is it located? And what is the output from
Code:
mysql mythconverg <<EOF
select * from settings where value="VideoDefaultPlayer";
quit
EOF


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 17, 2007 10:08 pm 
Offline
Joined: Fri Jan 27, 2006 3:43 pm
Posts: 17
here is the output from the select statement

Code:
 value              | data                    | hostname |
+--------------------+-------------------------+----------+
| VideoDefaultPlayer | /myth/misterhouse/mythl | mythtv 


I also verified in the player settings that this was correct also.

Code:
mythtv@mythtv:/myth/misterhouse$ pwd
/myth/misterhouse


that is the directory where mythl, which is a perl script is located.

do I need the .pl on the player setting? I also tried running the script with all absolute paths and it still did not work.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 18, 2007 10:06 am 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

I probably know even less about programming however I add the -w switch after the perl so it shows some debug on the script.

Also when you call the script do preface it with perl?
$ perl <myscript.pl> else it may try to run it a s a shell script.

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 18, 2007 6:10 pm 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
brplut40 wrote:
do I need the .pl on the player setting?
Yes, if that's the name of the script. /myth/misterhouse/mythl is NOT equal to /myth/misterhouse/mythl.pl


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu