Mailing List Archive

Re: Python error in mhegepgsnoop
Tried updating to 0.6.0 from 0.5.1 and get another error (as well as not
tuning).


Building XML file: /tmp/list-xxx
Traceback (most recent call last):
File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 1594, in <module>
main()
File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 795, in main
elif options.clean_titles2:
AttributeError: 'Namespace' object has no attribute 'clean_titles2'


--
Robin Gilks




_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
> Tried updating to 0.6.0 from 0.5.1 and get another error (as well as not
> tuning).
>
>
> Building XML file: /tmp/list-xxx
> Traceback (most recent call last):
> File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 1594, in <module>
> main()
> File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 795, in main
> elif options.clean_titles2:
> AttributeError: 'Namespace' object has no attribute 'clean_titles2'

Solved one problem - the above error goes away if I use the '-c' clear
titles option with an empty (default) string on 0.6.0.

With no backend running to tune the card I still need to run something
like dvbtune in monitor mode to keep the card open?

Something like "dvbtune -f 562000000 -c 0 -m"


--
Robin Gilks



_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
On Thu, 21 May 2015 23:34:39 +1200, you wrote:

>
>> Tried updating to 0.6.0 from 0.5.1 and get another error (as well as not
>> tuning).
>>
>>
>> Building XML file: /tmp/list-xxx
>> Traceback (most recent call last):
>> File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 1594, in <module>
>> main()
>> File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 795, in main
>> elif options.clean_titles2:
>> AttributeError: 'Namespace' object has no attribute 'clean_titles2'
>
>Solved one problem - the above error goes away if I use the '-c' clear
>titles option with an empty (default) string on 0.6.0.
>
>With no backend running to tune the card I still need to run something
>like dvbtune in monitor mode to keep the card open?
>
>Something like "dvbtune -f 562000000 -c 0 -m"

This is the script I use for running mhegepgsnoop on the rare occasion
I need it (do_mhegepgsnoop.sh):

#!/bin/bash

# DVB-T multiplex frequency (kHz)
DVB_T_FREQ=594000

# Adapter number of DVB-T card.
ADAPTER=2

# Output file to store the xmltv EPG data.
TEMP_FILE=/tmp/xmltv.xml
OUTPUT_FILE=/var/www/epg/listings-mheg5.xml

PWD=`pwd`

if [ -e "$TEMP_FILE" ] && [ -f "$TEMP_FILE" ] ; then
rm "$TEMP_FILE"
fi

# Get the MHEG5 EPG data from the DVT-T multiplex.
dvbtune -f $DVB_T_FREQ -qam 64 -gi 16 -cr 3_4 -bw 8 -tm 8 -m -c
$ADAPTER 2>&1 &
DVBTUNE_PID=$!
sleep 1
echo Running mhegepgsnoop.py now
mhegepgsnoop.py -v -zp -d /dev/dvb/adapter${ADAPTER}/demux0 -o
$TEMP_FILE
if [ $? -ne 0 ]; then
rm $TEMP_FILE
echo Error: mhegepgsnoop failed!
else
# Temporary fix for bad <channel id> values in the MHEG5 EPG data.
sed -f /usr/local/bin/mhegepgsnoop_sed_replacements --in-place
$TEMP_FILE

mv $TEMP_FILE $OUTPUT_FILE
chmod a+rw $OUTPUT_FILE
fi
kill $DVBTUNE_PID


and the mhegepgsnoop_sed_replacements file contains:

s/comedy-central.sky.co.nz/tvcentral.freeviewnz.tv/g
s/.sky.co.nz/.freeviewnz.tv/g


The problem that was fixing is likely long gone now - I have not
touched this code since April 2014.

Watch out for word wraps, or download the file from my web server:

http://www.jsw.gen.nz/mythtv/do_mhegepgsnoop.sh

I am using a modified version of mhegepgsnoop-0.5.2.py - I needed to
ensure that only the DVB-T channels in my database were used for
channel matching, not the DVB-S ones:

