emilsvennesson / kodi-viaplay

Viaplay for Kodi
GNU General Public License v3.0
31 stars 19 forks source link

Support for Kodi 19 Matrix #41

Open hedmo opened 3 years ago

hedmo commented 3 years ago

hi

as the title is .... does it work with kodi-19 ?. i am running gentoo and need/want to manually install it via the package manage . the other plugins i have created and installed have had its own files for kodi-19 (THE PLUGIN NAME.matrix.zip")

regards

emilsvennesson commented 3 years ago

https://github.com/emilsvennesson/kodi-viaplay/commit/4fb6b09aec142ed2546281af93011d14deaecb05 adds initial python3 support. It's currently not thoroughly tested, so please let me know if you find any bugs related to the switch.

hedmo commented 3 years ago

bbd3627 adds initial python3 support. It's currently not thoroughly tested, so please let me know if you find any bugs related to the switch.

Will do . Thanks

SweXtal commented 3 years ago

Never ever going to mention something here again just to be slapfaced and flagged.

filigranen commented 3 years ago

I tried this now, but cannot start any video. The log gets spammed with the entire .sami file:

[snip]
SYNC START=5674740>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=5705260>\r\n      <P CLASS=SUBTTL>Vad det &auml;n &auml;r, verkar det vara inaktivt.\r\n   <SYNC START=5707940>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=5708180>\r\n      <P CLASS=SUBTTL>Jag antar att man m&aring;ste...\r\n   <SYNC START=5709500>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=5710460>\r\n      <P CLASS=SUBTTL>Var redo med vapnen.\r\n   <SYNC START=5712780>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=5713220>\r\n      <P CLASS=SUBTTL>Ta bort den! F&aring; bort den!\r\n   <SYNC START=5715460>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=5747180>\r\n      <P CLASS=SUBTTL>Vad tusan &auml;r det d&auml;r?\r\n   <SYNC START=5748540>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=5748940>\r\n      <P CLASS=SUBTTL>Det &auml;r min nya svid, kompis.\r\n   <SYNC START=5751020>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=5752660>\r\n      <P CLASS=SUBTTL>Jag hoppas att den finns<br>i storlek 52 l&aring;ng.\r\n   <SYNC START=5755340>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n   <SYNC START=6149260>\r\n      <P CLASS=SUBTTL>&Ouml;vers&auml;ttning: Bengt-Ove Andersson\r\n   <SYNC START=6151180>\r\n      <P CLASS=SUBTTL>&nbsp;\r\n</BODY>\r\n</SAMI>\r\n'
2021-03-04 13:49:16.669 T:3414    DEBUG <general>: 
[snip]

,and it ends with a crash:

2021-03-04 13:49:16.672 T:3414    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: 'HTMLParser' object has no attribute 'unescape'
                                                   Traceback (most recent call last):
                                                     File "/home/arch/.kodi/addons/plugin.video.viaplay/default.py", line 5, in <module>
                                                       addon.run()
                                                     File "/home/arch/.kodi/addons/plugin.video.viaplay/resources/lib/addon.py", line 22, in run
                                                       plugin.run()
                                                     File "/home/arch/.kodi/addons/script.module.routing/lib/routing.py", line 130, in run
                                                       self._dispatch(self.path)
                                                     File "/home/arch/.kodi/addons/script.module.routing/lib/routing.py", line 141, in _dispatch
                                                       view_func(**kwargs)
                                                     File "/home/arch/.kodi/addons/plugin.video.viaplay/resources/lib/addon.py", line 205, in play
                                                       helper.play(guid=plugin.args['guid'][0], url=plugin.args['url'][0], tve=plugin.args['tve'][0])
                                                     File "/home/arch/.kodi/addons/plugin.video.viaplay/resources/lib/kodihelper.py", line 211, in play
                                                       playitem.setSubtitles(self.vp.download_subtitles(stream['subtitles']))
                                                     File "/home/arch/.kodi/addons/plugin.video.viaplay/resources/lib/viaplay.py", line 259, in download_subtitles
                                                       subtitle = htmlparser.unescape(sami).encode('utf-8')
                                                   AttributeError: 'HTMLParser' object has no attribute 'unescape'
                                                   -->End of Python script error report<--

Full log here: https://paste.kodi.tv/fonukawada.kodi

Let me know if you want me to add a new issue with this, but I suppose it's related to the python switch.

Leatherface75 commented 3 years ago

Tried this today and seems to work fine

Ravnsborgs commented 3 years ago

I got it working on Kodi 19 on a FireTV 4K today after strugling a bit with downloading the repository. I couldn't find version 2.1.2 in the official Kodi repository. But I downloaded the .zip file code-tab and installed the plug-in with no issues. I have only tested a few episodes but everything seems to be working ok. Thumbs up from Denmark!

Ravnsborgs commented 3 years ago

Tested for ~one day. Subtitle language chages every now and then.

failure84 commented 3 years ago

Tested on Ubuntu 21.04 and had to use html lib instead of HtmlParser lib and subtitles writes as w not wb (bytes). Not tested much right now but playing stream. Will get back with a patch / pr, l8er.

failure84 commented 3 years ago
--- kodi-viaplay/resources/lib/viaplay.py   2021-04-26 09:24:06.432313939 +0200
+++ plugin.video.viaplay-failure84/resources/lib/viaplay.py 2021-04-25 21:45:15.000000000 +0200
@@ -8,7 +8,8 @@
 import re
 import json
 import uuid
-import html.parser as HTMLParser
+#import html.parser as HTMLParser
+import html
 from collections import OrderedDict
 from datetime import datetime, timedelta

@@ -87,7 +88,7 @@
         try:
             response = json.loads(response, object_pairs_hook=OrderedDict)  # keep the key order
             if 'success' in response and not response['success']:  # raise ViaplayError when 'success' is False
-                raise self.ViaplayError(response['name'].encode('utf-8'))
+                raise self.ViaplayError(response['name'])
         except ValueError:  # if response is not json
             pass

@@ -255,10 +256,10 @@
         paths = []
         for sub_data in suburls:
             sami = self.make_request(url=sub_data['href'], method='get').decode('utf-8', 'ignore').strip()
-            htmlparser = HTMLParser.HTMLParser()
-            subtitle = htmlparser.unescape(sami).encode('utf-8')
+            #htmlparser = HTMLParser.HTMLParser()
+            subtitle = html.unescape(sami)
             path = os.path.join(self.tempdir, '{0}.sami'.format(sub_data['languageCode']))
-            with open(path, 'wb') as subfile:
+            with open(path, 'w') as subfile:
                 subfile.write(subtitle)
             paths.append(path)
failure84 commented 3 years ago

Subtitles / Audio streams works.

Ravnsborgs commented 3 years ago

failure84: Will the updated code be uploaded and the viaplay.py file be updated or is it on a do-it-yourself basis? Cause Im no python linguist.

Mariusz89B commented 3 years ago

Leia and Matrix support, with other fixes: https://github.com/Mariusz89B/kodi-viaplay/releases/