pannal / Sub-Zero.bundle

Subtitles for Plex, as good you would expect them to be.
Other
1.75k stars 120 forks source link

Possible problem with accents in the path #88

Closed BrutuZ closed 8 years ago

BrutuZ commented 8 years ago

Hi there, nice plug-in. I might have found a bug on it though. I tend to keep a log reader program open to check how my subtitle agent is performing, and decided to add yours on it too. I then found several instances of the following error entries, which I believe are caused by an accented letter on the file path (G:\Séries)

2015-11-27 16:40:29,496 (c08) :  ERROR (logkit:22) - subliminal.providers.tvsubtitles: No show id found for u'Gravity Falls' ({u'year': None})
2015-11-27 16:40:30,634 (c08) :  CRITICAL (core:574) - Exception in the update function of agent named 'Sub-Zero Subtitles (TV, 1.3.20.403)', called with guid 'com.plexapp.agents.thetvdb://259972/2/19?lang=en' (most recent call last):
  File "bundles-release/Framework.bundle-dist-ninja/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1065, in _update
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 243, in update
    saveSubtitles(videos, subtitles)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 153, in saveSubtitles
    saveSubtitlesToFile(subtitles)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 184, in saveSubtitlesToFile
    subliminal.api.save_subtitles(video, video_subtitles, directory=fld)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Libraries\Shared\subliminal_patch\patch_api.py", line 53, in save_subtitles
    with io.open(subtitle_path, 'wb') as f:
IOError: [Errno 2] No such file or directory: 'G:\\S\xc3\xa9ries\\Gravity.Falls.S02E19.720p.HDTV.x264-W4F\\gravity.falls.s02e19.720p.hdtv.x264-w4f.en.srt'

Possibly useful info: I'm using the default setting to save local files instead of the metadata maze. Languages Selected: English and Brazillian Portuguese As mentioned, I do have other subtitle agent enabled (saving them as metadata though). Most of my files come along with a subtitle already (default H.I. english subtitles, mostly with exactly the same filename as the video, no language suffix. Sometimes they are muxed in the file instead). This one was an exception, video file alone, no muxed subtitles.

Regards.

pannal commented 8 years ago

Could you enable DEBUG logging and post the log again? This seems to be a Windows special case.

pannal commented 8 years ago

And could you please test the bleeding edge? https://github.com/pannal/Sub-Zero.bundle/archive/master.zip

BrutuZ commented 8 years ago

Just synced the repository with the GitHub client. Also enabled DEBUG loggin per request.

