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

KeyError: 'xx' #32

Open
bakua opened this issue Jun 30, 2017 · 9 comments
Open

KeyError: 'xx' #32

bakua opened this issue Jun 30, 2017 · 9 comments
Labels

Comments

@bakua
Copy link

bakua commented Jun 30, 2017

Hello,

I have PMS running on Ubuntu. Unfortunately, your plug-in doesn't work for me. Could I have an assistance please? Here is the stacktrace. The log file is attached to same issue on Plex Forum https://forums.plex.tv/discussion/comment/1469993/#Comment_1469993

CRITICAL (agentkit:1078) - Exception in the update function of agent named 'Srt2Utf-8 (Movies)', called with guid 'com.plexapp.agents.imdb://tt2024544?lang=en' (most recent call last):
#126	File "/usr/lib/plexmediaserver/Resources/Plug-ins-313f93718/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1076, in _update
#127	agent.update(obj, media, lang, **kwargs)
#128	File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SRT2UTF-8.bundle/Contents/Code/__init__.py", line 53, in update
#129	GetFiles(part)
#130	File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SRT2UTF-8.bundle/Contents/Code/__init__.py", line 153, in GetFiles
#131	FixFile(sTest, sMyLang)
#132	File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SRT2UTF-8.bundle/Contents/Code/__init__.py", line 112, in FixFile
#133	sMyEnc = FindEncBS(sFile, sMyLang)
#134	File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SRT2UTF-8.bundle/Contents/Code/__init__.py", line 191, in FindEncBS
#135	if sCurrentEnc == CP_Windows_ISO.cpWindows[lang]:
#136	File "/usr/lib/plexmediaserver/Resources/Plug-ins-313f93718/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 108, in
#137	_getitem_ = lambda x, y: x.__getitem__(y),
#138	KeyError: 'xx'

Thank you :)

@ukdtom
Copy link
Owner

ukdtom commented Jun 30, 2017

Answered in Plex forum thread, and awaits feedback from OP

@ukdtom ukdtom added the bug label Jun 30, 2017
@bakua
Copy link
Author

bakua commented Jun 30, 2017

@bakua
Copy link
Author

bakua commented Jul 1, 2017

2017-06-30 22:31:25,731 (7fac6effd700) : DEBUG (__init__:162) - Converting file: /mnt/virtual/DOWNLOAD/filmy/12 Years a Slave (2013)/12 Years a Slave (2013).en.srt with the encoding of cp1252 into utf-8
#72 2017-06-30 22:31:25,731 (7fac6effd700) : CRITICAL (__init__:124) - Something went wrong converting!!! Check file permissions? (most recent call last):
#73 File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SRT2UTF-8.bundle/Contents/Code/__init__.py", line 122, in FixFile
#74 ConvertFile(sFile, sMyEnc)
#75 File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SRT2UTF-8.bundle/Contents/Code/__init__.py", line 164, in ConvertFile
#76 targetFile.write(sourceFile.read())
#77 File "/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/encodings/cp1252.py", line 23, in decode
#78 return codecs.charmap_decode(input,self.errors,decoding_table)[0]
#79 UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 324: character maps to
#80 
#81 2017-06-30 22:31:25,731 (7fac6effd700) : CRITICAL (__init__:326) - **** Reverting from backup, something went wrong here ****
#82 2017-06-30 22:31:25,737 (7fac6effd700) : DEBUG (__init__:337) - Reverting from backup of /mnt/virtual/DOWNLOAD/filmy/12 Years a Slave (2013)/12 Years a Slave (2013).en.srt.Srt2Utf-8

Subtitles it is happening for:
12 Years a Slave (2013).en.txt
I had to rename srt to txt to be able to upload it.

@bakua
Copy link
Author

bakua commented Jul 1, 2017

I did a 5 minute digging through the code and that made me realize where we went wrong. My srt file is Czech language one in ISO 8859-2 encoding. Setting the filename to .en.srt for test purposes was incorrect as ISO 8859-2 is unsupported by en locale. I changed the filename to .cs.srt and the above crash does not occur anymore.

However, I would still like to get the bug, that only shows, when running subs without a language identifier, fixed, as none of my subtitle files have the language identifier in it :)

Thank you,
bakua

@ukdtom
Copy link
Owner

ukdtom commented Jul 4, 2017

Care to try the Tommy-Work branch, found here, and then report back:
https://github.com/ukdtom/SRT2UTF-8.bundle/archive/tommy-work.zip

@bakua
Copy link
Author

bakua commented Jul 17, 2017

Still doesn't work for me:

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SRT2UTF-8.bundle$ git status
On branch tommy-work
Your branch is up-to-date with 'origin/tommy-work'.
nothing to commit, working directory clean

log.zip

@ukdtom ukdtom closed this as completed in 2bdda44 Aug 18, 2017
@ukdtom ukdtom reopened this Aug 18, 2017
@ukdtom
Copy link
Owner

ukdtom commented Aug 18, 2017

Sorry, closed by a mistake here....

This one is sadly still an issue

@peritissima
Copy link

I have same problem, any suggestion please please please,
logs.zip

@ukdtom
Copy link
Owner

ukdtom commented Nov 9, 2018

@peritissima Check forum thread for a start

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

No branches or pull requests

3 participants