f-lawe / plugin.video.orange.fr

Orange TV France for Kodi
MIT License
49 stars 18 forks source link

No channels for Orange TV Reunion? #10

Closed starmate closed 3 years ago

starmate commented 3 years ago

Hi,

Thanks for this addon.

I am trying to make it work for Orange TV Réunion.

When I am trying to fetch channels from IPTV Manager, I have the following error : orange TV error (check log for more details).

I've noticed that from resources/lib/providers/fr/orange.py, you define channels numbers. I believe that this would be difference for Reunion. Do you think I could update this? If yes, Do you know how I could retrive those information?

Thanks,

Jon

starmate commented 3 years ago

I've updated the channel numbers (found from https://chaines-tv.orange.fr/#live/home) and I tried again without any luck.

I've checked the log file this time and this is what I have :

EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'http.client.IncompleteRead'>
                                                   Error Contents: IncompleteRead(2948872 bytes read)
                                                   Traceback (most recent call last):
                                                     File "C:\Program Files (x86)\Kodi\system\python\Lib\http\client.py", line 575, in _readall_chunked
                                                       value.append(self._safe_read(chunk_left))
                                                     File "C:\Program Files (x86)\Kodi\system\python\Lib\http\client.py", line 614, in _safe_read
                                                       raise IncompleteRead(data, amt-len(data))
                                                   http.client.IncompleteRead: IncompleteRead(1998 bytes read, 6194 more expected)

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\addon.py", line 58, in <module>
                                                       plugin.run()
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\script.module.routing\lib\routing.py", line 130, in run
                                                       self._dispatch(self.path)
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\script.module.routing\lib\routing.py", line 141, in _dispatch
                                                       view_func(**kwargs)
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\addon.py", line 55, in iptv_epg
                                                       IPTVManager(port, get_provider()).send_epg()
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\lib\iptvmanager.py", line 25, in send
                                                       sock.sendall(json.dumps(func(self)).encode()) # pylint: disable=not-callable
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\lib\iptvmanager.py", line 39, in send_epg
                                                       return { 'version': 1, 'epg': self.provider.get_epg() }
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\lib\providers\fr\orange.py", line 106, in get_epg
                                                       programs.extend(self._get_programs(
                                                     File "C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\lib\providers\fr\orange.py", line 164, in _get_programs
                                                       return json.loads(res.read())
                                                     File "C:\Program Files (x86)\Kodi\system\python\Lib\http\client.py", line 465, in read
                                                       return self._readall_chunked()
                                                     File "C:\Program Files (x86)\Kodi\system\python\Lib\http\client.py", line 579, in _readall_chunked
                                                       raise IncompleteRead(b''.join(value))
                                                   http.client.IncompleteRead: IncompleteRead(2948872 bytes read)
                                                   -->End of Python script error report<--

Do you know how I could fix this issue?

Thanks,

Jon

starmate commented 3 years ago

Hi,

I was able to fix the error by updating the get_programs endpoint url, but I don't have any channels showing on TV screen.

Here is what I have in log file now: 2021-08-26 12:58:21.766 T:9400 INFO <general>: [service.iptv.manager] [resources.lib.modules.addon] Updating IPTV data for plugin.video.orange.fr... 2021-08-26 12:58:21.766 T:9400 INFO <general>: [service.iptv.manager] [resources.lib.modules.addon] Requesting channels from plugin://plugin.video.orange.fr/iptv/channels... 2021-08-26 12:58:21.767 T:9400 INFO <general>: [service.iptv.manager] [resources.lib.modules.addon] Executing RunPlugin(plugin://plugin.video.orange.fr/iptv/channels?port=2053)... 2021-08-26 12:58:21.790 T:4736 INFO <general>: initializing python engine. 2021-08-26 12:58:21.897 T:4736 INFO <general>: Orange TV France: Loading channels for IPTV Manager 2021-08-26 12:58:23.668 T:4736 INFO <general>: CPythonInvoker(43, C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\addon.py): script successfully run 2021-08-26 12:58:23.742 T:4736 INFO <general>: Python interpreter stopped 2021-08-26 12:58:23.746 T:9400 INFO <general>: [service.iptv.manager] [resources.lib.modules.addon] Requesting epg from plugin://plugin.video.orange.fr/iptv/epg... 2021-08-26 12:58:23.747 T:9400 INFO <general>: [service.iptv.manager] [resources.lib.modules.addon] Executing RunPlugin(plugin://plugin.video.orange.fr/iptv/epg?port=2057)... 2021-08-26 12:58:23.764 T:19184 INFO <general>: initializing python engine. 2021-08-26 12:58:23.865 T:19184 INFO <general>: Orange TV France: Loading EPG for IPTV Manager 2021-08-26 12:59:14.813 T:19184 INFO <general>: CPythonInvoker(44, C:\Users\jonat\AppData\Roaming\Kodi\addons\plugin.video.orange.fr\resources\addon.py): script successfully run 2021-08-26 12:59:14.882 T:19184 INFO <general>: Python interpreter stopped 2021-08-26 12:59:21.273 T:11816 INFO <general>: PVR Manager: Stopping 2021-08-26 12:59:21.273 T:19028 INFO <general>: EPG Container: Persisting unsaved events... 2021-08-26 12:59:21.273 T:19028 INFO <general>: EPG Container: Persisting events done 2021-08-26 12:59:22.036 T:11816 INFO <general>: PVR Manager: Stopped 2021-08-26 12:59:22.485 T:9400 INFO <general>: CPythonInvoker(40, C:\Users\jonat\AppData\Roaming\Kodi\addons\service.iptv.manager\default.py): script successfully run 2021-08-26 12:59:22.554 T:9400 INFO <general>: Python interpreter stopped 2021-08-26 12:59:23.906 T:11816 INFO <general>: ADDON: Dll Destroyed - PVR IPTV Simple Client 2021-08-26 12:59:23.930 T:12356 INFO <general>: AddOnLog: pvr.iptvsimple: pvr.iptvsimple - PVRIptvData::Create - Creating the PVR IPTV Simple add-on 2021-08-26 12:59:23.945 T:12356 ERROR <general>: AddOnLog: pvr.iptvsimple: pvr.iptvsimple - iptvsimple::PlaylistLoader::LoadPlayList - Playlist file path is not configured. Channels not loaded. 2021-08-26 12:59:23.945 T:12356 INFO <general>: AddOnLog: pvr.iptvsimple: PVRIptvData::Create Starting separate client update thread... 2021-08-26 12:59:23.946 T:12356 INFO <general>: PVR Manager: Starting 2021-08-26 12:59:23.951 T:17968 INFO <general>: PVR Manager: Started Any idea?

Thanks,

Jon

BreizhReloaded commented 3 years ago

Hello Starmate!

The channels list at the top of orange.py are just used to recreate channel groups (like on this doc). The actual channel number is retrieved from the calls to Orange, except channel groups, there is no data stored within the addon.

As you mentioned in your last post, the key is to update the endpoints. Once done, there is no assurance that the response format will match. We had some checks a few months ago for Orange Belgium, and the api architecture there is totally different. That's why this addon is built in order to support different providers in the future.

That said, Orange Réunion seems to share the same infrastructure. What are the new endpoints you used? Do you have a response example?

On peut basculer en français pour la suite si tu veux. Je ne pourrai pas faire les tests depuis la métropole, mais je peux aiguiller pour ajouter un nouveau fournisseur à l'addon !

starmate commented 3 years ago

Hello,

Merci pour ton retour. Bon après un léger reverse engineering, j'ai finalement trouvé la solution!

Voici les bons paramètres :

groups = {
        'Généralistes':                 [20245,21079,1080,70005,192,4,80,47,20118,78],
        'Divertissement':               [30195,1996,531,70216,57,70397,70398,70399],
        'Jeunesse':                     [30482],
        'Découverte':                   [111,30445],
        'Jeunes':                       [30444,20119,21404,21403,563],
        'Musique':                      [20458,21399,70150,605],
        'Sport':                        [64,2837],
        'Jeux':                         [1061],
        'Société':                      [1072],
        'Information française':        [234,481,226,112,2111,529,1073],
        'Information internationale':  [671,53,51,410,19,525,70239,70240,70241,70242,781,830,70246,70503]
    }
def get_stream_info(self, channel_id: int) -> dict:
        endpoint = 'https://mediation-tv.orange.fr/all/live/v3/applications/PC/users/me/channels/{channel_id}/stream?terminalModel=WEB_PC'
def get_streams(self) -> list:
        endpoint = 'https://mediation-tv.orange.fr/all/live/v3/applications/PC/channels?mco=ORE'
def _get_programs(self, period_start: int = None, period_end: int = None) -> list:
        """Returns the programs for today (default) or the specified period"""
        endpoint = 'https://mediation-tv.orange.fr/all/live/v3/applications/PC/programs?period={period}&mco=ORE'

Je ne sais pas trop pourquoi, mais j'ai du manuellement mettre les chemins des fichiers EPG et Playlist dans IPTV Simple. J'ai du loupé quelque chose... Mais bon le plus important c'est que ça marche ;)

Merci à toi et si besoin (tests ou autre), n'hésites pas.

BreizhReloaded commented 3 years ago

Ah, mais c'est top ça ! C'est exactement ça, un peu de retro-engineering de ce qui se passe dans le navigateur. En fait, l'addon ne fait que de se faire passer passer pour un navigateur auprès d'Orange, puis transfère le flux à InputStream. La bonne nouvelle, c'est que ça fonctionne exactement pareil, y'a visiblement que le paramètre mco=ORE qui est différent, en métropole on a mco=OFR.

Ce que je te propose, c'est tout simplement d'ajouter ce fournisseur au projet. Je vais voir comment je peux factoriser ça, avec de la chance, c'est la même pour les Antilles. J'aurais juste besoin de toi pour que tu me confirmes que tout se passe bien :)

Question pratique dans le sélecteur de fournisseurs dans les paramètres de l'addon : il vaut mieux mettre La Réunion comme un territoire à part entière, ou simplement ajouter Orange Réunion dans la liste des fournisseurs disponibles en France ?

starmate commented 3 years ago

Hello,

C'est parfait, effectivement 👍 Super ton module.

Effectivement, il y a de grandes chances pour que ce soit la même chose pour les Antilles.

Pour ta question, si je devais le faire moi, j'aurai laissé France et ajouté Orange Réunion comme fournisseur.

Merci encore ;)