2015-11-28 02:29:05,118 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computing score for matches set([u'series', u'hearing_impaired']) and <Episode [u'Fashion', 0x9]>
2015-11-28 02:29:05,118 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_subtitle: Final matches: set([u'series', u'hearing_impaired'])
2015-11-28 02:29:05,118 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computed score 45
2015-11-28 02:29:05,119 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Starting score computation for <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-fashion-2008/KQIF' [en]>
2015-11-28 02:29:05,121 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computing score for matches set([u'series', u'hearing_impaired']) and <Episode [u'Fashion', 0x9]>
2015-11-28 02:29:05,121 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_subtitle: Final matches: set([u'series', u'hearing_impaired'])
2015-11-28 02:29:05,122 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computed score 45
2015-11-28 02:29:05,122 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Starting score computation for <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-sei-donne-per-l%27assassino-1964/33gB' [en]>
2015-11-28 02:29:05,125 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computing score for matches set([u'hearing_impaired']) and <Episode [u'Fashion', 0x9]>
2015-11-28 02:29:05,125 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_subtitle: Final matches: set([u'hearing_impaired'])
2015-11-28 02:29:05,127 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computed score 1
2015-11-28 02:29:05,128 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Starting score computation for <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-sei-donne-per-l%27assassino-1964/DTM' [en]>
2015-11-28 02:29:05,130 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computing score for matches set([u'hearing_impaired']) and <Episode [u'Fashion', 0x9]>
2015-11-28 02:29:05,131 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_subtitle: Final matches: set([u'hearing_impaired'])
2015-11-28 02:29:05,132 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computed score 1
2015-11-28 02:29:05,134 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_provider_pool: Downloading subtitle <OpenSubtitlesSubtitle 'http://www.opensubtitles.org/en/subtitles/5755927/sid-t7l9i3b09149k33v014ol9l796/qi-fashion-en' [en]> with score 89
2015-11-28 02:29:05,134 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_provider_pool: Downloading subtitle <OpenSubtitlesSubtitle 'http://www.opensubtitles.org/en/subtitles/5755927/sid-t7l9i3b09149k33v014ol9l796/qi-fashion-en' [en]>
2015-11-28 02:29:05,137 (35a0) :  INFO (logkit:16) - subliminal.providers.opensubtitles: Downloading subtitle <OpenSubtitlesSubtitle 'http://www.opensubtitles.org/en/subtitles/5755927/sid-t7l9i3b09149k33v014ol9l796/qi-fashion-en' [en]>
2015-11-28 02:29:06,253 (35a0) :  INFO (logkit:16) - subliminal.subtitle: Guessing encoding for language en
2015-11-28 02:29:06,253 (35a0) :  DEBUG (logkit:13) - subliminal.subtitle: Trying encodings [u'utf-8', u'latin-1']
2015-11-28 02:29:06,255 (35a0) :  INFO (logkit:16) - subliminal.subtitle: Guessed encoding latin-1
2015-11-28 02:29:06,256 (35a0) :  INFO (logkit:16) - subliminal.subtitle: Guessing encoding for language en
2015-11-28 02:29:06,256 (35a0) :  DEBUG (logkit:13) - subliminal.subtitle: Trying encodings [u'utf-8', u'latin-1']
2015-11-28 02:29:06,257 (35a0) :  INFO (logkit:16) - subliminal.subtitle: Guessed encoding latin-1
2015-11-28 02:29:06,322 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Skipping subtitle: <Language [en]> already downloaded
2015-11-28 02:29:06,322 (35a0) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Skipping subtitle: <Language [en]> already downloaded
2015-11-28 02:29:06,325 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_provider_pool: Score 56 is below min_score (85)
2015-11-28 02:29:06,325 (35a0) :  INFO (logkit:16) - subliminal.api: Downloaded 1 subtitle(s)
2015-11-28 02:29:06,326 (35a0) :  DEBUG (logkit:13) - subliminal.api: Terminating initialized providers
2015-11-28 02:29:06,326 (35a0) :  INFO (logkit:16) - subliminal.api: Terminating provider opensubtitles
2015-11-28 02:29:06,326 (35a0) :  INFO (logkit:16) - subliminal.providers.opensubtitles: Logging out
2015-11-28 02:29:06,773 (35a0) :  DEBUG (logkit:13) - subliminal.providers.opensubtitles: Logged out
2015-11-28 02:29:06,773 (35a0) :  INFO (logkit:16) - subliminal.api: Terminating provider podnapisi
2015-11-28 02:29:06,775 (35a0) :  INFO (logkit:16) - subliminal.api: Terminating provider tvsubtitles
2015-11-28 02:29:06,776 (35a0) :  DEBUG (logkit:13) - Using filesystem as subtitle storage
2015-11-28 02:29:06,779 (35a0) :  INFO (logkit:16) - subliminal_patch.patch_api: Saving <OpenSubtitlesSubtitle 'http://www.opensubtitles.org/en/subtitles/5755927/sid-t7l9i3b09149k33v014ol9l796/qi-fashion-en' [en]> to 'G:\\S\xc3\xa9ries\\Gravity Falls\\Season 00\\S00E09 - Fashion.en.srt'
2015-11-28 02:29:06,780 (35a0) :  DEBUG (logkit:13) - Scheduler: Not sending signal updated_metadata to task searchAllRecentlyAddedMissing, because: not running
2015-11-28 02:29:06,785 (35a0) :  CRITICAL (core:574) - Exception in the update function of agent named 'Sub-Zero Subtitles (TV, 1.3.20.403)', called with guid 'com.plexapp.agents.thetvdb://259972/0/9?lang=en' (most recent call last):
  File "bundles-release/Framework.bundle-dist-ninja/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1065, in _update
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 243, in update
    saveSubtitles(videos, subtitles)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 153, in saveSubtitles
    saveSubtitlesToFile(subtitles)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 184, in saveSubtitlesToFile
    subliminal.api.save_subtitles(video, video_subtitles, directory=fld)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Libraries\Shared\subliminal_patch\patch_api.py", line 53, in save_subtitles
