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

Saving as metadata fails #10

Open
mpolden opened this issue Sep 16, 2014 · 3 comments
Open

Saving as metadata fails #10

mpolden opened this issue Sep 16, 2014 · 3 comments
Labels

Comments

@mpolden
Copy link

mpolden commented Sep 16, 2014

Saving subtitles as metadata sometimes fails with the following error:

2014-09-16 11:23:09,872 (7fe93bfff700) :  DEBUG (__init__:90) - Saving subtitles as metadata
2014-09-16 11:23:09,874 (7fe93bfff700) :  CRITICAL (agentkit:983) - Exception in the update function of agent named 'Subliminal TV Subtitles', called with guid 'com.plexapp.agents.thetvdb://280494/1/1?lang=en' (most recent call last):
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 981, in _update
    agent.update(obj, media, lang)
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Subliminal.bundle/Contents/Code/__init__.py", line 151, in update
    saveSubtitles(videos, subtitles)
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Subliminal.bundle/Contents/Code/__init__.py", line 91, in saveSubtitles
    saveSubtitlesToMetadata(videos, subtitles)
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Subliminal.bundle/Contents/Code/__init__.py", line 118, in saveSubtitlesToMetadata
    mediaPart.subtitles[Locale.Language.Match(subtitle.language.alpha2)][subtitle.page_link] = Proxy.Media(subtitle.content, ext="srt")
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 237, in __setitem__
    self._proxies[item] = make_tuple(item, value)
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 220, in make_tuple
    name_hash = self._core.data.hashing.sha1(item)
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/data.py", line 32, in sha1
    return self._generateHash(data, hashlib.sha1(), digest)
  File "/mnt/raid/plex/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/data.py", line 22, in _generateHash
    obj.update(data)
TypeError: must be string or buffer, not None

2014-09-16 11:23:09,879 (7fe93bfff700) :  DEBUG (model:225) - Serializing to /mnt/raid/plex/Plex Media Server/Metadata/TV Shows/4/58dd2b277c5e01eb6e95a2ae4d254b47b6703c0.bundle/Contents/com.plexapp.agents.subliminal/Info.xml
2014-09-16 11:23:09,881 (7fe93bfff700) :  DEBUG (runtime:918) - Response: [200] str, 16 bytes

Storing subtitles next to media files always works.

@mpolden
Copy link
Author

mpolden commented Sep 16, 2014

I think this issue occurs when subtitle.page_link is None here:

mediaPart.subtitles[Locale.Language.Match(subtitle.language.alpha2)][subtitle.page_link] = Proxy.Media(subtitle.content, ext="srt")

@mpolden
Copy link
Author

mpolden commented Sep 16, 2014

Looking at the API for Subliminal, it looks like page_link will either be a string or None: http://subliminal.readthedocs.org/en/latest/api/subtitle.html#subliminal.subtitle.Subtitle

So I guess None needs to be handled in some way.

@tomsommer
Copy link

Can be fixed by disabling TheSubDB, but please fix it.

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