[mythtv-users] Rename a file problems

David Crawford davidcrawford83 at gmail.com
Fri Feb 10 12:43:56 UTC 2012


On 10 February 2012 12:34, Raymond Wagner <raymond at wagnerrp.com> wrote:

>  On 2/10/2012 06:51, David Crawford wrote:
>
> Since it works in perl and mythlink.pl and mythrenam.pl, 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?
>
>
> 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.
>
> The command you were using was in mythproto.py, intended for methods and
> objects returned by the backend over Myth's internal protocol.
>
> https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/mythproto.py#L977
>
> The information you need is accessible through dataheap.py, intended as a
> heap of classes used to access the database.
>
> https://github.com/MythTV/mythtv/blob/master/mythtv/bindings/python/MythTV/dataheap.py#L649
>
> 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.
>
> In your own code, sitting above the bindings, you could extract such
> information using...
>
> from MythTV import Channel
> path = '%cn %cc %cN.srt'
> chan = Channel(<chanid>)
> for (tag, data) in (('cn', 'channum'),('cc','callsign'),('cN','name')):
>     tmp = unicode(chan[data]).replace('/','-')
>     path = path.replace('%'+tag, tmp)
> print path
>
> 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.
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
>
> Hi Raymond,

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.

Is there no way to use the rename.pl script that was replaced by
mylink.plfor the .srt files? or would that be a bad idea?

Thanks again so much for the ideas and help,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20120210/f757d457/attachment.html 


More information about the mythtv-users mailing list