BreizhReloaded commented 3 years ago

Et voilà le travail : https://github.com/BreizhReloaded/plugin.video.orange.fr/archive/refs/heads/dev.zip.

Le sélecteur a l'air de fonctionner : quand j'active la Réunion, j'ai la liste des chaînes qui apparaît dans Kodi, avec Réunion 1ère, TV Kreol, Mayotte 1ère, etc. Par contre, je ne peux pas regarder les chaînes locales, mais ça, ça paraît logique.

Je te laisse installer ce zip et me dire ce que ça donne chez toi !

starmate commented 3 years ago

Hello,

J'ai installé mais ça me sort un message d'erreur. Je regarde demain lorsque j'aurai un peu plus de temps et je te tiens au courant.

starmate commented 3 years ago

Voici ce que j'ai dans les logs : `2021-08-27 20:35:25.812 T:540 ERROR : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--

BreizhReloaded commented 3 years ago

Étrange... il n’arrive pas à récupérer la liste des chaînes. Tu as bien sélectionné Orange Réunion dans les paramètres de l’addon ?

Sinon, j’ai peut-être fait une faute de frappe en récupérant ta configuration. Tu devrais pouvoir modifier ça dans le fichier orange_reunion.py.

Tiens-moi au courant !

starmate commented 3 years ago

Oui, j'ai essayé plusieurs fois. J'ai fait un switch de Orange FR > Orange Réunion et inversement.

Je regarde tout ça lorsque j'ai un peu de temps et je reviens vers toi... ça ne doit pas être bien méchant :)

Merci encore.

BreizhReloaded commented 3 years ago

Alors @starmate, du nouveau depuis la Réunion ? Tiens-moi au courant, pour que je puisse faire les corrections nécessaires et publier une éventuelle nouvelle version !

BreizhReloaded commented 3 years ago

Je pense que j'ai fini par trouvé ! Une obscure histoire de & et de ? dans les URL. Dans le doute, et parce que ça semble fonctionner un peu depuis chez moi, j'ai publié une nouvelle version.