[mythtv] Datadirect patch approach

Derek Atkins warlord at MIT.EDU
Tue Feb 14 20:22:07 UTC 2006

Hi David,

"David Shay" <david at shay.net> writes:

> I am planning on submitting a patch to avoid hitting datadirect 
> redundantly if you have multiple videosources.  There are two basic 
> approaches I could use, and I was looking for guidance before I coded 
> something up. [Also, I wanted to note that I did make an error in a 
> previous post in saying that mythtv did current day, tomorrow, and +13 
> -- I now realize that it only does tomorrow and +13, however for 3 data 
> sources, this still results in 6 calls to datadirect when only 2 are needed]

I would think that in general you could write the logic to limit it
to at most two but sometimes one; a grouping at the beginning and
another grouping at the end.  For example, today I need days 1,2 and
10,11,12,13; I think this could still be done in two queries.

> With approach 1, I would change the general looping structure in 
> filldata.cpp to iterate over days first, and videosources second.  This 
> is probably the more difficult of the 2 approaches, but the changes 
> would be contained to filldata.cpp and not over to datadirect.cpp in 
> libmythtv.
> With approach 2, I would keep the looping strucure intact (videosources 
> first, days second), but keep temp files around for each call to 
> datadirect, then before doing each retrieval determine whether or not 
> that retrieval had been done yet for that day.  This is probably easier 
> to code up, but would need to make changes to both filldata.cpp and 
> datadirect.cpp in order to keep the temp files around for longer, and 
> not delete them until the program exits.
> If there is general indifference, I will just go with approach 2.

I think I prefer the first approach.  It both limites your changes to
a single file, and it doesn't use tempfiles.  Yes, it's more
difficult, but I think doing it without tempfiles is a much better


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the mythtv-dev mailing list