<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 2/10/2012 06:51, David Crawford wrote:
<blockquote
cite="mid:CAFiR-D-S=5mHz+udXbHZPDqdGGqF_s+ky+jRzWvZjsfCptdGGQ@mail.gmail.com"
type="cite">Since it works in perl and <a moz-do-not-send="true"
href="http://mythlink.pl">mythlink.pl</a> and <a
moz-do-not-send="true" href="http://mythrenam.pl">mythrenam.pl</a>,
does anyone know a way whereby I could pull the info in the same
way as in mythlink using perl and perhaps add that to my python
script?</blockquote>
<br>
As mentioned, the problem isn't that you can't access that data
through the bindings, but that in order to access that data in the
right place, you would either incur a circular import, or break the
intended location of classes.<br>
<br>
The command you were using was in mythproto.py, intended for methods
and objects returned by the backend over Myth's internal protocol.<br>
<a class="moz-txt-link-freetext" href="https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/mythproto.py#L977">https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/mythproto.py#L977</a><br>
<br>
The information you need is accessible through dataheap.py, intended
as a heap of classes used to access the database.<br>
<a class="moz-txt-link-freetext" href="https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/dataheap.py#L649">https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/dataheap.py#L649</a><br>
<br>
dataheap.py already imports elements out of mythproto.py, which
means mythproto.py cannot in turn import anything out of
dataheap.py, as the Python interpreter will simply skip over it.<br>
<br>
In your own code, sitting above the bindings, you could extract such
information using...<br>
<br>
from MythTV import Channel<br>
path = '%cn %cc %cN.srt'<br>
chan = Channel(<chanid>)<br>
for (tag, data) in (('cn',
'channum'),('cc','callsign'),('cN','name')):<br>
tmp = unicode(chan[data]).replace('/','-')<br>
path = path.replace('%'+tag, tmp)<br>
print path<br>
<br>
But to be honest, substituting those values in manually, and then
substituting everything else in through the Program.formatPath
method, just feels clumsy to me. On the other hand, there is no
simple way to fix it in the bindings, besides arbitrarily moving the
Channel class into the wrong file.<br>
</body>
</html>