IOError: [Errno 2] No such file or directory: 'G:\\S\xc3\xa9ries\\Gravity Falls\\Season 00\\S00E09 - Fashion.en.srt'
pannal commented 8 years ago

Nope, the log you just posted doesn't use the current master. Did you restart the PMS after updating?

BrutuZ commented 8 years ago

Apologies, I wasn't thinking straight at 2:30 AM and forgot to restart PMS. Luckily Windows set me straight by crashing after over 50 days of uptime forcing a complete restart. Log of the current version follows:

2015-11-28 19:53:24,732 (1544) :  DEBUG (core:539) - Server version is 0.9.14.1.1544-651f92a
(...)
2015-11-28 19:53:29,709 (2640) :  DEBUG (logkit:13) - Sub-Zero 1.3.20.403
(...)
2015-11-28 20:14:43,585 (232c) :  DEBUG (logkit:13) - Using filesystem as subtitle storage
2015-11-28 20:14:43,586 (232c) :  INFO (logkit:16) - subliminal_patch.patch_api: Saving <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-gravity-falls-2012-S02E19/iqA-' [en]> to 'G:\\S\xc3\xa9ries\\Gravity Falls\\Gravity.Falls.S02E19.720p.HDTV.x264-W4F[eztv].en.srt'
2015-11-28 20:14:43,588 (232c) :  DEBUG (logkit:13) - Scheduler: Not sending signal updated_metadata to task searchAllRecentlyAddedMissing, because: not running
2015-11-28 20:14:43,591 (232c) :  CRITICAL (core:574) - Exception in the update function of agent named 'Sub-Zero Subtitles (TV, 1.3.20.403)', called with guid 'com.plexapp.agents.thetvdb://259972/2/19?lang=en' (most recent call last):
  File "bundles-release/Framework.bundle-dist-ninja/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1065, in _update
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 243, in update
    saveSubtitles(videos, subtitles)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 153, in saveSubtitles
    saveSubtitlesToFile(subtitles)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Code\__init__.py", line 184, in saveSubtitlesToFile
    subliminal.api.save_subtitles(video, video_subtitles, directory=fld)
  File "G:\Plex\Data\Plex Media Server\Plug-ins\Sub-Zero.bundle\Contents\Libraries\Shared\subliminal_patch\patch_api.py", line 60, in save_subtitles
    with io.open(subtitle_path, 'wb') as f:
IOError: [Errno 2] No such file or directory: 'G:\\S\xc3\xa9ries\\Gravity Falls\\Gravity.Falls.S02E19.720p.HDTV.x264-W4F[eztv].en.srt'

2015-11-28 20:14:43,592 (232c) :  DEBUG (model:229) - Serializing to G:\Plex\Data\Plex Media Server\Metadata\TV Shows\8\f7ac708bd8c9a53c655b06aa1ab9b246425a808.bundle\Contents\com.plexapp.agents.subzero\Info.xml
2015-11-28 20:14:43,596 (232c) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes
2015-11-28 20:14:48,605 (2ca0) :  INFO (datakit:131) - Saved the dictionary file
pannal commented 8 years ago

Could you please try this test branch: https://github.com/pannal/Sub-Zero.bundle/archive/unicode_test.zip?

BrutuZ commented 8 years ago

Seems to have worked, will test further tomorrow with different files

