palinek / pvr.sledovanitv.cz

Kodi's sledovanitv.cz client addon
GNU General Public License v2.0
30 stars 14 forks source link

Creating duplicate connections with v1.6.2 #48

Closed koyuch closed 4 years ago

koyuch commented 4 years ago
Expected Behavior

Addon should boot with available channels.

Current Behavior

Creating too much duplicate connections even with updated addon v1.6.2. In the end service won't boot. There is just error response from api: Error indicated in response. status: 0, error: pairing limit reached Screenshot_20200324_182917_sledovanietv

Possible Solution

Reuse already created connection to api.

Context

There could be some drop-outs of wifi network on my device - sometimes I cannot boot with correct connection, but even if it will pass I cannot see any channels in addon. (It did work, until some number of "devices" - I did write to service support & it worked for some time, but after some time it happened again - all the time with version 1.6.2)

System Information
Kodi's Log

2020-03-24 18:37:41.121 T:2529997008   ERROR: CCurlFile::Open failed with code 0 for https://sledovanitv.cz/api/delete-pairing?deviceId=818852729&password=hele&unit=default:
2020-03-24 18:37:41.122 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Cannot open url
2020-03-24 18:37:41.127 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error parsing response. Response is: , reader error: * Line 1, Column 1
                                              Syntax error: value, object or array expected.
2020-03-24 18:37:41.229 T:2529997008   ERROR: CCurlFile::FillBuffer - Failed: Couldn't resolve host name(6)
2020-03-24 18:37:41.229 T:2529997008   ERROR: CCurlFile::Open failed with code 0 for https://sledovanitv.cz/api/create-pairing?username=me%40gmail.com&password=hahu&type=androidportable&serial=3ed0a9c49e77fcf9cd52291154c107e909430a687bd1e4a0987e175d2a9a5cf1&product=raspi4&unit=default&checkLimit=1:
2020-03-24 18:37:41.229 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Cannot open url
2020-03-24 18:37:41.229 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error parsing response. Response is: , reader error: * Line 1, Column 1
                                              Syntax error: value, object or array expected.
2020-03-24 18:37:41.229 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error in pairing response.
2020-03-24 18:38:38.625 T:2529997008   DEBUG: CurlFile::Open(0xaf621280) https://sledovanitv.cz/api/delete-pairing?deviceId=818852729&
password=huhu&unit=default
2020-03-24 18:38:39.165 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error indicated in response. status: 0, error: no device
2020-03-24 18:38:39.165 T:2529997008   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): buildQueryString - size 7
2020-03-24 18:38:39.165 T:2529997008   DEBUG: CurlFile::Open(0xaf658a20) https://sledovanitv.cz/api/create-pairing?username=moj%40gmail.com&password=hele&type=androidportable&serial=3ed0a9c49e77fcf9cd52291154c107e909430a687bd1e4a0987e175d2a9a5cf1&product=raspi4&unit=default&checkLimit=1
2020-03-24 18:38:39.406 T:2412761296   DEBUG: CWebServer[8080]: request received for /jsonrpc
2020-03-24 18:38:39.432 T:2529997008   DEBUG: Previous line repeats 1 times.
2020-03-24 18:38:39.432 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error indicated in response. status: 0, error: pairing limit reached
2020-03-24 18:38:39.432 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error in pairing response.
2020-03-24 18:38:39.432 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Cannot pair device
2020-03-24 18:38:40.954 T:2412761296   DEBUG: CWebServer[8080]: request received for /jsonrpc
2020-03-24 18:38:41.777 T:2556412112   DEBUG: Previous line repeats 1 times.
2020-03-24 18:38:41.777 T:2556412112    INFO: JSONRPC Server: Disconnection detected
2020-03-24 18:39:03.910 T:2744066256   DEBUG: Thread JobWorker 2744066256 terminating (autodelete)
2020-03-24 18:39:03.916 T:2767044816   DEBUG: Thread JobWorker 2767044816 terminating (autodelete)
2020-03-24 18:39:03.929 T:2752458960   DEBUG: Thread JobWorker 2752458960 terminating (autodelete)
2020-03-24 18:39:09.435 T:2529997008   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Openning file /home/pi/.kodi/userdata/addon_data/pvr.sledovanitv.cz/pairinfo
2020-03-24 18:39:09.436 T:2529997008   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): buildQueryString - size 3
2020-03-24 18:39:09.436 T:2529997008   DEBUG: CurlFile::Open(0xaf658a20) https://sledovanitv.cz/api/delete-pairing?deviceId=818852729&password=hojho&unit=default
2020-03-24 18:39:09.575 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error indicated in response. status: 0, error: no device
2020-03-24 18:39:09.575 T:2529997008   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): buildQueryString - size 7
2020-03-24 18:39:09.575 T:2529997008   DEBUG: CurlFile::Open(0xaf658a20) https://sledovanitv.cz/api/create-pairing?username=me%40gmail.com&password=hahu&type=androidportable&serial=3ed0a9c49e77fcf9cd52291154c107e909430a687bd1e4a0987e175d2a9a5cf1&product=raspi4&unit=default&checkLimit=1
2020-03-24 18:39:09.734 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error indicated in response. status: 0, error: pairing limit reached
2020-03-24 18:39:09.735 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error in pairing response.
2020-03-24 18:39:09.735 T:2529997008   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Cannot pair device
palinek commented 4 years ago

Hi, it seems to be really confusing to decide if the delete-pairing must succeed in this kind of situation (network may not be available)...

Reuse already created connection to api.

That's. of course, the current state. Device does not create-pairing on each start. It just logins. Only if login fails, it tries to delete-pairing (optional) and create-pairing & login.

