firsttris / plugin.video.sendtokodi

:tv: plays various stream sites on kodi using youtube-dl
MIT License
125 stars 28 forks source link

ModuleNotFoundError: No module named 'inputstreamhelper' #77

Closed Kaiden42 closed 2 years ago

Kaiden42 commented 2 years ago

Describe the bug When I open a Livestream or VOD from Twitch a critical error is thrown and the video doesn't start.

To Reproduce Steps and/or URL of you media to reproduce the problem

Sending any media from Twitch to Kodi ends up in an error. Some links I've tried:

Expected behavior A clear and concise description of what you expected to happen.

The video should play.

Kodi and sendtokodi version (please complete the following information):

Provide a Kodi log

2022-09-15 20:29:39.693 T:934 INFO : plugin.video.sendtokodi: found original manifest: https://usher.ttvnw.net/api/channel/hls/lolworldchampionship.m3u8?allow_source=true&allow_audio_only=true&allow_spectre=true&p=3036459&player=twitchweb&playlist_include_framerate=true&segment_preference=4&sig=53bb6f26574f76b4c652481b019d99ee4e888e99&token=%7B%22adblock%22%3Afalse%2C%22authorization%22%3A%7B%22forbidden%22%3Afalse%2C%22reason%22%3A%22%22%7D%2C%22blackout_enabled%22%3Afalse%2C%22channel%22%3A%22lolworldchampionship%22%2C%22channel_id%22%3A581721883%2C%22chansub%22%3A%7B%22restricted_bitrates%22%3A%5B%5D%2C%22view_until%22%3A1924905600%7D%2C%22ci_gb%22%3Afalse%2C%22geoblock_reason%22%3A%22%22%2C%22device_id%22%3Anull%2C%22expires%22%3A1663267778%2C%22extended_history_allowed%22%3Afalse%2C%22game%22%3A%22%22%2C%22hide_ads%22%3Afalse%2C%22https_required%22%3Atrue%2C%22mature%22%3Afalse%2C%22partner%22%3Afalse%2C%22platform%22%3A%22web%22%2C%22player_type%22%3A%22site%22%2C%22private%22%3A%7B%22allowed_to_view%22%3Atrue%7D%2C%22privileged%22%3Afalse%2C%22role%22%3A%22%22%2C%22server_ads%22%3Atrue%2C%22show_ads%22%3Atrue%2C%22subscriber%22%3Afalse%2C%22turbo%22%3Afalse%2C%22user_id%22%3Anull%2C%22user_ip%22%3A%2292.117.216.214%22%2C%22version%22%3A2%7D 2022-09-15 20:29:39.699 T:934 ERROR : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--

2022-09-15 20:29:40.608 T:934 INFO : Python interpreter stopped



**Additional context**
Add any other context about the problem here.

