Re: silence.py mythcommflag

For discussion of topics specific to MythTV on linux
Post Reply
ceesquared
Junior
Posts: 17
Joined: Tue Dec 11, 2018 4:20 pm
Location: Marlborough UK
Great Britain

Re: silence.py mythcommflag

Post by ceesquared »

I'm running ubuntu 18.08 and mythtv v32. All updated three weeks age( about 2 May 2022). When I try a test run on silence.py,(silence.py --chanid 10129 --starttime 20220523195800 --loglevel debug) I get:=
2022-05-26 12:12:27.316302 D [3493] Python Database Connection Trying database credentials from: /home/colin/config.xml
2022-05-26 12:12:27.336729 I [3493] mythcommflag:
2022-05-26 12:12:27.341364 I [3493] mythcommflag: Seeking chanid 10129, starttime 2022-05-23 19:58:00+01:00
2022-05-26 12:12:27.347008 E [3493] mythcommflag: Failed due to: "DBData() could not read from database"

Is the fault in silence.py or in mythcommflag? Any help or guidance would be appreciated.
Last edited by ceesquared on Wed Jun 08, 2022 8:56 pm, edited 1 time in total.
blm-ubunet
Senior
Posts: 265
Joined: Sun Jun 15, 2014 1:08 am
Cambodia

Re: silence.py mythcommflag

Post by blm-ubunet »

You're running this as a frontend user which is different to the backend user (mythtv).
The BE would normally be running this user-job using credentials from ~/mythtv/.mythtv/config.xml and failing back to /etc/mythtv/somewhere..
User avatar
dnalorernst
Developer
Posts: 103
Joined: Mon Feb 17, 2020 8:03 pm
Austria

Re: silence.py mythcommflag

Post by dnalorernst »

A quick search on this forum results to
viewtopic.php?f=36&t=3763&hilit=silence.py#p18087
Does this make sense?
ceesquared
Junior
Posts: 17
Joined: Tue Dec 11, 2018 4:20 pm
Location: Marlborough UK
Great Britain

Re: silence.py mythcommflag

Post by ceesquared »

Ta blm-ubunet, but it does'n make any difference, mythtv or user( commandline operation refers see dnalorenst quick link and search 'On running silence.py manually I am getting ').
Ta also to dnalorenst. It made sense sort of. I changed to a BST recording time, not GMT and it changed the error mythcommflag.....to 'failed due to: "__init__() got an unexpected keyword argument 'text'". I must revisit the BST/GMT corrections to python3. Still some progress, I've changed the error! I have checked and there are no occurrences of 'utf' in silence.py. I have searched for ""silence.py" __init__() got an unexpected keyword argument 'text'" and got nil.
User avatar
dnalorernst
Developer
Posts: 103
Joined: Mon Feb 17, 2020 8:03 pm
Austria

Re: silence.py mythcommflag

Post by dnalorernst »

Looking into the linked thread, there is a way to look deeper into the traceback:
Please apply the patch below
Add the code marked with ' ### XXX' at line 240:

Code: Select all

  except Exception as e:
    raise        ### XXX for debugging only !
    # get exception before we generate another
Take care on the indentation, use the same amount of spaces/tabs.

Please also state how you invoke the script 'silence.py'
ceesquared
Junior
Posts: 17
Joined: Tue Dec 11, 2018 4:20 pm
Location: Marlborough UK
Great Britain

Re: silence.py mythcommflag

Post by ceesquared »

Entering argument and result:-
silence.py --chanid 10129 --starttime 20220506195800 --loglevel debug
2022-06-06 20:46:50.739555 D [2155] Python Database Connection Trying database credentials from: /home/colin/config.xml
2022-06-06 20:46:50.749548 I [2155] mythcommflag:
2022-06-06 20:46:50.753111 I [2155] mythcommflag: Seeking chanid 10129, starttime 2022-05-06 19:58:00+01:00
2022-06-06 20:46:50.762086 I [2155] mythcommflag: Processing: 5 USA, 2022-05-06 19:58:00+01:00, "NCIS - US crime series"
2022-06-06 20:46:50.771040 E [2155] mythcommflag: Failed due to: "__init__() got an unexpected keyword argument 'text'"

Patch applied. I now get:-
After trace

$ silence.py --chanid 10129 --starttime 20220506195800 --loglevel debug
2022-06-06 21:08:23.595977 D [2311] Python Database Connection Trying database credentials from: /home/colin/config.xml
2022-06-06 21:08:23.610665 I [2311] mythcommflag:
2022-06-06 21:08:23.614393 I [2311] mythcommflag: Seeking chanid 10129, starttime 2022-05-06 19:58:00+01:00
2022-06-06 21:08:23.621927 I [2311] mythcommflag: Processing: 5 USA, 2022-05-06 19:58:00+01:00, "NCIS - US crime series"
Traceback (most recent call last):
File "/usr/local/bin/silence.py", line 285, in <module>
main()
File "/usr/local/bin/silence.py", line 185, in main
stdout=subprocess.PIPE, text=True)
TypeError: __init__() got an unexpected keyword argument 'text'
I am now in above my head, any replies will be acted upon verbatim"!
User avatar
dnalorernst
Developer
Posts: 103
Joined: Mon Feb 17, 2020 8:03 pm
Austria

Re: silence.py mythcommflag

Post by dnalorernst »

Please check the python version, open a terminal and type

Code: Select all

python3 --version
If the version is python 3.6, then the following link might help:
https://stackoverflow.com/questions/526 ... t-argument

In short, replace in silence.py

Code: Select all

    p3 = subprocess.Popen([kExe_Silence, "%d" % p1.pid] + param.getValues(), stdin=p2.stdout,
                stdout=subprocess.PIPE, text=True)
with

Code: Select all

    p3 = subprocess.Popen([kExe_Silence, "%d" % p1.pid] + param.getValues(), stdin=p2.stdout,
                stdout=subprocess.PIPE, universal_newlines=True)
ceesquared
Junior
Posts: 17
Joined: Tue Dec 11, 2018 4:20 pm
Location: Marlborough UK
Great Britain

Re: silence.py mythcommflag

Post by ceesquared »

Success! Thank you dnalorernst. It came up with python 3.9 so I changed 'text' to 'universal_newlines' and it found 4 adverts in a 65 min recording, which I reckon is about right. In summary, for future readers, Remember python is LMT and a recording may be GMT, and in silence.py for v3.n, change 'text' to 'universal_newlines' in one line, other lines may be affected by the patch which is not correct I found but it can be followed. I now have another problem. I thought that I had sorted it. If I do a command line, it works OK. However, when I put it into mythtv, BE setup it shows 127 adverts detected, which I know is wrong (same file, different method). Is it a time zone issue? As the program is passed %JOBID%, I would have thought that time zone was not an issue. dnalorenst, you seem to be an expert, do you or anybody else have any ideas? Possibly of interest, I do not have a file /var/log/mythtv/mythcommflag.log, is this significant?
ceesquared
Junior
Posts: 17
Joined: Tue Dec 11, 2018 4:20 pm
Location: Marlborough UK
Great Britain

Re: Re: silence.py mythcommflag

Post by ceesquared »

I have had a play, and by replacing %JOBID% with jobid %JOBID% and deleting %VERBOSEMODE% I get a sort of success. I will check after 2105 BST 10 Jun 22 that it works automagically. Assuming it does then I have to sort out why it says that no adverts detected when it did detect adverts and why no log file. Neither of these are stoppers, but it would be nice to sort it out for future readers.
Post Reply