palinek commented 4 years ago

Anyways... the quickest solution for you is to not allow start kodi until network is ready.

koyuch commented 4 years ago

Hmm, I thought that I have resolved problems with wifi (I have used external usb adapter instead of built-in). But it's still probably not the case. Anyway the plugin behaves still odd:

2020-03-27 08:30:42.253 T:2529951952   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error indicated in response. status: 0, error:
2020-03-27 08:30:42.258 T:2529951952   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): buildQueryString - size 7
2020-03-27 08:30:42.259 T:2529951952   DEBUG: CurlFile::Open(0xaece76e0) https://sledovanitv.cz/api/create-pairing?username=me%40gmail.com&password=hh&type=androidportable&serial=fheuhai8&product=raspi4&unit=default&checkLimit=1
2020-03-27 08:30:42.259 T:2529951952    INFO: easy_acquire - Created session to https://sledovanitv.cz
2020-03-27 08:30:42.316 T:2719113424   DEBUG: GetMappingForDevice - device (2708:1001) mapped to CEC Adapter (type = cec)
2020-03-27 08:30:42.319 T:2719113424   DEBUG: InitialiseFeature - using libCEC v4.0.4
2020-03-27 08:30:42.319 T:2719113424   DEBUG: Initialise - initialised peripheral on 'RPI' with 2 features and 0 sub devices
2020-03-27 08:30:42.319 T:2719113424  NOTICE: Register - new cec device registered on cec->RPI: CEC Adapter (2708:1001)
2020-03-27 08:30:42.319 T:2719113424   DEBUG: Thread PeripBusCEC 2719113424 terminating
2020-03-27 08:30:42.322 T:2472095952   DEBUG: Thread CECAdapter start, auto delete: false
2020-03-27 08:30:42.322 T:2472095952   DEBUG: OpenConnection - opening a connection to the CEC adapter: RPI
2020-03-27 08:30:42.360 T:2529951952   ERROR: CCurlFile::FillBuffer - Failed: Couldn't resolve host name(6)
2020-03-27 08:30:42.360 T:2529951952   ERROR: CCurlFile::Open failed with code 0 for https://sledovanitv.cz/api/create-pairing?username=me%40gmail.com&password=hh&type=androidportable&serial=fhuiehaih&product=raspi4&unit=default&checkLimit=1:
2020-03-27 08:30:42.360 T:2529951952   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Cannot open url
2020-03-27 08:30:42.365 T:2529951952   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error parsing response. Response is: , reader error: * Line 1, Column 1
                                              Syntax error: value, object or array expected.
2020-03-27 08:30:42.366 T:2529951952   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error in pairing response.
2020-03-27 08:30:42.366 T:2529951952   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Cannot pair device

and then

2020-03-27 08:31:11.597 T:2521243856   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): GetChannelGroupMembers General
2020-03-27 08:31:12.370 T:2529951952   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Openning file /home/pi/.kodi/userd
ata/addon_data/pvr.sledovanitv.cz/pairinfo
2020-03-27 08:31:12.371 T:2529951952   ERROR: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Error indicated in response. statu
s: 0, error:
2020-03-27 08:31:12.371 T:2529951952   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): buildQueryString - size 7
2020-03-27 08:31:12.372 T:2529951952   DEBUG: CurlFile::Open(0x90a48398) https://sledovanitv.cz/api/create-pairing?username=me%40g
mail.com&password=fihef&type=androidportable&serial=vhehvfh&product=ra
spi4&unit=default&checkLimit=1
2020-03-27 08:47:53.549 T:2521243856   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): GetChannelGroupMembers Movie
2020-03-27 08:47:53.745 T:2529951952   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Device ID: 1574709259, Password: 8
prin9sc56hmkmgr52hl
2020-03-27 08:47:53.748 T:2529951952   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): buildQueryString - size 5
2020-03-27 08:47:53.748 T:2529951952   DEBUG: CurlFile::Open(0x90a48398) https://sledovanitv.cz/api/device-login?deviceId=642868&p
assword=foieho&version=2.6.21&lang=en&unit=default
2020-03-27 08:47:53.779 T:2767044816   DEBUG: Thread JobWorker 2767044816 terminating (autodelete)
2020-03-27 08:47:53.779 T:2752684240   DEBUG: Thread JobWorker 2752684240 terminating (autodelete)
2020-03-27 08:47:53.780 T:2744291536   DEBUG: Thread JobWorker 2744291536 terminating (autodelete)
2020-03-27 08:47:53.877 T:2529951952  NOTICE: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Device logged in. Session ID: fhoiheih
2020-03-27 08:47:54.879 T:2529951952   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): buildQueryString - size 4
2020-03-27 08:47:54.880 T:2529951952   DEBUG: CurlFile::Open(0x90a48398) https://sledovanitv.cz/api/playlist?uuid=fheeh8&format=m3u8&quality=20&capabilities=h265%2cadaptive2&PHPSESSID=fiheihiie
2020-03-27 08:47:55.063 T:2529951952   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): Channel#1 Jednotka, URL: https://sledovanitv.cz/vlc/api-channel/stv1sk.m3u8?PHPSESSID=fheaiuh&quality=20&capabilities=h265%2Cadaptive2
Maor545 commented 4 years ago

I have the same problem. What is the recommended solution to not run out of device pairing limit?

palinek commented 4 years ago

What is the recommended solution to not run out of device pairing limit?

To have network ready when running this addon :)

Anyways I've just pushed (and released) commits to try handle network/server errors for Matrix -> e4fdc73 & Leia -> 2cb6d7e