2015-11-29 02:36:33,674 (11a0) :  DEBUG (core:539) - Server version is 0.9.14.1.1544-651f92a
(...)
2015-11-29 02:36:38,357 (2234) :  DEBUG (logkit:13) - Sub-Zero 1.3.20.403
(...)
2015-11-29 02:40:20,653 (2714) :  INFO (logkit:16) - subliminal_patch.patch_subtitle: Computed score 118
2015-11-29 02:40:20,653 (2714) :  INFO (logkit:16) - subliminal_patch.patch_provider_pool: Downloading subtitle <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-gravity-falls-2012-S02E19/iqA-' [en]> with score 121
2015-11-29 02:40:20,654 (2714) :  INFO (logkit:16) - subliminal_patch.patch_provider_pool: Downloading subtitle <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-gravity-falls-2012-S02E19/iqA-' [en]>
2015-11-29 02:40:20,655 (2714) :  INFO (logkit:16) - subliminal_patch.patch_providers.podnapisi: Downloading subtitle <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-gravity-falls-2012-S02E19/iqA-' [en]>
2015-11-29 02:40:21,122 (2714) :  INFO (logkit:16) - subliminal.subtitle: Guessing encoding for language en
2015-11-29 02:40:21,124 (2714) :  DEBUG (logkit:13) - subliminal.subtitle: Trying encodings [u'utf-8', u'latin-1']
2015-11-29 02:40:21,125 (2714) :  INFO (logkit:16) - subliminal.subtitle: Guessed encoding utf-8
2015-11-29 02:40:21,125 (2714) :  INFO (logkit:16) - subliminal.subtitle: Guessing encoding for language en
2015-11-29 02:40:21,127 (2714) :  DEBUG (logkit:13) - subliminal.subtitle: Trying encodings [u'utf-8', u'latin-1']
2015-11-29 02:40:21,128 (2714) :  INFO (logkit:16) - subliminal.subtitle: Guessed encoding utf-8
2015-11-29 02:40:21,161 (2714) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Skipping subtitle: <Language [en]> already downloaded
2015-11-29 02:40:21,163 (2714) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Skipping subtitle: <Language [en]> already downloaded
2015-11-29 02:40:21,164 (2714) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Skipping subtitle: <Language [en]> already downloaded
2015-11-29 02:40:21,164 (2714) :  DEBUG (logkit:13) - subliminal_patch.patch_provider_pool: Skipping subtitle: <Language [en]> already downloaded
2015-11-29 02:40:21,165 (2714) :  INFO (logkit:16) - subliminal.api: Downloaded 1 subtitle(s)
2015-11-29 02:40:21,165 (2714) :  DEBUG (logkit:13) - subliminal.api: Terminating initialized providers
2015-11-29 02:40:21,167 (2714) :  INFO (logkit:16) - subliminal.api: Terminating provider opensubtitles
2015-11-29 02:40:21,168 (2714) :  INFO (logkit:16) - subliminal.providers.opensubtitles: Logging out
2015-11-29 02:40:22,278 (2714) :  DEBUG (logkit:13) - subliminal.providers.opensubtitles: Logged out
2015-11-29 02:40:22,279 (2714) :  INFO (logkit:16) - subliminal.api: Terminating provider podnapisi
2015-11-29 02:40:22,280 (2714) :  INFO (logkit:16) - subliminal.api: Terminating provider tvsubtitles
2015-11-29 02:40:22,282 (2714) :  DEBUG (logkit:13) - Using filesystem as subtitle storage
2015-11-29 02:40:22,289 (2714) :  INFO (logkit:16) - subliminal_patch.patch_api: Saving <PodnapisiSubtitle 'http://www.podnapisi.net/subtitles/en-gravity-falls-2012-S02E19/iqA-' [en]> to u'G:\\S\xe9ries\\Gravity Falls\\Gravity.Falls.S02E19.720p.HDTV.x264-W4F[eztv].en.srt'
2015-11-29 02:40:22,319 (2714) :  INFO (datakit:131) - Saved the dictionary file
2015-11-29 02:40:22,403 (2714) :  INFO (logkit:16) - Looking for subtitle media in 1 paths with 1 media files.
2015-11-29 02:40:22,404 (2714) :  INFO (logkit:16) - Paths: G:\Séries\Gravity Falls
2015-11-29 02:40:22,407 (2714) :  INFO (logkit:16) - Found subtitle file: G:\Séries\Gravity Falls\Gravity.Falls.S02E19.720p.HDTV.x264-W4F[eztv].en.srt language: en codec: srt format: srt
2015-11-29 02:40:22,421 (2714) :  DEBUG (logkit:13) - Scheduler: Not sending signal updated_metadata to task searchAllRecentlyAddedMissing, because: not running
2015-11-29 02:40:22,424 (2714) :  DEBUG (model:229) - Serializing to G:\Plex\Data\Plex Media Server\Metadata\TV Shows\8\f7ac708bd8c9a53c655b06aa1ab9b246425a808.bundle\Contents\com.plexapp.agents.subzero\Info.xml
2015-11-29 02:40:22,431 (2714) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes
2015-11-29 02:40:27,440 (2888) :  INFO (datakit:131) - Saved the dictionary file
pannal commented 8 years ago

Nice :)