Repository: pymedusa/Medusa

Issue:
Free Mobile SMS notification failed
Hi, 
I recently update Medusa, and since then, I didn't receive any SMS for started/finished downloads

On the error log file I have this:
```
2019-06-22 15:42:51 ERROR    Thread_2 :: [74c3f12] Exception generated: can't concat str to bytes
Traceback (most recent call last):
  File "C:\Medusa\Medusa\medusa\server\web\core\base.py", line 261, in async_call
    result = function(**kwargs)
  File "C:\Medusa\Medusa\medusa\server\web\home\handler.py", line 300, in testFreeMobile
    result, message = notifiers.freemobile_notifier.test_notify(freemobile_id, freemobile_apikey)
  File "C:\Medusa\Medusa\medusa\notifiers\freemobile.py", line 30, in test_notify
    return self._notifyFreeMobile('Test', 'This is a test notification from Medusa', cust_id, apiKey, force=True)
  File "C:\Medusa\Medusa\medusa\notifiers\freemobile.py", line 120, in _notifyFreeMobile
    return self._sendFreeMobileSMS(title, message, cust_id, apiKey)
  File "C:\Medusa\Medusa\medusa\notifiers\freemobile.py", line 51, in _sendFreeMobileSMS
    msg_quoted = quote(title.encode('utf-8') + ': ' + msg.encode('utf-8'))
TypeError: can't concat str to bytes
```
My Free Mobile customer ID and my Free Mobile API Key are still the same..

Thanks in advance for any help you may provide.
Regards.


Discussion:
Please fill out the issue report template.
Ok, here's the template

**Describe the bug**
I recently update Medusa, and since then, I didn't receive any SMS for started/finished downloads

**To Reproduce**
Steps to reproduce the behavior:
1. Snatch or post-process something that initiate a SMS notification
2. Go on "view errors"
3. See error

**Expected behavior**
I expect a SMS

**Medusa (please complete the following information):**
 - OS: Win 7
 - Branch: master
 - Commit: 74c3f124fb599ad923e23f46fc320778b8b4217c
 - Python version: 3.7.3
- Database version: 44.14

**Debug logs (at least 50 lines):**
General > Advanced Settings > Enable debug
<details>

```
2019-06-22 15:42:51 ERROR Thread_2 :: [74c3f12] Exception generated: can't concat str to bytes
Traceback (most recent call last):
File "C:\Medusa\Medusa\medusa\server\web\core\base.py", line 261, in async_call
result = function(**kwargs)
File "C:\Medusa\Medusa\medusa\server\web\home\handler.py", line 300, in testFreeMobile
result, message = notifiers.freemobile_notifier.test_notify(freemobile_id, freemobile_apikey)
File "C:\Medusa\Medusa\medusa\notifiers\freemobile.py", line 30, in test_notify
return self._notifyFreeMobile('Test', 'This is a test notification from Medusa', cust_id, apiKey, force=True)
File "C:\Medusa\Medusa\medusa\notifiers\freemobile.py", line 120, in _notifyFreeMobile
return self._sendFreeMobileSMS(title, message, cust_id, apiKey)
File "C:\Medusa\Medusa\medusa\notifiers\freemobile.py", line 51, in _sendFreeMobileSMS
msg_quoted = quote(title.encode('utf-8') + ': ' + msg.encode('utf-8'))
TypeError: can't concat str to bytes
```
</details>

Thanks

Resolving patch:
diff --git a/medusa/notifiers/freemobile.py b/medusa/notifiers/freemobile.py
--- a/medusa/notifiers/freemobile.py
+++ b/medusa/notifiers/freemobile.py
@@ -3,7 +3,6 @@
 from __future__ import unicode_literals
 
 import logging
-from builtins import object
 
 from medusa import app
 from medusa.common import (
@@ -47,9 +46,13 @@ def _sendFreeMobileSMS(self, title, msg, cust_id=None, apiKey=None):
         log.debug(u'Free Mobile in use with API KEY: {0}', apiKey)
 
         # build up the URL and parameters
-        msg = msg.strip()
-        msg_quoted = quote(title.encode('utf-8') + ': ' + msg.encode('utf-8'))
-        URL = 'https://smsapi.free-mobile.fr/sendmsg?user=' + cust_id + '&pass=' + apiKey + '&msg=' + msg_quoted
+        msg = '{0}: {1}'.format(title, msg.strip())
+        msg_quoted = quote(msg.encode('utf-8'))
+        URL = 'https://smsapi.free-mobile.fr/sendmsg?user={user}&pass={api_key}&msg={msg}'.format(
+            user=cust_id,
+            api_key=apiKey,
+            msg=msg_quoted,
+        )
 
         req = Request(URL)
         # send the request to Free Mobile


Test patch: