Kodi Community Forum

Full Version: pvr.mythtv add-on
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In fact, the addon already handle the job once it succeeded the first handshake with the backend.
On a backend sleep or shutdown the addon receive an event from cppmyth (eventHandler) and then it go in a loop to sleep for times and retry to connect (every 5 sec). Once a connection succeeded because the backend becomes available, it go out of the loop and relaunch its great activity for our pleasure.

Since krypton Kodi seems to launch one time only the function ADDON_create() and never recall it. So at this point we have to do things to handshake with the backend or launch a thread to loop for future negociation. I choosen to handshake or cancel the negociation depending of what user wants: If the backend is up and the addon succeeded to connect, it launches these workers and returns OK.
If it fails to connect or handshake , it will send a magic packet (trying to wakeup the backend) and then will ask to user what to do by a GUI box. While user ask to retry, it will retry. Else it will leave and will be never restarted until the next startup of kodi.

With version 4.11.6 , I just added the loop to allow user to retry any time that necessary to handshake (in fact the time required by the backend to wakeup). Or maybe the time the user need to investigate why the backend is down.

Before the change, the loop wasn't required because kodi launched the ADDON_create in its loop until a permanent failure.
Thanks for the update Janbar.
Working fine with 18.0 now.
@glubbish, nice to hear that

@thebpass, I reviewed my code and in fact the sleeping loop and a kind of "async connect" is done by cppmyth in the main loop of the event handler thread: https://github.com/janbar/cppmyth/blob/m...r.cpp#L328
for prime test of latest addon for kodi krypton before release out on debian/ubuntu: package "kodi-pvr-mythtv-krypton" from my ppa: https://launchpad.net/~jlbarriere68/+archive/ubuntu/ppa
(2016-12-17, 01:52)janbar Wrote: [ -> ]I reviewed my code and in fact the sleeping loop and a kind of "async connect" is done by cppmyth in the main loop of the event handler thread: https://github.com/janbar/cppmyth/blob/m...r.cpp#L328

Ahh I see. Ok, so I went and played around with that and I made this, which implements connect more like how HTS does it with the ConnectionState handling in Krypton.

https://github.com/b-pass/pvr.mythtv/com...17b4f73ce9

I am not sure it was worth the effort though. It does not really change anything noticable for the user. So I didn't submit it as a PR. But if you want me to, I can.
I'm seeing problems with recordings not appearing since pull request https://github.com/kodi-pvr/pvr.mythtv/pull/78 was merged

I don't get my full list of recordings anymore:
Before:
Image
After:
Image

I would try to narrow it down a bit more but commit https://github.com/janbar/pvr.mythtv/com...d5caaf66d0 which is where this all started is rather large.

I'm still using Krypton: Specifically LibreElec 7.90.009 and a self compiled x86 version based on pre-beta6.
@metaron-uk, thanks for reporting the issue. It should be fixed with version 4.12.4 for kodi Krypton, and 5.0.6 for kodi 18.0.
I can't reproduce the issue every times. It depends of content response from the backend. I hope it is closed for you.
(2016-12-15, 09:24)janbar Wrote: [ -> ]@teeedubb ,

I pushed a fix to handle the startup.
The addon always managed these connections asynchonously. But the startup requires a handshake with the PIN.
So now if the addon failed to connect at startup it send the magic packet to wake up the backend (see settings for hw address of the backend) and then it open a dialog allowing the user to launch a retry or stop the negociation.
You won t need script. Let me know how it work for you.
Version is 4.11.6

I've only had the opportunity to test it once but it works as intended, thanks. Any chance for a option for the addon to continuously attempt to connect in the background, without the dialog/user intervention? Quite often I will use kodi on its own, without the backend (local music, photos, games etc)
(2016-12-18, 01:30)janbar Wrote: [ -> ]@metaron-uk, thanks for reporting the issue. It should be fixed with version 4.12.4 for kodi Krypton, and 5.0.6 for kodi 18.0.
I can't reproduce the issue every times. It depends of content response from the backend. I hope it is closed for you.

Thanks @janbar. I can confirm this fixes the issue with my 0.27.6 backend Smile
Hi Janbar,

The addon is broken again on the latest nightly: 18.0-alpha1 Git:20161219

