Author |
Message |
Usogi
|
Posted: Thu Oct 21, 2004 5:21 pm |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
I've done some searching and haven't seen much to do with this, also cant find anything about it in the wiki.
heres my problem, my provider gives out the wrong guides to zap2it. Zap2it's guide is just like the little one I picked up from the cable company's office the other day, all the listings are exactly the same, the problem is about half of them are wrong. I've tried and tried to get them to change it to the correct settings but they keep on blowing me off. Anyway, I'm sick of it and have two options it seems. I can either change providers and go with a sat of some sort, or (if possible) edit them manualy.
I need to edit about 15 channels to be 3 hours off. Currenlty these 15 channles are 3 hours behind. I've been setting the recordings on them by telling it to start -180 early and end 180 late which has been working but it really messes with my schedual. So, is this possible? I"ve looked through the database some but I'm really new to database stuff and also dont know where to look.
A big problem I see is whenever the guide is updated it would overwrite anything I changed in it, wouldn't it? If theres any way to do this in the first place, any way to make it do it on its own after the listings are updated?
May be less headache to just drop it and get sat...
Sorry if I left anything out...
Thanks in advance
--Usogi
|
|
Top |
|
 |
tjc
|
Posted: Thu Oct 21, 2004 6:05 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
You should be able to write a simple custom script to fix the listings for those three channels immediately after the update easily enough. Here is a rough outline:
- Run your update from a crontab entry. Mine currently looks like this:
Code: root@black:~ # crontab -l #Runs "pretty" script at 5 and 35 after every hour. 5,35 * * * * nice -n 19 /usr/local/bin/mythlink.sh 3 10 * * * /usr/local/bin/mythtv-update-listings.sh root@black:~ # more /usr/local/bin/mythtv-update-listings.sh #!/bin/sh
# This will scatter the queries over a bit more than a 9 hour period sleep $RANDOM
su mythtv -c "mythfilldatabase --quiet" - After the mythfilldatabase add a mysql command and feed it a chunk of SQL something like this (I had to look this up to get the MySQL flavored version of it, and it's UNTESTED so double check it before using it): Code: update program set starttime=(starttime - interval 3 hour), endtime=(endtime - interval 3 hour) where chanid in (1002, 1003, 1012); You'll obviously need to correct this to have the right chanid values and make sure that the sign (adding/subtracting) is right. - I've forgotten what mysql wants for command line syntax to do stuff like this from a here document, so you'll have to search around for it... OK, after doing a quick search, you should be able to do either this: Code: mysql mythconverg -e "update program set starttime=(starttime - interval 3 hour), endtime=(endtime - interval 3 hour) where chanid in (1002, 1003, 1012);" or this: Code: mysql mythconverg <<EOF update program set starttime=(starttime - interval 3 hour), endtime=(endtime - interval 3 hour) where chanid in (1002, 1003, 1012); EOF
|
|
Top |
|
 |
Usogi
|
Posted: Thu Oct 21, 2004 8:10 pm |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
yet to test and see if this works, just wanted to say thanks. I was really expecting to be out of luck here....
thankya =D
*hopes he can get this to work
|
|
Top |
|
 |
tjc
|
Posted: Thu Oct 21, 2004 9:36 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
BTW...
1) Do a backup before you start!
2) You should probably NOT follow my example with the random sleep. That way you can try to schedule the update to happen when you're not likely to record anything on those three channels. The mythfilldatabase itself probably does the right thing, but the little hack might have undesirable results.
|
|
Top |
|
 |
Usogi
|
Posted: Thu Oct 21, 2004 10:02 pm |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
ok, I've been working on this for a few hours.
haveing a problem, when I do the
Code: mysql mythconverg -e "update program set starttime=(starttime + interval 3 hour), endtime=(endtime + interval 3 hour) where chanid in (1039);" I get this Code: ERROR 1062 at line 1: Duplicate entry '1039-2004-10-21 03:00:00' for key 1
I get the same thing with a Code: mysql mythconverg -e "update program set starttime=(starttime - interval -3 hour), endtime=(endtime - interval -3 hour) where chanid in (1039);"
but not with a Code: mysql mythconverg -e "update program set starttime=(starttime - interval 3 hour), endtime=(endtime - interval 3 hour) where chanid in (1039);"
Take note of the +/- signs on those... Though that one works, I need to be adding 3 hours to all the times, so I gotta use the +... Update: same thing is happening with the Code: update program set starttime=(starttime + interval 3 hour), endtime=(endtime + interval 3 hour) where chanid in (1039)
Though I cannot get that one to work in the .sh file, I tried it in the SQL execute area of webmin, with - it worked with + it didn't
|
|
Top |
|
 |
tjc
|
Posted: Fri Oct 22, 2004 11:37 am |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Yeah, I should have thought of that. Those fields are part of the key, so you'll need to do them in an order that avoids collisions. This means you'll need something like an "order by descending" clause to increment the one farthest in the future first. More untested code to try:
Code: update program set starttime=(starttime - interval 3 hour), endtime=(endtime - interval 3 hour) where chanid in (1002, 1003, 1012) order by starttime desc;
|
|
Top |
|
 |
