mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-15 09:07:43 +00:00
Fix for pushover notifications.
This commit is contained in:
parent
495a1a4fb3
commit
8dd4585145
2 changed files with 15 additions and 18 deletions
|
@ -701,7 +701,7 @@
|
||||||
|
|
||||||
<div class="component-group clearfix">
|
<div class="component-group clearfix">
|
||||||
<div class="component-group-desc">
|
<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>
|
<p>Pushover makes it easy to send real-time notifications to your Android and iOS devices.</p>
|
||||||
</div>
|
</div>
|
||||||
<fieldset class="component-group-list">
|
<fieldset class="component-group-list">
|
||||||
|
|
|
@ -13,16 +13,15 @@
|
||||||
# SickRage is distributed in the hope that it will be useful,
|
# SickRage is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# 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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
import httplib
|
||||||
import urllib, urllib2
|
import urllib, urllib2
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD
|
from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTIFY_SUBTITLE_DOWNLOAD
|
||||||
from sickbeard.exceptions import ex
|
from sickbeard.exceptions import ex
|
||||||
|
@ -52,25 +51,23 @@ class PushoverNotifier:
|
||||||
apiKey = sickbeard.PUSHOVER_APIKEY
|
apiKey = sickbeard.PUSHOVER_APIKEY
|
||||||
|
|
||||||
logger.log("Pushover API KEY in use: " + apiKey, logger.DEBUG)
|
logger.log("Pushover API KEY in use: " + apiKey, logger.DEBUG)
|
||||||
|
|
||||||
# build up the URL and parameters
|
# build up the URL and parameters
|
||||||
msg = msg.strip()
|
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
|
# send the request to pushover
|
||||||
try:
|
try:
|
||||||
req = urllib2.Request(curUrl)
|
conn = httplib.HTTPSConnection("api.pushover.net:443")
|
||||||
handle = urllib2.urlopen(req, data)
|
conn.request("POST", "/1/messages.json",
|
||||||
handle.close()
|
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:
|
except urllib2.HTTPError, e:
|
||||||
# if we get an error back that doesn't have an error code then who knows what's really happening
|
# if we get an error back that doesn't have an error code then who knows what's really happening
|
||||||
|
|
Loading…
Reference in a new issue