<br><br><div class="gmail_quote">On 10 February 2012 12:34, Raymond Wagner <span dir="ltr"><<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div class="im">
On 2/10/2012 06:51, David Crawford wrote:
<blockquote type="cite">Since it works in perl and <a href="http://mythlink.pl" target="_blank">mythlink.pl</a> and <a href="http://mythrenam.pl" target="_blank">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></div>
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 href="https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/mythproto.py#L977" target="_blank">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 href="https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/dataheap.py#L649" target="_blank">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>
</div>
<br>_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
<a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/listinfo/mythtv-users</a><br>
<br></blockquote></div>Hi Raymond,<div><br></div><div>When you say it would be clumsy, does that mean there are likely to problems with it crashing and the like as I need to do this with many many recordings, like i'm currently doing in windows.</div>
<div><br></div><div>Is there no way to use the <a href="http://rename.pl">rename.pl</a> script that was replaced by <a href="http://mylink.pl">mylink.pl</a> for the .srt files? or would that be a bad idea?</div><div><br></div>
<div>Thanks again so much for the ideas and help,</div><div><br></div><div>David</div>