Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with live channels #30

Open
claudeha opened this issue May 28, 2022 · 2 comments
Open

problem with live channels #30

claudeha opened this issue May 28, 2022 · 2 comments

Comments

@claudeha
Copy link

Hi, I'm using latest LibreELEC minimal OS for Kodi on rpi4, but had some problems with Live Channels in this plugin/addon for tv3cat (symptom: clicking live channels in the addon ui would just display an error in the top right saying to check log). Here is a log snippet:

2022-05-28 15:35:46.000 T:10478   DEBUG <general>: plugin.video.tv3.cat classe UI - run()  mode = ['directe']
2022-05-28 15:35:46.000 T:10478   DEBUG <general>: -----------------listDirecte--------------------
2022-05-28 15:35:46.413 T:10478   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'AttributeError'>
                                                   Error Contents: 'str' object has no attribute 'get'
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.tv3.cat/addon.py", line 32, in <module>
                                                       ui.run(mode, url)
                                                     File "/storage/.kodi/addons/plugin.video.tv3.cat/resources/lib/ui/UI.py", line 116, in run
                                                       lVideos = self.tv3.listDirecte()
                                                     File "/storage/.kodi/addons/plugin.video.tv3.cat/resources/lib/tv3cat/TV3cat.py", line 314, in listDirecte
                                                       nameChannel = c[i].get('ara_fem', {}).get('codi_canal', None)
                                                   AttributeError: 'str' object has no attribute 'get'
                                                   -->End of Python script error report<--

I edited plugin.video.tv3.cat/resources/lib/tv3cat/TV3cat.py to add try/except around line 314 and following, and then the error changed:

2022-05-28 15:43:37.483 T:10532   DEBUG <general>: -----------------listDirecte--------------------
2022-05-28 15:43:37.775 T:10532   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'UnboundLocalError'>
                                                   Error Contents: local variable 'infotv3' referenced before assignment
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.tv3.cat/addon.py", line 32, in <module>
                                                       ui.run(mode, url)
                                                     File "/storage/.kodi/addons/plugin.video.tv3.cat/resources/lib/ui/UI.py", line 116, in run
                                                       lVideos = self.tv3.listDirecte()
                                                     File "/storage/.kodi/addons/plugin.video.tv3.cat/resources/lib/tv3cat/TV3cat.py", line 346, in listDirecte
                                                       infolabelstv3['plot'] = infotv3
                                                   UnboundLocalError: local variable 'infotv3' referenced before assignment
                                                   -->End of Python script error report<--

so I just initialized like infotv3 = 'n/a' (and the other similar variables) before the blocks where they are set/used...

Here are all the changes I made that got live Catalan TV working for me:

$ diff -u TV3cat.py.orig TV3cat.py
--- TV3cat.py.orig	2022-05-28 15:50:13.127127849 +0100
+++ TV3cat.py	2022-05-28 15:50:13.099127586 +0100
@@ -311,6 +311,7 @@
 
                 i = 0
                 while i < 5:
+                  try:
                     nameChannel = c[i].get('ara_fem', {}).get('codi_canal', None)
 
                     if nameChannel == 'tv3':
@@ -325,14 +326,16 @@
                     if nameChannel == '324':
                         arafem324 = c[i].get('ara_fem', {}).get('titol_programa', None)
                         arafem324_sinop = c[i].get('ara_fem', {}).get('sinopsi', None)
-
-                    i = i + 1
+                  except AttributeError:
+                    pass
+                  i = i + 1
 
             infolabelstv3 = {}
             infolabels324 = {}
             infolabels33 = {}
             infolabelsesp3 = {}
 
+            infotv3 = 'n/a'
             if arafemtv3:
                 infolabelstv3['title'] = arafemtv3
                 infotv3 = '[B]' + arafemtv3 + '[/B]' + '[CR]'
@@ -343,6 +346,7 @@
 
             infolabelstv3['plot'] = infotv3
 
+            info33 = 'n/a'
             if arafem33:
                 infolabels33['title'] = arafem33
                 info33 = '[B]' + arafem33 + '[/B]' + '[CR]'
@@ -353,6 +357,7 @@
 
             infolabels33['plot'] = info33
 
+            infoesp3 = 'n/a'
             if arafemesp3:
                 infolabelsesp3['title'] = arafemesp3
                 infoesp3 = '[B]' + arafemesp3 + '[/B]' + '[CR]'
@@ -363,6 +368,7 @@
 
             infolabelsesp3['plot'] = infoesp3
 
+            info324 = 'n/a'
             if arafem324:
                 infolabels324['title'] = arafem324
                 info324 = '[B]' + arafem324 + '[/B]' + '[CR]'

Thanks very much for your work on this plugin/addon, it's really appreciated. If you would prefer, I can make a pull request with the above changes.

claudeha added a commit to claudeha/plugin.video.tv3.cat that referenced this issue May 28, 2022
str object has no get() method

part 1/2 of fix for <jqandreu#30>
claudeha added a commit to claudeha/plugin.video.tv3.cat that referenced this issue May 28, 2022
local variable 'infotv3' (and others) referenced before assignment

part 2/2 of fix for <jqandreu#30>
@claudeha
Copy link
Author

claudeha commented Jul 1, 2022

This fix no longer works.

I think TV3 have changed their streaming system, now the web-based player accesses separate playlists of sound and video fragments (each about 6 seconds long, with slightly different start times) that need to be downloaded and multiplexed somehow.

I'm in the UK, testing the international broadcast streams.

@claudeha claudeha changed the title problem with live channels (with solution) problem with live channels Jul 1, 2022
@mcr222
Copy link

mcr222 commented Oct 14, 2024

Hey, from the new website, I made a first iteration. https://github.com/mcr222/plugin.video.3cat/releases/tag/v1.0.0

I have not done live channels though if you wanna collaborate on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants