Author |
Message |
bubbahotep
|
Posted: Wed May 11, 2005 2:25 pm |
|
Joined: Mon May 02, 2005 5:10 pm
Posts: 13
|
I'm running KnoppMyth R5A15.
I don't have anything in my pretty folder by default.
Is mythpretty/mythlink supposed to run right out of the box or do I need to enable it somehow?
I've read some posts (yes I searched) on the mythpretty topic and some were talking about changes needing to be made to fix the script to get it to work on earlier versions of KnoppMyth. Do these same changes need to be made to the script included in R5A15 or have they been fixed?
Thanks for your help.
|
|
Top |
|
 |
cesman
|
Posted: Wed May 11, 2005 5:47 pm |
|
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location:
Fontana, Ca
|
Nothing that isn't absolutely needed by MythTV is enabled. I don't run the pretty script, but I do believe it creates the directory for you.
_________________ cesman
When the source is open, the possibilities are endless!
|
|
Top |
|
 |
ceenvee703
|
Posted: Wed May 11, 2005 5:52 pm |
|
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location:
Virginia, USA
|
I have an /etc/cron.hourly/pretty script, but my R5A15 is an upgrade that started as an R4V5 backend. Bubbahotep, is yours a new install or an auto-upgrade?
|
|
Top |
|
 |
bubbahotep
|
Posted: Wed May 11, 2005 8:15 pm |
|
Joined: Mon May 02, 2005 5:10 pm
Posts: 13
|
Its a new install. Just did it last weekend.
|
|
Top |
|
 |
Greg Frost
|
Posted: Thu May 12, 2005 7:34 am |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
I remember getting pretty links on my r4v5 install and I dont recall doing anything to get mythlink.sh to run, so it would seem that it was enabled on a clean install back then. I think that this should be enabled by default in the new version of KnoppMyth too (which it doesnt seem to be). Not much overhead and it can be useful. It's little things like this that can make KnoppMyth stand out from other distributions.
I ran it by hand on r5a15.1 and can confirm that it does create the /myth/pretty directory.
|
|
Top |
|
 |
ceenvee703
|
Posted: Thu May 12, 2005 8:00 am |
|
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location:
Virginia, USA
|
On the new install, is there an /etc/cron.hourly/ directory? If so, the pretty script that goes in there is pretty straightforward:
Code: #!/bin/sh su mythtv -c /usr/local/bin/mythlink.sh
If you create it, chmod it to ugo+x
Don't forget to check out the edits to that script found in the other threads that will add the ".mpg" extender, so you don't have to do that by hand (if you have a PVR-x50 of course).
|
|
Top |
|
 |