root@mypvr:/usr/local/bin# diff mhegepgsnoop-0.5.2.py mhegepgsnoop.py
3c3
< VERSION = '0.5.2'
---
> VERSION = '0.5.2 JSW'
6c6
< Version: 0.5.2
---
> Version: 0.5.2 JSW modified version
95a96
> 0.5.2 JSW Change selects used to get channels from MythTV to only get DVB-T channels.
870c871
< dbconn.execute("select callsign, name, xmltvid
from channel")
---
> dbconn.execute("select callsign, name, xmltvid from channel c, dtv_multiplex d where c.mplexid is not NULL and c.mplexid = d.mplexid and d.mod_sys != 'DVB-S'")
883c884
< f = os.popen("mysql -ss " + mysql_args + " -e
'select callsign, name, xmltvid from channel' mythconverg")
---
> f = os.popen('mysql -ss ' + mysql_args + ' -e \'select callsign, name, xmltvid from channel c, dtv_multiplex d where c.mplexid is not NULL and c.mplexid = d.mplexid and d.mod_sys != "DVB-S"\' mythconverg')

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
On 21/05/15 23:34, Robin Gilks wrote:
>> Tried updating to 0.6.0 from 0.5.1 and get another error (as well as not
>> tuning).
>>
>>
>> Building XML file: /tmp/list-xxx
>> Traceback (most recent call last):
>> File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 1594, in <module>
>> main()
>> File "/usr/local/bin/mhegepgsnoop-0.6.0.py", line 795, in main
>> elif options.clean_titles2:
>> AttributeError: 'Namespace' object has no attribute 'clean_titles2'
> Solved one problem - the above error goes away if I use the '-c' clear
> titles option with an empty (default) string on 0.6.0.
>
> With no backend running to tune the card I still need to run something
> like dvbtune in monitor mode to keep the card open?
>
> Something like "dvbtune -f 562000000 -c 0 -m"
>
>
Hi Robin, been a long time since I've looked at the code but I'll try
and figure it out for you. First the error

AttributeError: 'Namespace' object has no attribute 'clean_titles2'

is a strange one which might be something to do with Python versions.
What version of Python are you running?

The tuning problem seems to be due to a non-integer value for (possibly)
the frequency or inversion parameters stored in the mythtv database. I
wouldn't have thought the frequency would ever be anything but a number
but maybe a letter is a valid value for the inversion parameter. Can you
execute the following query in mysql and show me what is returned?

select channum, frequency, inversion from channel join dtv_multiplex on
channel.mplexid=dtv_multiplex.mplexid where channum=33;

David

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
> Hi Robin, been a long time since I've looked at the code but I'll try
> and figure it out for you. First the error
>
> AttributeError: 'Namespace' object has no attribute 'clean_titles2'
>
> is a strange one which might be something to do with Python versions.
> What version of Python are you running?
>
> The tuning problem seems to be due to a non-integer value for (possibly)
> the frequency or inversion parameters stored in the mythtv database. I
> wouldn't have thought the frequency would ever be anything but a number
> but maybe a letter is a valid value for the inversion parameter. Can you
> execute the following query in mysql and show me what is returned?
>
> select channum, frequency, inversion from channel join dtv_multiplex on
> channel.mplexid=dtv_multiplex.mplexid where channum=33;

I'm running the new stable Debian Jessie.

$ python --version
Python 2.7.9

I thought the channel number was the NZ standard UHF channel -> frequency,
not the numeric label I had given it for a particular program. That won't
work for me as I use the same channel numbers for DVB-S as well as DVB-T
and then set the UHF high def channels at a higher priority.

+---------+-----------+-----------+
| channum | frequency | inversion |
+---------+-----------+-----------+
| 1 | 12483000 | a |
| 1 | 578000000 | a |
+---------+-----------+-----------+

It all seems to work OK when the backend is running, even when nothing is
being recorded, I don't need the tuning parameter. Something about opening
the TBS6281 maybe?

Appreciate your looking at it anyway...

--
Robin Gilks



_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
On 22/05/15 23:00, Robin Gilks wrote:
>> Hi Robin, been a long time since I've looked at the code but I'll try
>> and figure it out for you. First the error
>>
>> AttributeError: 'Namespace' object has no attribute 'clean_titles2'
>>
>> is a strange one which might be something to do with Python versions.
>> What version of Python are you running?
>>
>> The tuning problem seems to be due to a non-integer value for (possibly)
>> the frequency or inversion parameters stored in the mythtv database. I
>> wouldn't have thought the frequency would ever be anything but a number
>> but maybe a letter is a valid value for the inversion parameter. Can you
>> execute the following query in mysql and show me what is returned?
>>
>> select channum, frequency, inversion from channel join dtv_multiplex on
>> channel.mplexid=dtv_multiplex.mplexid where channum=33;
> I'm running the new stable Debian Jessie.
>
> $ python --version
> Python 2.7.9
>
> I thought the channel number was the NZ standard UHF channel -> frequency,
> not the numeric label I had given it for a particular program. That won't
> work for me as I use the same channel numbers for DVB-S as well as DVB-T
> and then set the UHF high def channels at a higher priority.
>
> +---------+-----------+-----------+
> | channum | frequency | inversion |
> +---------+-----------+-----------+
> | 1 | 12483000 | a |
> | 1 | 578000000 | a |
> +---------+-----------+-----------+
>
> It all seems to work OK when the backend is running, even when nothing is
> being recorded, I don't need the tuning parameter. Something about opening
> the TBS6281 maybe?
>
> Appreciate your looking at it anyway...
>
Yes, I think it was Stephen W who pointed out to me that if you don't
tell mythtv to release channels when it is not recording they stay
locked and hence available for other code like mhegepgsnoop to read
from. I forget the exact option which keeps the channel locked.
Something to do with EIT maybe?

Turns out 'a' (as shown in your sql dump) is the default value for
inversion and (I think) means 'auto'. I think this needs to be converted
to an unsigned int with a value of 2 before it gets sent to your tuner
card however I need to check/test this.

It hadn't occurred to me that channum might not be unique. The chanid is
unique but how does the user know what it is without going into
mythbackend setup or mysql? Maybe that is OK for typical mythtv users. I
need to think that through. Any suggestions welcomed. One kludge I
thought of was to create a dummy channel with a unique channum which you
only use for getting the epg. Sounds painful to set up.

I think the other problem you had with clean_titles2 is a bug. I tried
to make the code work with the old optparse command line parser and the
new argparse parser but I think I must have screwed up the clean titles
bit. I will try and fix this also.

No promises about when I'll get this done. :)

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
On 22/05/15 23:00, Robin Gilks wrote:
>> Hi Robin, been a long time since I've looked at the code but I'll try
>> and figure it out for you. First the error
>>
>> AttributeError: 'Namespace' object has no attribute 'clean_titles2'
>>
>> is a strange one which might be something to do with Python versions.
>> What version of Python are you running?
>>
>> The tuning problem seems to be due to a non-integer value for (possibly)
>> the frequency or inversion parameters stored in the mythtv database. I
>> wouldn't have thought the frequency would ever be anything but a number
>> but maybe a letter is a valid value for the inversion parameter. Can you
>> execute the following query in mysql and show me what is returned?
>>
>> select channum, frequency, inversion from channel join dtv_multiplex on
>> channel.mplexid=dtv_multiplex.mplexid where channum=33;
> I'm running the new stable Debian Jessie.
>
> $ python --version
> Python 2.7.9
>
> I thought the channel number was the NZ standard UHF channel -> frequency,
> not the numeric label I had given it for a particular program. That won't
> work for me as I use the same channel numbers for DVB-S as well as DVB-T
> and then set the UHF high def channels at a higher priority.
>
> +---------+-----------+-----------+
> | channum | frequency | inversion |
> +---------+-----------+-----------+
> | 1 | 12483000 | a |
> | 1 | 578000000 | a |
> +---------+-----------+-----------+
>
> It all seems to work OK when the backend is running, even when nothing is
> being recorded, I don't need the tuning parameter. Something about opening
> the TBS6281 maybe?
>
> Appreciate your looking at it anyway...
>
Well it was such a crap weather day today I decided to rip into it. I
have uploaded version 0.6.1 to sourceforge. I believe I have fixed the
bugs with cleaning titles and tuning but I have not done a lot of
testing. I also added a '-T' option as an alternative to the '-t' tuning
option. Use '-T <chanid>' to tune to a channel id instead of channel
number. For example '-T 1003' would tune my system to channel 3 (TV3).
Hope this works for you.

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
> Well it was such a crap weather day today I decided to rip into it. I
> have uploaded version 0.6.1 to sourceforge. I believe I have fixed the
> bugs with cleaning titles and tuning but I have not done a lot of
> testing. I also added a '-T' option as an alternative to the '-t' tuning
> option. Use '-T <chanid>' to tune to a channel id instead of channel
> number. For example '-T 1003' would tune my system to channel 3 (TV3).
> Hope this works for you.

Hi David

Thanks for the fixes, I'll test them when the crap weather gets here
tomorrow!! Not sure where the channel ID comes from - 1003 seems a pretty
obscure number to be sure. I would have expected either a frequency or
channel number of the multiplex i.e. for the Sugar Loaf in Christchurch
either one of
562000000, 578000000 or 594000000
or
32, 34 or 36

Individual stations (eg. TV3) don't really enter into it do they?

Like I say, I'll get into it tomorrow as I have to switch all the aerials
over from the old PC to the new one whilst I fiddle and I'm trying not to
miss any scheduled programs!

Cheers

--
Robin Gilks




_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
On 23/05/15 22:28, Robin Gilks wrote:
>> Well it was such a crap weather day today I decided to rip into it. I
>> have uploaded version 0.6.1 to sourceforge. I believe I have fixed the
>> bugs with cleaning titles and tuning but I have not done a lot of
>> testing. I also added a '-T' option as an alternative to the '-t' tuning
>> option. Use '-T <chanid>' to tune to a channel id instead of channel
>> number. For example '-T 1003' would tune my system to channel 3 (TV3).
>> Hope this works for you.
> Hi David
>
> Thanks for the fixes, I'll test them when the crap weather gets here
> tomorrow!! Not sure where the channel ID comes from - 1003 seems a pretty
> obscure number to be sure. I would have expected either a frequency or
> channel number of the multiplex i.e. for the Sugar Loaf in Christchurch
> either one of
> 562000000, 578000000 or 594000000
> or
> 32, 34 or 36
>
> Individual stations (eg. TV3) don't really enter into it do they?
>
> Like I say, I'll get into it tomorrow as I have to switch all the aerials
> over from the old PC to the new one whilst I fiddle and I'm trying not to
> miss any scheduled programs!
>
> Cheers
>
The chanid is created automatically by mythtv I believe. I think it's
arbitrary, i.e., you could choose any number so long as it's unique. You
could tune by the frequency in the dtv_multiplex table but the original
idea was to use a number the user could easily remember. There is a
mplexid field in the dtv_multiplex table but again how do you know what
frequency it means unless you look in the table? So, yes, you are right
that it's the RF frequency that matters, not the individual channel, but
how easy is it remember xxx MHz vs channel number x for the average person?

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Python error in mhegepgsnoop [ In reply to ]
On Sat, 23 May 2015 23:18:57 +1200, you wrote:

>On 23/05/15 22:28, Robin Gilks wrote:
>>> Well it was such a crap weather day today I decided to rip into it. I
>>> have uploaded version 0.6.1 to sourceforge. I believe I have fixed the
>>> bugs with cleaning titles and tuning but I have not done a lot of
>>> testing. I also added a '-T' option as an alternative to the '-t' tuning
>>> option. Use '-T <chanid>' to tune to a channel id instead of channel
>>> number. For example '-T 1003' would tune my system to channel 3 (TV3).
>>> Hope this works for you.
>> Hi David
>>
>> Thanks for the fixes, I'll test them when the crap weather gets here
>> tomorrow!! Not sure where the channel ID comes from - 1003 seems a pretty
>> obscure number to be sure. I would have expected either a frequency or
>> channel number of the multiplex i.e. for the Sugar Loaf in Christchurch
>> either one of
>> 562000000, 578000000 or 594000000
>> or
>> 32, 34 or 36
>>
>> Individual stations (eg. TV3) don't really enter into it do they?
>>
>> Like I say, I'll get into it tomorrow as I have to switch all the aerials
>> over from the old PC to the new one whilst I fiddle and I'm trying not to
>> miss any scheduled programs!
>>
>> Cheers
>>
>The chanid is created automatically by mythtv I believe. I think it's
>arbitrary, i.e., you could choose any number so long as it's unique. You
>could tune by the frequency in the dtv_multiplex table but the original
>idea was to use a number the user could easily remember. There is a
>mplexid field in the dtv_multiplex table but again how do you know what
>frequency it means unless you look in the table? So, yes, you are right
>that it's the RF frequency that matters, not the individual channel, but
>how easy is it remember xxx MHz vs channel number x for the average person?

Yes, the chanid is just an arbitrary number that is automatically
created to use as a unique identifier for one row in the channel
table. So 1003 is probably the third row created in the channel
table, since chanid values seem to start from 1001. I normally
manually create my channel table entries for new or changed channels,
so my chanid values usually have some useful information in them (I
use 4xxx for my Sky DVB-S channels and 1xxx for my Freeview DVB-T
ones). The uniqueness of the chanid values is required for the
database to work. If you are messing around with them, make very sure
not to duplicate chanid values. They are not normally visible to
MythTV users, except in log files and the filenames of recordings -
they are intended for internal use only and are used in other tables
to reference the channel table.

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/