1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Fix for pushover notifications.

This commit is contained in:
echel0n 2014-06-19 09:42:20 -07:00
parent 495a1a4fb3
commit 8dd4585145
2 changed files with 15 additions and 18 deletions

View File

@ -701,7 +701,7 @@
<div class="component-group clearfix">
<div class="component-group-desc">
<h3><a href="http://pushover.net/" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;"><img src="$sbRoot/images/notifiers/pushover.png" alt="" title="Pushover"/> Pushover </a></h3>
<h3><a href="https://pushover.net/apps/clone/sickrage" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;"><img src="$sbRoot/images/notifiers/pushover.png" alt="" title="Pushover"/> Pushover </a></h3>
<p>Pushover makes it easy to send real-time notifications to your Android and iOS devices.</p>
</div>
<fieldset class="component-group-list">

View File

@ -17,12 +17,11 @@
#
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
import httplib
import urllib, urllib2
import time
import sickbeard
from sickbeard import logger
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD
from sickbeard.exceptions import ex
@ -55,22 +54,20 @@ class PushoverNotifier:
# build up the URL and parameters
msg = msg.strip()
curUrl = API_URL
data = urllib.urlencode({
'token': apiKey,
'title': title,
'user': userKey,
'message': msg.encode('utf-8'),
'timestamp': int(time.time())
})
# send the request to pushover
try:
req = urllib2.Request(curUrl)
handle = urllib2.urlopen(req, data)
handle.close()
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": apiKey,
"user": userKey,
"title": title.encode('utf-8'),
"message": msg.encode('utf-8'),
'timestamp': int(time.time()),
"retry": 60,
"expire": 3600,
}), {"Content-type": "application/x-www-form-urlencoded"})
except urllib2.HTTPError, e:
# if we get an error back that doesn't have an error code then who knows what's really happening