bubbahotep
|
Posted: Thu May 12, 2005 5:52 pm |
|
Joined: Mon May 02, 2005 5:10 pm
Posts: 13
|
Hmmm...
Well I was somewhat confused. I originally thought the pretty folder was the one in /nuv2disk/pretty. It turns out that is not the correct folder. The correct folder should be /mythtv/pretty. I didnt have that folder at all.
I found the /usr/local/bin/mythlink.sh script and looked it over. Mine was very similar to the one that follows that I found in a post here.
Quote: #!/bin/sh
# mythlink.sh - Symlinks mythtv files to more readable version in /var/lib/mythtv/pretty # by Dale Gass
rm -f /tv/pretty/* echo "Done RM" mysql -uroot mythconverg -B --exec "select chanid,DATE_FORMAT(starttime,'%Y%m%d%H%i%s'),DATE_FORMAT(endtime,'%Y%m%d%H%i%s'),title,subtitle from recorded;" >/tmp/mythlink.$$ perl -w -e ' my $mythpath= "/myth/tv"; my $altpath= "/myth/pretty"; if (!-d $altpath) { mkdir $altpath or die "Failed to make directory: $altpath\n"; } <>; while (<>) { chomp; my ($chanid,$start,$end,$title,$subtitle) = split /\t/; $start =~ s/[^0-9]//g; $end =~ s/[^0-9]//g; $subtitle = "" if(!defined $subtitle); my $ofn = "${chanid}_${start}_${end}.nuv"; do { print "Skipping $mythpath/$ofn\n"; next } unless -e "$mythpath/$ofn"; $start =~ /^....(........)/; my $nfn = "$1_${title}_${subtitle}"; $nfn =~ s/ /_/g;
$nfn =~ s/&/+/g; $nfn =~ s/[^+0-9a-zA-Z_-]+/_/g; $nfn = "$nfn.mpg"; print "Creating $nfn\n"; unlink "$altpath/$nfn" if(-e "$altpath/$nfn"); symlink "$mythpath/$ofn", "$altpath/$nfn" or die "Failed to create symlink $altpath/$nfn: $!"; } ' /tmp/mythlink.$$ rm /tmp/mythlink.$$ The items in bold I had questions about. THe first bolded line... Quote: rm -f /tv/pretty/* I think should be... Quote: rm -f /myth/pretty/* If I am right then this is an error with the script included with knoppmyth. The second bolded line... Quote: $nfn = "$nfn.mpg";
was the only added line to the original script included with knoppmyth. It allows for the files to have a .mpg extension instead of .nuv
Ok, so once I got the paths and such figured out I determined I needed to create a /myth/pretty folder. I think the script is supposed to do that for you but I did it manually.
I checked the /etc/cron.hourly directory and it already had an entry for mythlink. It was exactly how ceenvee described in the previous post.
At this point I determined that since the chron.hourly was correct, there must be a problem in executing the script. (remeber the script was generally correct before I made my minor changes)
So I opened a bash window, su to root, and then ran the script. It ran like a champ and did what it was supposed to do.
I then changed back to the regular mythtv user and tried to run the script and it errored. It said I did not have permissions to remove files in the directory. So my rights must not be correct for the folder.
Now here is the weird part. I can go to my windows computer and map to the myth share (login mythtv). If I go to the pretty folder it will let me delete the files in the pretty folder! That doesnt make sense to me.
My linux skills are very weak as myth is my only experience with linux. WHat do you think is going on?
I would...
a) like to have the pretty script operate automatically (I think I need to set some permissions but Im not sure how or what I should change)
b) I really dont like that I can delete the files in the pretty folder from my windows computer
c) Was the first bolded item correct or incorrect?
Thanks for everyones help.
|
|
Top |
|
 |
ceenvee703
|
Posted: Thu May 12, 2005 7:28 pm |
|
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location:
Virginia, USA
|
1) I'm pretty sure the script has to run as root. The files it creates, though, are readable/writable by anyone.
2) Not sure why that first line is in there; maybe it's a leftover line that doesn't do anything since that folder isn't there. I'm not sure you'd want to delete the /myth/pretty directory each time the script runs, so I'm not sure you'd want to change it in the way you propose. Note that further on in the script it will make /myth/pretty if one doesn't exist.
3) Not sure why it's not running for you since it's in /etc/cron.hourly. I have to admit I don't know a lot about cron, though.
4) The /myth/pretty files aren't real files; they're symbolic links to the corresponding recordings in /myth/tv. You can delete the links, but when the script re-runs they will be re-created from the .nuv files. Likewise, if you delete the actual recording via MythTV or MythWeb, the symlinks in /myth/pretty will be removed when the script runs.
Hopefully others will fill in the missing details, particularly why it doesn't seem to be running for you.
|
|
Top |
|
 |
bubbahotep
|
Posted: Fri May 13, 2005 7:34 am |
|
Joined: Mon May 02, 2005 5:10 pm
Posts: 13
|
Code: #!/bin/sh su mythtv -c /usr/local/bin/mythlink.sh
On the chron.hourly code could I just change the "su mythtv" to "su root"? Would that work?
(Like I say, I dont know much about linux - if above sounds retarded)
|
|
Top |
|
 |
ceenvee703
|
Posted: Fri May 13, 2005 7:51 am |
|
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location:
Virginia, USA
|
Again, you shouldn't have to change that. I didn't change the script and my pretty script runs properly. Why that "su mythtv" is in there, I don't know, but it does work. My guess is that maybe cron isn't running on your system.
Here's a doc on cron that looks good:
http://www.unixgeeks.org/security/newbi ... ron-1.html
Run that command line they suggest to see if cron is running on your system.
|
|
Top |
|
 |
bubbahotep
|
Posted: Sat May 14, 2005 1:19 pm |
|
Joined: Mon May 02, 2005 5:10 pm
Posts: 13
|
I checked out the cron doc you linked to....
Code: ps aux | grep crond doesnt result in anything but Code: ps aux | grep cron
does.
I think it must be called cron and not crond on knoppmyth. (and its running).
I confirmed by logging in as root in a shell window and typing crond and it said something to the effect of "unknown command"
What do you think?
|
|
Top |
|
 |
bubbahotep
|
Posted: Sat May 14, 2005 1:34 pm |
|
Joined: Mon May 02, 2005 5:10 pm
Posts: 13
|
Success!
I was able to get the script to work on its own.
For grins I tried changing the line in cron.hourly from
Quote: #!/bin/sh su mythtv -c /usr/local/bin/mythlink.sh to Quote: #!/bin/sh su root -c /usr/local/bin/mythlink.sh
and it worked!
So it seems that the cron.hourly was indeed running but it just didnt like running the script as the user mythtv. So that would lead me to believe that the mythtv user doesnt have appropriate permissions to the myth folder.
Is it ok that the script runs as root?
[/b]
|
|
Top |
|
 |
tjc
|
Posted: Sat May 14, 2005 2:40 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Do this: Code: ls -ald /myth/pretty if it doesn't look more or less like this: Code: drwxr-xr-x 2 mythtv mythtv 16384 May 14 16:17 /myth/pretty as far as the owners and permissions go, then you may a have a permissions problem. To fix it do this: Code: chown mythtv:mythtv /myth/pretty ; chmod u+rwx,go+rx /myth/pretty Do this: Code: grep mythtv /etc/passwd if you see two or more lines you screwed up at install time and added a second mythtv user. To fix it... Well... Either search the forum for the thread where I outlined the full force solution, or resinstall and don't create a mythtv user this time (the scripts do that automatically).
|
|
Top |
|
 |
Greg Frost
|
Posted: Sun May 15, 2005 12:07 am |
|
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location:
Adelaide, Australia
|
Ok, I think that the problem is /myth/pretty is not created whan an auto-install is done with R5A15.1. People who always auto-upgrade would not know this because their pretty dir would still be hanging around from the previous install. I know the script creates it, but the script runs as user mythtv and on a clean auto-installed R5A15.1, the user mythtv does not have permission to create directories in /myth. I guess this is a problem for cesman to look into. The easiest way to fix it would probably be for the auto-install to create the pretty directory with the appropriate ownership and permissions.
|
|
Top |
|
 |
mjl
|
Posted: Sun Sep 18, 2005 7:02 pm |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
Hi,
I think I can offer some guidence on this one. Just noticed the post or would have past this along earlier.
First not all mythlink.sh scripts are the same. You want the one (from R5A15 I think) that starts of like this...
Quote: #!/bin/sh
# mythlink.sh - Symlinks mythtv files to more readable version in /tv/pretty # by Dale Gass # modified by Dave Misevich for slightly prettier names and doesn't destroy/recreate valid links. # (I found a windows box watching a recording would terminate if the link was removed) # Bug fixed caused by programs that don't have a subtitle. Use start time/date to create one. # modified to add .mpg to end of symlink. Thanks mike at the mysettopbox.tv forum for the code.
mysql -uroot mythconverg -B --exec "select chanid,DATE_FORMAT(starttime,'%Y%m%d%H%i%s'),DATE_FORMAT(endtime,'%Y%m%d%H%i%s'),title,subtitle from recorded;" >/tmp/mythlink.$$
perl -w -e The reason is explained in the beginning part of the script. I also modify one line to make pretty files more pretty (to me) Quote: #my $nfn = "${title}-${subtitle}"; my $nfn = $title."-".$subtitle;
your choice of course.
I put the run command into root's crontab. As root simply enter crontab -e which opens the empty file using nano. Using cron you may have the script run selectable to the minute (+ a few milliseconds if machine is real busy)
#
#min 0-59 * hr 0-23 * day 1-31 * month 1-12 * day of week 0-6(Su-Sa) * /cmd"
# 0,30 * * * * /usr/bin/saytime
#run mythlink.sh to make pretty tv links
5,35 * * * * /usr/local/bin/mythlink.sh
if you want a talking clock, do as root;
apt-get update
apt-get install saytime
depending on your sound card, may / may not speak while playing music
Also, if you do copy & paste, watch for line wrap as that will make a script error out. nano -w (filename) seems to help. You want to see a $ on a long line!
Also chown mythtv:mythtv /myth/*
Mike
|
|
Top |
|
 |