1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05: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

@ -13,16 +13,15 @@
# SickRage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
# 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
@ -52,25 +51,23 @@ class PushoverNotifier:
apiKey = sickbeard.PUSHOVER_APIKEY
logger.log("Pushover API KEY in use: " + apiKey, logger.DEBUG)
# 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