[mythtv-users] what is mythcommflag doing?

Scott Blomfield sblomfi at Cavps.com
Fri Nov 21 17:13:25 EST 2003


> -----Original Message-----
> From: Cedar McKay [mailto:cedar at aliandcedar.com] 
> Sent: Friday, November 21, 2003 3:37 PM
> To: Discussion about mythtv
> Subject: Re: [mythtv-users] what is mythcommflag doing?
> 
> 
> Chris Pinkham wrote:
> 
> >>I'm running gentoo with the 0.12 ebuild.
> >>
> >>$ mythcommflag --all
> >>
> >>MythTV Commercial Flagging, started at Thu Nov 20 23:57:10 2003
> >>
> >>Flagging commercial breaks for:
> >>ChanID  Start Time      Title                               
>           
> >>Breaks
> >>------  --------------  
> --------------------------------------------  
> >>------
> >>No program data exists for channel 1009 at 20030419200000
> >>No program data exists for channel 1009 at 20030426200000
> >>No program data exists for channel 1022 at 20030428003000
> >><snip>lots more</snip>
> >>
> >>If I look in my recordings directory there is a corresponding file 
> >>name. If I look in the database in the recorded table,  this 
> >>corresponds to:
> >>|   1009 | 20030419200000 | 20030419203000 | Mr. Bean       
>             
> >>                     | Mr. Bean                        | An exam; 
> >>sneezing; swim trunks.                                      
>             
> >>                     | sagan     | NULL     |       0 | 
> NULL    | NULL   
> >>   |          0 |
> >>    
> >>
> >
> >Try running the following query:
> >
> >SELECT recorded.chanid,starttime,endtime,title,subtitle,
> >		description,channel.channum,channel.callsign,
> >		channel.name
> >	FROM recorded,channel
> >	WHERE recorded.chanid = 1009
> >		AND starttime = 20030419200000
> >		AND recorded.chanid = channel.chanid;
> >
> >That's the query that gets run to check to retrieve program info from
> >the DB when you're running mythcommflag.
> >
> >  
> >
> 
> 
> Hmm. I don't really understand this. If I do it exactly as you have 
> written I get an empty set. But why do you want me to do the
> AND recorded.chanid = channel.chanid;
> line?
> 
> If I omit that line, or substitute "1009" for 
> "channel.chanid" I get this:
> 
> mysql> SELECT 
> recorded.chanid,starttime,endtime,title,subtitle,description,c
> hannel.channum,channel.callsign,channel.name
>     -> FROM recorded,channel
>     -> WHERE recorded.chanid = 1009
>     -> AND starttime = 20030419200000
>     -> AND recorded.chanid = 1009;
> +--------+----------------+----------------+----------+-------
> ---+---------------------------------+---------+----------+---------+
> | chanid | starttime      | endtime        | title    | subtitle | 
> description                     | channum | callsign | name    |
> +--------+----------------+----------------+----------+-------
> ---+---------------------------------+---------+----------+---------+
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 4       | KOMO     | 4 KOMO  |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 5       | KING     | 5 KING  |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 7       | KIRO     | 7 KIRO  |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 9       | KCTS     | 9 KCTS  |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 10      | CKVU     | 10 CKVU |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 11      | KSTW     | 11 KSTW |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 12      | KVOS     | 12 KVOS |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 13      | KCPQ     | 13 KCPQ |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 16      | KONG     | 16 KONG |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 20      | KTBW     | 20 KTBW |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 22      | KTWB     | 22 KTWB |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 28      | KBTC     | 28 KBTC |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 33      | KWPX     | 33 KWPX |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 45      | KHCV     | 45 KHCV |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 51      | KWOG     | 51 KWOG |
> |   1009 | 20030419200000 | 20030419203000 | Mr. Bean | Mr. Bean | An 
> exam; sneezing; swim trunks. | 56      | KWDK     | 56 KWDK |
> +--------+----------------+----------------+----------+-------
> ---+---------------------------------+---------+----------+---------+
> 16 rows in set (0.00 sec)
> 
> 
> 
> Which I also don't understand. Why are there all the duplicates, but 
> with different channels? If I manually look in the recorded table the 
> show only appears once. Any insight is appreciated.
> 
> 
> oh, you should know that I have not done anything funky to my 
> database 
> that I know of, but I have run both
> mythcommflag --force --all
> and  myth.rebuilddatabase.pl
> from the contrib directory. But I did myth.rebuilddatabase.pl 
> to try to 
> solve this problem so I doubt it caused this issue.
> 
> best,
> Cedar
> 
> 
> 
> 
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
> 
You have what is called a cartesian product.
It happens when you join two tables together and neglect to join them on
a 1 to 1 basis. (you get every possible combination of rows from table1
and rows from table2). Not only is this NotCool(tm), it is definitely
not what you want.

You should use this query instead:
SELECT recorded.chanid,starttime,endtime,title,subtitle,
       description,channel.channum,channel.callsign,
       channel.name
 FROM recorded,channel
 WHERE
   recorded.chanid = 1009
   AND channel.chanid = recorded.chanid
   AND starttime = 20030419200000;

But this is what you had been told in the first place... If this query
is not returning any results, it means that there is no show that
matches on that channel for that date/time. If you are not certain about
the chanid, you could run:
SELECT recorded.chanid,starttime,endtime,title,subtitle,
       description,channel.channum,channel.callsign,
       channel.name
 FROM recorded,channel
 WHERE
   channel.chanid = recorded.chanid
   AND starttime = 20030419200000;

And this would return everything that started at this date/time on any
channel. You could then weed through and find out what the chanid you
were looking for was.

Just remember that somewhere in the query you need to tell both the
recorded table AND the channel table that they should join on chanid
(tell them they should equal each other). Otherwise, you will get that
cartesian product thing we were talking about.



More information about the mythtv-users mailing list