This error might be caused by the latest changes made with commit [6183f0190eb82eaf435e06e37c57db3d40096b07](https://github.com/firsttris/plugin.video.sendtokodi/commit/6183f0190eb82eaf435e06e37c57db3d40096b07)
nullket commented 2 years ago

Mhm :/ I will look into this tomorrow.

It seems like you are missing the input stream helper which should be installed automatically! Can you please test to uninstall sendtokodi and reinstall it?

Also, you have manually turned on the „ Use original manifest“ setting right?

Kaiden42 commented 2 years ago

Thank you very much for your quick answer. :slightly_smiling_face:

Can you please test to uninstall sendtokodi and reinstall it?

I've uninstalled and reinstalled the plugin now. But the error is still thrown.

Also, you have manually turned on the „ Use original manifest“ setting right?

I didn't knew this setting existed until now. The setting was turned off, I've never touched it. Toggling this setting on and off did not change anything :thinking:

nullket commented 2 years ago

Okay this is a two part issue. Sorry for the inconvenience introduced by the new adaptive streaming feature.

  1. The setting is per default off (as it should be) but for whatever reason it gets interpreted as True here. I have conducted multiple tests on my instance and it is always correct according to the settings. This unfortunately means that I can not reproduce the issue. Are you familiar with python and the terminal and could help debugging on your instance? If yes, lets start easy:

    • open service.py and insert the following in this empty line
      import time
      setting = xbmcplugin.getSetting(int(sys.argv[1]),"usemanifest")
      showInfoNotification(f"Setting value is {setting}")  
      time.sleep(5)
    • Start the plugin (either via kodi (yes it will give an error afterwards) or via sending an url)
    • You should get a notification indicating whether the setting is on or of
    • Toggle the setting and start the plugin again
    • Report back if the notification reports the correct status chosen in the settings
    • Just FYI: Changes to the add-on get deleted automatically once the auto updater updates the plugin
  2. We use the plugin inputstreamhelper to install everything needed for adaptive streaming (the way most streams work nowadays). Based on their wiki and this line It SHOULD install automatically when installing sendtokodi. On my instance it is installed already from other addons (e.g. youtube). Can you please uninstall sendtokodi and install it again and provide the kodi log of the installation part?

Kaiden42 commented 2 years ago

Sorry for the inconvenience introduced by the new adaptive streaming feature

All is well :slightly_smiling_face: .

Yes I'm familiar with python. I added your lines in the file service.py. The message is showing "false" when the toggle is off and "true" when the toggle is on. Which means the settings are working correctly.

Therefore I added a lot of log printings into the file to see what the values are at the importand places in the code. The values are always correct according to the settings I made in the configuration menu of the addon. I got a little bit curious about why it is jumping in the wrong branch of the if statement.

This got me to the root of the problem. Always the "truth" branch of the if was executed, regardless of the settings. As I've currently a lot to do with TS/JS at work, I remebered myself back about a thing called "truthyness". Therefore, I've logged the type of the "usemanifest setting like this:

log(type(xbmcplugin.getSetting(int(sys.argv[1]), "usemanifest")))

The logged type was <class 'str'>, which means the value is "true"/"false" instead of true/false. A non empty string is always considered as true, according to the documentation.

Unluckily, I still don't know why the module inputstreamhelper is not installed automatically. These are the log entries of the reinstallation of the sendtokodi addon, which are not very helpful:

Uninstall

2022-09-18 00:16:14.634 T:800      INFO <general>: Loading skin file: DialogConfirm.xml, load type: KEEP_IN_MEMORY
2022-09-18 00:16:22.524 T:800   WARNING <general>: CGUIMediaWindow::OnMessage - updating in progress

Install

2022-09-18 00:17:01.439 T:3478     INFO <general>: CAddonMgr::FindAddon: plugin.video.sendtokodi v0.9.279 installed
2022-09-18 00:17:02.141 T:800   WARNING <general>: CGUIMediaWindow::OnMessage - updating in progress
nullket commented 2 years ago

Ah nice bug hunt, thanks! I just committed the simple fix in https://github.com/firsttris/plugin.video.sendtokodi/commit/ad4db41dac24965ae6be73ae076977ff8ac7dc0d. Automatic updates should be available any minute. At this point I am amazed that not more people came here and reported issues. This must mean that this experimental feature works quite well :D (at least for those having inputstreamhelper already installed).

Nonetheless, I would like to leave the issue open and figure out why the helper add-on is not installed along with sendtokodi in the first place.

nullket commented 2 years ago

I have installed kodi on another test computer and added our plugin by installing the latest version directly from the zip. The dependency inputstreamhelper gets installed without any issue.

2022-09-19 12:15:08.897 T:40       INFO <general>: CAddonMgr::FindAddon: script.module.inputstreamhelper v0.5.10+matrix.1 installed
2022-09-19 12:15:09.395 T:40       INFO <general>: CAddonMgr::FindAddon: plugin.video.sendtokodi v0.9.282 installed

When I install it via the repo the dependency is missing. This makes sense as the dependency must be declared in the repo again here. Just did in https://github.com/firsttris/repository.sendtokodi.python3/commit/af9a1ad9900f128ba20317d5c8bb5f3fd731ed05

Can you please test if the installation works now for you as well?

Kaiden42 commented 2 years ago

Is there a newer zip file available? The zip file of the addon repository, that is linked on the readme, is a little bit outdated. The last file changes were made in 2021-06-02 and the addon.xml file in the zip doesn't contain the declaration of the dependency.

When I use this zip, nothing changes:

2022-09-20 21:30:16.137 T:800   WARNING <general>: CGUIMediaWindow::OnMessage - updating in progress
2022-09-20 21:30:38.942 T:800   WARNING <general>: CGUIMediaWindow::OnMessage - updating in progress

2022-09-20 21:32:25.083 T:800      INFO <general>: UDev: Added /var/media/Transcend

2022-09-20 21:33:12.742 T:6779     INFO <general>: CAddonMgr::FindAddon: repository.sendtokodi.python3 v0.0.1 installed

2022-09-20 21:34:01.697 T:6780     INFO <general>: CAddonMgr::FindAddon: plugin.video.sendtokodi v0.9.283 installed
2022-09-20 21:34:02.340 T:800   WARNING <general>: CGUIMediaWindow::OnMessage - updating in progress
nullket commented 2 years ago

The repo is an add-on itself which would not be updated in terms of the add-on. Only the content of the repo and its index would be updated. Unfortunately, the auto updater reverted my changes (to many places where the dependency must be mentioned). The repo points to this index which now finally includes the dependency.

So:

Just to avoid any misunderstandings, the latest zip of the addon (not the repo) can always be found in this folder. When installed via our repo, kodi will automatically install this latest version (highly recommended as websites change very often). I am really curious if a update might not install later added dependencies (I could not find any documentation on this).

Kaiden42 commented 2 years ago

The automatic update of the repository was turned off in my setting. I turned it on and waited a few minutes but nothing was triggered. The automatic update of the addon itself was already on before. Still nothing got triggered. :thinking:

I've manually reinstalled the version v0.0.1 of the repository via the Kodi menu. The dependency was now installed with it:

2022-09-21 20:10:07.068 T:938      INFO <general>: CAddonMgr::FindAddon: repository.sendtokodi.python3 v0.0.1 installed
2022-09-21 20:10:07.849 T:827   WARNING <general>: CGUIMediaWindow::OnMessage - updating in progress
2022-09-21 20:10:13.431 T:943      INFO <general>: CAddonMgr::FindAddon: script.module.inputstreamhelper v0.5.10+matrix.1 installed
2022-09-21 20:10:24.231 T:943      INFO <general>: CAddonMgr::FindAddon: plugin.video.sendtokodi v0.9.285 installed
2022-09-21 20:10:24.953 T:827   WARNING <general>: CGUIMediaWindow::OnMessage - updating in progress

Thank you very much for your time and effort solving this issue with me! :slightly_smiling_face:

Should this issue still kept open in case someone else still has some problems with the inputstreamhelper or would you like to close it?

nullket commented 2 years ago

The repo addon has not been updated only the content/index of the repo. If you have auto updates for the sendtokodi addon (not the repo) enabled, it takes up to one day until a pending update gets installed.

Anyways, thanks for reporting the issue! I am closing it in the hope that this is now fixed!

btw you can now even try the new experimental manifest feature (turn it on in the settings) to support more sites and better quality for many other sites (YouTube is unfortunately not one of them)