06:59:22.759 T:140456121222912 DEBUG: PVR - Create - creating PVR add-on instance 'MythTV PVR Client'
06:59:22.759 T:140456121222912 DEBUG: ADDON: Dll Initializing - MythTV PVR Client
06:59:22.759 T:140456121222912 DEBUG: SECTION:LoadDLL(/usr/lib/x86_64-linux-gnu/kodi/addons/pvr.mythtv/pvr.mythtv.so.5.0.4)
06:59:22.759 T:140456121222912 DEBUG: Loading: /usr/lib/x86_64-linux-gnu/kodi/addons/pvr.mythtv/pvr.mythtv.so.5.0.4
.. redacted (contains sql statement preventing post
06:59:22.762 T:140456121222912 ERROR: ADDON: Dll MythTV PVR Client - Client returned bad status (6) from Create and is not usable
Just to say this now works! Fedora sent out an update.

What's the new menu item in there about a channel scan? Will this mean no more dealing with MythTV's hideous channel scanner software?
(2016-12-19, 22:15)biggaz Wrote: [ -> ]Just to say this now works! Fedora sent out an update.

What's the new menu item in there about a channel scan? Will this mean no more dealing with MythTV's hideous channel scanner software?
Channel scan isn't available with mythtv addon. You have to deal with the famous myth-setup.
(2016-12-19, 22:06)glubbish Wrote: [ -> ]Hi Janbar,

The addon is broken again on the latest nightly: 18.0-alpha1 Git:20161219

06:59:22.759 T:140456121222912 DEBUG: PVR - Create - creating PVR add-on instance 'MythTV PVR Client'
06:59:22.759 T:140456121222912 DEBUG: ADDON: Dll Initializing - MythTV PVR Client
06:59:22.759 T:140456121222912 DEBUG: SECTION:LoadDLL(/usr/lib/x86_64-linux-gnu/kodi/addons/pvr.mythtv/pvr.mythtv.so.5.0.4)
06:59:22.759 T:140456121222912 DEBUG: Loading: /usr/lib/x86_64-linux-gnu/kodi/addons/pvr.mythtv/pvr.mythtv.so.5.0.4
.. redacted (contains sql statement preventing post
06:59:22.762 T:140456121222912 ERROR: ADDON: Dll MythTV PVR Client - Client returned bad status (6) from Create and is not usable

Nothing abnormal this night ! Just ABI of kodi has been changed and none of pvr addons has been rebuild. I tried locally with succeeded startup of the addon and then a crash due to change not yet stable in the pvr manager.
(2016-12-20, 00:18)janbar Wrote: [ -> ]Nothing abnormal this night ! Just ABI of kodi has been changed and none of pvr addons has been rebuild. I tried locally with succeeded startup of the addon and then a crash due to change not yet stable in the pvr manager.

Its always interesting. Hopefully 17 will go prod soon and things will quiet down.

EDIT: I have rolled back to the unstable ppa, should not get any more pvr issues Smile
Running Kodi (17.0-RC2 Git:20161230-nogitfound). Platform: Linux x86 64-bit

When watching a recorded program and hitting x I get:
- The pvr backend does not support this action. Check the log for more information about this message.

log shows:

17:34:12.098 T:139884392081152 DEBUG: DoWork - Saving file state for video item pvr://recordings/tv/active/Default/The Big Bang Theory/The%20Big%20Bang%20Theory (2016)%20The%20Einstein%20Approximation%2FThe%20Large%20Hadron%20Collision, TV%20(7%20Digital), 20161222_104000, 1070_1482403200_4d6.pvr
17:34:12.100 T:139886217595264 DEBUG: ------ Window Deinit (DialogSeekBar.xml) ------
17:34:12.101 T:139886217595264 DEBUG: ------ Window Deinit (Custom_1109_TopBarOverlay.xml) ------
17:34:12.107 T:139884392081152 DEBUG: AddOnLog: MythTV PVR Client: SetRecordingLastPlayedPosition: Recording 1070_1482403200_4d6 does not exist
17:34:12.107 T:139884392081152 ERROR: PVR - SetRecordingLastPlayedPosition - addon 'MythTV (kodi):http://10.0.0.60:6544' returned an error: the command failed