xbmc icon indicating copy to clipboard operation
xbmc copied to clipboard

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

Open stefano-salari opened this issue 3 years ago • 3 comments

Addon used

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

Account type

  • [X] 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.

stefano-salari avatar Jul 31 '22 21:07 stefano-salari

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

Varstahl avatar Jul 31 '22 22:07 Varstahl

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.

stefano-salari avatar Aug 01 '22 07:08 stefano-salari

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

cpassuel avatar Aug 09 '22 19:08 cpassuel

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 avatar Nov 28 '22 10:11 Varstahl

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.

stefano-salari avatar Nov 28 '22 10:11 stefano-salari

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.

cpassuel avatar Dec 21 '22 20:12 cpassuel

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.

Varstahl avatar Dec 23 '22 14:12 Varstahl

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 avatar Dec 23 '22 21:12 cpassuel

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 avatar Apr 03 '23 19:04 cpassuel

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

cpassuel avatar Apr 03 '23 20:04 cpassuel