[mythtv] Python: collecting searchRecorded into list() has side effects

Jan mythtv at jd67.de
Fri Jul 26 10:45:22 UTC 2013


Am 26.07.2013 12:32, schrieb Jan:
>
>>>> QUESTIONS:
>>>> Is it in general, a bad idea to store many (>40) Recorded objects 
>>>> into a list()?
>
> Answer myself: No. there is no problem storing recorded into a list()
>
>>>>
>>>> Is there any way to iterate a lot of Recorded in a sorted manner?
>
> Answer myself: Recorded stored in a list() can sorted easily
>
>> I did some debugging and it looks like that the new connections made 
>> and STORED into DBDataRef._origdata by by deepcopy.
>> Just for testing I cleared the _origdata and it works perfect.
>>
>> *** pseudo code 
>> **************************************************************
>> for i,r in enumerate( list(DB.searchRecorded(recgroup='Default')) ):
>> print i, r.title, r.markup.getuncutlist()
>> r.markup._origdata = None # WARNING: THIS IS NOT A FIX OR WORKAROUND
>> ****
>>
>
> My current work arround:
>
> for i,r in enumerate( list(DB.searchRecorded(recgroup='Default')) ):
> # create ONE additional Recorded object and delete it after usage
> r2 = MythTV.Recorded((r.chanid, r.starttime))
> print i, r.title, r2.markup.getuncutlist()
>
> ****
>
> Currently the classmethods DBDataRef.fromRaw and DBDataRef.fromCopy 
> don't keep existing connections. I have no idea if this is wanted by 
> design or not. I try a modification (patch below) and pass the DBCache 
> object for reuse. It seams to work as expected.
>
> Because I haven't a deep understanding of the architecture of 
> myth-pyhton, I'm not sure about possible side effects.
>
> Looking forward on your comments
>
>
Sorry misformed patch. Here again as attachment:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: myth-python-database.patch
Type: text/x-patch
Size: 1752 bytes
Desc: not available
URL: <http://www.mythtv.org/pipermail/mythtv-dev/attachments/20130726/3200be0f/attachment.bin>


More information about the mythtv-dev mailing list