Usogi
|
Posted: Fri Oct 22, 2004 11:54 am |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
Rock on, it worked.
Just for any future people who are trying to do this, my mythtv-update-listing.sh file looks like this: Code: #!/bin/sh su mythtv -c "mythfilldatabase --quiet" mysql mythconverg -e "update program set starttime=(starttime + interval 3 hour), endtime=(endtime + interval 3 hour) where chanid in (1039, 1050, 1041, 1042, 1056) order by starttime desc;"
Only thing thats really diffrent than what tjc told me is I had to put quotes " " before 'update' and after 'desk;' Aslong as there are no limits on how many channels I can apply this to, I think its gonna work out just fine.
Thanks again, very happy I got this to work. To think, just 12ish hours ago I was thinking there was no way to do such a thing.
--Usogi
|
|
Top |
|
 |
tjc
|
Posted: Fri Oct 22, 2004 3:48 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Usogi wrote: Only thing thats really diffrent than what tjc told me is I had to put quotes " " before 'update' and after 'desk;'
 I had quotes in the original example of how to run mysql with the -e switch!
As for the other examples, if you use a "here document" you don't need 'em, and the final corrected SQL was a drop in replacement for the previous SQL.
OBTW - des c as an abbreviation for "descending".
|
|
Top |
|
 |
Usogi
|
Posted: Thu Oct 28, 2004 4:07 pm |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
ok, I came across a problem. Looking into it now but I'm having trouble finding the info I need.
Every day, between 2pm and 3:30pm normal mythupdate is run without running my script. I haven't let it go long enough to see if it will fix itself after a while or not, I just type in /usr/local/bin/mythtv-update-listings.sh manualy to fix it. What I'm after is to find whatever runs mythupdate and replace it with or add my script after it. Replacing it with that would prolly be best, so it doesn't download the listings twice....
I'll keep on looking but any help would be great.
--Usogi
|
|
Top |
|
 |
tjc
|
Posted: Thu Oct 28, 2004 8:27 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
You need to disable the existing one first. This is probably run from one of two places.
1) Another cron job - do a "crontab -l" as both root and mythtv users to see if this is the case.
2) A housekeeping task controlled from the utilities screen - look under utilitties/setup -> setup -> general -> 3rd page.
|
|
Top |
|
 |
Usogi
|
Posted: Thu Oct 28, 2004 11:10 pm |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
I looked through the simple setup stuff 3 or 4 times, no clue how I missed it every time....
Anyway, turned it off in the settings area, checked the crontab aswell but didn't see it in there. I'd imagine that will do the trick and if it doesn't your sure to hear from me again =P
Thanks again for bailing me out.
--Usogi
|
|
Top |
|
 |
tjc
|
Posted: Thu Oct 28, 2004 11:16 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Glad I could be of assistance. Pay it forward. 
|
|
Top |
|
 |
Usogi
|
Posted: Wed Nov 03, 2004 5:42 pm |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
still happening =/
I tried turning it off in the settings, and I also tried setting it to run my script instead of normal mythfilldatabase, neither worked. Dont see anything in the cron for users mythtv, root, or the username it made for me. Actually, root is the only one that has ANYTHING, and it looks just like this;
Code: 5,35 * * * * nice -n 19 /usr/local/bin/mythlink.sh 3 10 * * * /usr/local/bin/mythtv-update-lisings.sh 0 4 * * * /usr/sbin/ntpdate navobs1.usnogps.navy.mil
I know the last 2 are not what is causing this, since I added both of them myself so I know what they do, but I'm not sure about mythlink.sh. I looked at the file and searched the forums a bit but didn't see anything that made me think that file ran mythfilldatabase. Even if it did, wouldn't it run that, then my script directly after?
Thanks again for any help given
--Usogi
|
|
Top |
|
 |
Xsecrets
|
Posted: Wed Nov 03, 2004 5:56 pm |
|
Joined: Mon Oct 06, 2003 10:38 am
Posts: 4978
Location:
Nashville, TN
|
mythlink is the mythpretty script. it basically creates symlinks to all your .nuv files with human readable names in the /myth/pretty folder.
doesn't do much rm -rf everything in pretty folder then simlink based on data gleaned from the database.
_________________ Have a question search the forum and have a look at the KnoppMythWiki.
Xsecrets
|
|
Top |
|
 |
Usogi
|
Posted: Wed Nov 03, 2004 10:06 pm |
|
Joined: Wed Sep 08, 2004 5:12 pm
Posts: 15
|
ok, I'm by no means a linux expert but I'm pretty sure rm -rf deletes stuff.
I'd guess that means I'm supposed to have stuff in the pretty folder (/myth/pretty) which I dont. That folder is compleatly empty. I know I saw a few threads about the pretty folder being empty, but due to problems with my isp I'm having a lot of trouble loading threads. Hard enough just loading this one up =/
Oh well, I can wait till my inet is better and search myself.... unless somebody wants to post a link or an answer here 
|
|
Top |
|
 |