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

Video won't play because of non-ascii character in title #637

Closed
2 of 4 tasks
stefano-salari opened this issue Jul 31, 2022 · 10 comments
Closed
2 of 4 tasks

Video won't play because of non-ascii character in title #637

stefano-salari opened this issue Jul 31, 2022 · 10 comments
Labels
information need info Additional information required

Comments

@stefano-salari
Copy link

Addon used

  • Amazon VOD (plugin.video.amazon-test)
  • Browser Launcher (plugin.program.browser.launcher)
  • Addon version:

Account type

  • primevideo.com
  • amazon.(com/co.uk/de/jp)

System Setup (please provide the following information):

  • Hardware: Raspberry PI 3 Model B
  • OS version: LibreElec 9.2.8
  • Kodi version number: 18.9.0

Upload Logs
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.UnicodeDecodeError'>
Error Contents: 'ascii' codec can't decode byte 0xc3 in position 22: ordinal not in range(128)
Traceback (most recent call last):
File "/storage/.kodi/addons/plugin.video.amazon-test/default.py", line 5, in
EntryPoint()
File "/storage/.kodi/addons/plugin.video.amazon-test/resources/lib/startup.py", line 70, in EntryPoint
PlayVideo(args.get('name', ''), args.get('asin'), args.get('adult', '0'), int(args.get('trailer', '0')), int(args.get('selbitrate', '0')))
File "/storage/.kodi/addons/plugin.video.amazon-test/resources/lib/playback.py", line 437, in PlayVideo
amazonUrl = g.BaseUrl + "/dp/" + (name if g.UsePrimeVideo else asin)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 22: ordinal not in range(128)
-->End of Python script error report<--

Describe the bug
The plugin can't play Amazon videos that contains Utf8 characters, such as "L'altro lato della metà". The error log refers to line 437 of file "/storage/.kodi/addons/plugin.video.amazon-test/resources/lib/playback.py":

      amazonUrl = g.BaseUrl + "/dp/" + (name if g.UsePrimeVideo else asin)

I found the issue in the "name" variable and fixed it as follows:

      amazonUrl = g.BaseUrl + "/dp/" + (name.decode("utf-8") if g.UsePrimeVideo else asin)

Not an elegant solution but it worked, in my case. I wanted to share the issue with you, who can surely find a better approach to solve it.

Hope this could be useful, I'm available for any further info.

@Varstahl
Copy link
Collaborator

à is ASCII though, 224. Something's weird but thanks for reporting, I'll look into it.

@stefano-salari
Copy link
Author

As a further info, it's not only the accented characters that has troubles, but the single quote as well. These are some titles the plugin was not able to play:

  • L’Huckleberry Jones
  • L’uomo invisibile

The following instead did not have problems even without the "decode":

  • Perdere la fiducia a Stamford
  • La vittima del Vermont e la truffa di Bakersfield

Actually, could it be just the single quote? I should find a title with an accented character but without the single quote and try what happens without the decode statement.

I can looking for this case and let you know.

@cpassuel
Copy link

cpassuel commented Aug 9, 2022

The solution from @stefano-salari worked for me too.

@Varstahl
Copy link
Collaborator

I tried to reproduce the issue every now and then, but I can't find any fault in the code or logic. I've tested playing videos with accented characters, single quotes, double quotes, just can't reproduce.

@Varstahl Varstahl added the need info Additional information required label Nov 28, 2022
@stefano-salari
Copy link
Author

Thanks @Varstahl, I'll try to revert my fix and reproduce the problem back, then I'll give you more info.
Anyway it doesn't seems to happen at a large scale since very few people are commenting here.

@cpassuel
Copy link

Thanks @Varstahl, I'll try to revert my fix and reproduce the problem back, then I'll give you more info. Anyway it doesn't seems to happen at a large scale since very few people are commenting here.

I think that not many people report it because it happens only for people using Amazon prime and/or kodi in another language than English which are a minority.

BTW you can try with James May our man in... season 2 ep 4. The title of this episode in French contains accented cars (Du très très bon fromage) that caused the error. I don't know if there was an update of the plugin lately because my playback.py file was reversed the old version without the @stefano-salari workaround.

@Varstahl
Copy link
Collaborator

I'm trying to think about it, but I can't imagine anything not working. Everything is utf-8 decoded by default. All of my tests on French, Italian, Spanish concluded the same. So I'm starting to wonder: do you have any other addons/themes that might interfere with regular function? If you have just plain Kodi with the Amazon VOD addon, does it work?

I've searched and tested far and wide, and I just can't repro. As for 2x4, the title's localized in italian so that wouldn't trigger.

@cpassuel
Copy link

cpassuel commented Dec 23, 2022

I'll check but as far as I remember, I didn't installed any theme. The only extension I use is the Youtube extension.

I use LibreElec 9.2.8 on a Raspberry PI 4.

Did you tried to locallse Amazon prime in French ?

@cpassuel
Copy link

cpassuel commented Apr 3, 2023

I'll check but as far as I remember, I didn't installed any theme. The only extension I use is the Youtube extension.

I use LibreElec 9.2.8 on a Raspberry PI 4.

Did you tried to locallse Amazon prime in French ?

I checked recently and I found some extensions that I think are not part of the original distribution

  • Raspberry PI Tools
  • System tools
  • Global Search

I think I installed the first two extensions in order to migrate LibreElec from sd card to nvme drive.

@cpassuel
Copy link

cpassuel commented Apr 3, 2023

I have the same issue using plugin.video.amazon-test-0.9.7~beta+leia.zip while trying to watch The Last Of Us EP 5. The title in French is La survie à tout prix.

I updated the line 451 of /storage/.kodi/addons/plugin.video.amazon-test/resources/lib/playback.py as explained by @stefano-salari and it fixed the issue

Sandmann79 added a commit that referenced this issue Apr 25, 2023
Fixes #675,#674,#665,#660,#659,#656,#649,#640,#639,#637,#632,#607,#602,#525,#516,#405,#391,#150

Signed-off-by: Sandmann79 <sandmann79@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information need info Additional information required
Projects
None yet
Development

No branches or pull requests

4 participants