Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: TypeError: a bytes-like object is required, not 'str'

### INFO
**Python Version**: `3.7.5 (default, Oct 17 2019, 12:25:15) [GCC 8.3.0]`
**Operating System**: `Linux-4.9.0-11-amd64-x86_64-with`
**Locale**: `UTF-8`
**Branch**: [master](../tree/master)
**Database**: `44.14`
**Commit**: pymedusa/Medusa@918cfe7ce01808499585ffe6c1356fd5ed369f76
**Link to Log**: https://gist.github.com/8f765e724a442e6d91ed29584352638d
### ERROR
<pre>
2019-11-12 10:48:11 ERROR    TORNADO :: [918cfe7] API :: TypeError("a bytes-like object is required, not 'str'")
Traceback (most recent call last):
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/server/api/v1/core.py#L165">medusa/server/api/v1/core.py</a>", line 165, in get
    out_dict = _call_dispatcher(args, kwargs)
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/server/api/v1/core.py#L235">medusa/server/api/v1/core.py</a>", line 235, in call_dispatcher
    cur_out_dict = func(cur_args, cur_kwargs).run()  # call function and get response
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/server/api/v1/core.py#L1336">medusa/server/api/v1/core.py</a>", line 1336, in run
    proc_type=self.type
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/process_tv.py#L65">medusa/process_tv.py</a>", line 65, in run
    return ProcessResult(path, process_method).process(force=force, **kwargs)
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/process_tv.py#L188">medusa/process_tv.py</a>", line 188, in process
    ignore_subs=ignore_subs)
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/process_tv.py#L378">medusa/process_tv.py</a>", line 378, in process_files
    self.process_media(path, self.video_files, force, is_priority, ignore_subs)
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/process_tv.py#L599">medusa/process_tv.py</a>", line 599, in process_media
    self.result = processor.process()
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/post_processor.py#L1281">medusa/post_processor.py</a>", line 1281, in process
    notifiers.emby_notifier.update_library(ep_obj.series)
  File "/app/medusa/<a href="../blob/918cfe7ce01808499585ffe6c1356fd5ed369f76/medusa/notifiers/emby.py#L131">medusa/notifiers/emby.py</a>", line 131, in update_library
    log.debug('EMBY: HTTP response: {0}', resp.content.replace('\n', ''))
TypeError: a bytes-like object is required, not 'str'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators



Discussion:
@medariox resp.text ?
Yes
@jstorgaard Why are you using such an outdated version of Medusa?
> @jstorgaard Why are you using such an outdated version of Medusa?

Should be pretty recent? Using latest from linuxserver/medusa.
@jstorgaard While hovering over your commit in the OP it shows you're using release version 0.2.14 which has been released almost a year ago. 

The latest release when running from source is 0.3.6 as seen [here ](https://github.com/pymedusa/Medusa/releases)

And the latest docker image update (as you seem to be running?) seems to be the same, see [here](https://github.com/linuxserver/docker-medusa/releases)

I'm not saying this is the issue here btw, I'm just curious as I've seen this in a few other bug reports too. :)
@noodle- Yeah, I'm not sure what's going on with that.
Looking at the changelog it says that a new feature of 0.3.6 is Discord notification.
I got that in the version that submitted this bug report, so it should be 0.3.6.
@jstorgaard 
You get the notification no matter which version you are running. You should really look into updating your Medusa install, as we don't provide support for outdated versions.
> @jstorgaard
> You get the notification no matter which version you are running. 

It says on the release page that the Discord notification is a new feature of 0.3.6?

What docker container is up to date? I thought the one from linuxserver was?


Did you pull the latest image from linuxserver?
> Did you pull the latest image from linuxserver?

Yes
jstorgaard@docker:~/docker$ docker pull linuxserver/medusa:latest
latest: Pulling from linuxserver/medusa
Digest: sha256:60f721ee89d905f2420cd92fe0e5c90e56edc184ec1802b6cc83fab7748b34d8
Status: Image is up to date for linuxserver/medusa:latest
docker.io/linuxserver/medusa:latest
Oh, you are using the linuxserver image. In that case it can indeed happen that an old version is being erroneously shown. I'll see if I can get that fixed for the next release.

Resolving patch:
diff --git a/medusa/notifiers/emby.py b/medusa/notifiers/emby.py
--- a/medusa/notifiers/emby.py
+++ b/medusa/notifiers/emby.py
@@ -56,8 +56,8 @@ def _notify_emby(self, message, host=None, emby_apikey=None):
             )
             resp.raise_for_status()
 
-            if resp.content:
-                log.debug('EMBY: HTTP response: {0}', resp.content.replace('\n', ''))
+            if resp.text:
+                log.debug('EMBY: HTTP response: {0}', resp.text.replace('\n', ''))
 
             log.info('EMBY: Successfully sent a test notification.')
             return True
@@ -127,8 +127,8 @@ def update_library(self, show=None):
                 )
                 resp.raise_for_status()
 
-                if resp.content:
-                    log.debug('EMBY: HTTP response: {0}', resp.content.replace('\n', ''))
+                if resp.text:
+                    log.debug('EMBY: HTTP response: {0}', resp.text.replace('\n', ''))
 
                 log.info('EMBY: Successfully sent a "Series Library Updated" command.')
                 return True


Test patch: