mjvotaw / plex-sub-downloader

An attempt to build a simple command-line tool for automating the adding of subtitles to Plex content.
MIT License
13 stars 3 forks source link

Plex not sending data #5

Closed durd closed 1 year ago

durd commented 1 year ago

Not sure if I should be sending this to Plex instead, but I'm trying to cover my bases.

I'm sure I've set everything up as I should. Manually checking a specific video works. However, I'm not getting multiple "POST" log messages as some others have, actually no messages at all. PSD is adding it's own webhook to Plex and is running. If I POST the example payload from Plex's webpage I get a TypeError, but I figure that is because the payload is malformed or something. I can at least send something and PSD reacts.

Is there a log somewhere in Plex where I would see if Plex is trying something? I tried debug and console, but got nothing useful from them (why even have two places for a log...)

Running plexmediaserver of version 1.32.2.7100-248a2daf0 and latest PSD from pip3, they're both running on the same machine with Debian.

durd commented 1 year ago

Wow, Plex does not send webhooks unless Push Notifications is enabled also under Settings > General. Even then, the first time I enabled it it took half hour to actually send a webhook.

I did get an error once that wasn't Plexs fault:

ERROR:plex_sub_downloader.plex_sub_downloader:Exception on /webhook [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/lib/python3.9/dist-packages/plex_sub_downloader/plex_sub_downloader.py", line 28, in respond
    psd.handleWebhookEvent(event)
  File "/usr/local/lib/python3.9/dist-packages/plex_sub_downloader/PlexSubDownloader.py", line 53, in handleWebhookEvent
    self.handleLibraryNewEvent(event)
  File "/usr/local/lib/python3.9/dist-packages/plex_sub_downloader/PlexSubDownloader.py", line 68, in handleLibraryNewEvent
    self.handleDownloadingVideoSubtitles(video)
  File "/usr/local/lib/python3.9/dist-packages/plex_sub_downloader/PlexSubDownloader.py", line 85, in handleDownloadingVideoSubtitles
    subtitles = self.downloadSubtitlesForVideos(missingVideos)
  File "/usr/local/lib/python3.9/dist-packages/plex_sub_downloader/PlexSubDownloader.py", line 186, in downloadSubtitlesForVideos
    subtitles = self.sub.search_videos(videos)
  File "/usr/local/lib/python3.9/dist-packages/plex_sub_downloader/subliminalHelper.py", line 52, in search_videos
    subtitles = subliminal.download_best_subtitles(subVideos, languages=self.languages, providers=self.providers, provider_configs=self.provider_configs)
  File "/usr/local/lib/python3.9/dist-packages/subliminal/core.py", line 651, in download_best_subtitles
    subtitles = pool.download_best_subtitles(pool.list_subtitles(video, languages - video.subtitle_languages),
  File "/usr/local/lib/python3.9/dist-packages/subliminal/core.py", line 139, in list_subtitles
    provider_subtitles = self.list_subtitles_provider(name, video, languages)
  File "/usr/local/lib/python3.9/dist-packages/subliminal/core.py", line 102, in list_subtitles_provider
    if not provider_manager[provider].plugin.check(video):
  File "/usr/local/lib/python3.9/dist-packages/stevedore/extension.py", line 340, in __getitem__
    return self._extensions_by_name[name]
KeyError: 'addic7ed'

And my config.json was:

{
    "plex_base_url": "http://ftp.int.durd.net:32400",
    "plex_auth_token": "<token>",
    "languages": [
        "eng",
        "swe"
    ],
    "webhook_host": "0.0.0.0",
    "webhook_port": 5000,
    "subtitle_destination": "with_media",
    "subtitle_providers": [
        "opensubtitles",
        "tvsubtitles",
        "addic7ed"
    ],
    "subtitle_provider_configs": {
        "opensubtitles": {
            "username": "<user>",
            "password": "<pass>"
        }
    }
}

Once I removed addic7ed it worked again.

ghost commented 1 year ago

Hm thanks for the note about needing to have push notifications enabled, I'll add that to the readme.

And as for why addic7ed isn't working, it looks like it's partially an issue within Subliminal. According to this issue, addic7ed added a captcha to prevent things like Subliminal from searching. But the specific reason why we're getting that KeyError: 'addic7ed' is because there's a typo in the subliminal/providers/addic7ed.py file.

For the life of me, I don't know why they don't just completely remove addic7ed as a provider 🤷