2013-02-18 17:40:32 +00:00
|
|
|
# This file is part of mylar.
|
|
|
|
#
|
|
|
|
# mylar is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# mylar 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.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with mylar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
from mylar import logger
|
|
|
|
import base64
|
|
|
|
import cherrypy
|
|
|
|
import urllib
|
|
|
|
import urllib2
|
|
|
|
import mylar
|
|
|
|
from httplib import HTTPSConnection
|
|
|
|
from urllib import urlencode
|
|
|
|
import os.path
|
|
|
|
import subprocess
|
2013-09-07 06:05:32 +00:00
|
|
|
import time
|
2016-09-07 04:04:42 +00:00
|
|
|
import simplejson
|
2015-01-31 22:21:42 +00:00
|
|
|
import json
|
2016-09-07 04:04:42 +00:00
|
|
|
import requests
|
2013-02-18 17:40:32 +00:00
|
|
|
|
|
|
|
# This was obviously all taken from headphones with great appreciation :)
|
|
|
|
|
|
|
|
class PROWL:
|
|
|
|
|
|
|
|
keys = []
|
|
|
|
priority = []
|
|
|
|
|
|
|
|
def __init__(self):
|
2017-10-25 18:33:56 +00:00
|
|
|
self.enabled = mylar.CONFIG.PROWL_ENABLED
|
|
|
|
self.keys = mylar.CONFIG.PROWL_KEYS
|
|
|
|
self.priority = mylar.CONFIG.PROWL_PRIORITY
|
2013-02-18 17:40:32 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
def conf(self, options):
|
|
|
|
return cherrypy.config['config'].get('Prowl', options)
|
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
def notify(self, message, event, module=None):
|
2017-10-25 18:33:56 +00:00
|
|
|
if not mylar.CONFIG.PROWL_ENABLED:
|
2013-02-18 17:40:32 +00:00
|
|
|
return
|
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
if module is None:
|
|
|
|
module = ''
|
|
|
|
module += '[NOTIFIER]'
|
|
|
|
|
2013-02-18 17:40:32 +00:00
|
|
|
http_handler = HTTPSConnection("api.prowlapp.com")
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2017-10-25 18:33:56 +00:00
|
|
|
data = {'apikey': mylar.CONFIG.PROWL_KEYS,
|
2013-02-18 17:40:32 +00:00
|
|
|
'application': 'Mylar',
|
|
|
|
'event': event,
|
|
|
|
'description': message.encode("utf-8"),
|
2017-10-25 18:33:56 +00:00
|
|
|
'priority': mylar.CONFIG.PROWL_PRIORITY}
|
2013-02-18 17:40:32 +00:00
|
|
|
|
|
|
|
http_handler.request("POST",
|
|
|
|
"/publicapi/add",
|
|
|
|
headers = {'Content-type': "application/x-www-form-urlencoded"},
|
|
|
|
body = urlencode(data))
|
|
|
|
response = http_handler.getresponse()
|
|
|
|
request_status = response.status
|
|
|
|
|
|
|
|
if request_status == 200:
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.info(module + ' Prowl notifications sent.')
|
2013-02-18 17:40:32 +00:00
|
|
|
return True
|
2015-05-22 08:32:51 +00:00
|
|
|
elif request_status == 401:
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.info(module + ' Prowl auth failed: %s' % response.reason)
|
2013-02-18 17:40:32 +00:00
|
|
|
return False
|
|
|
|
else:
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.info(module + ' Prowl notification failed.')
|
2013-02-18 17:40:32 +00:00
|
|
|
return False
|
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
def test_notify(self):
|
2013-02-18 17:40:32 +00:00
|
|
|
self.notify('ZOMG Lazors Pewpewpew!', 'Test Message')
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2013-02-18 17:40:32 +00:00
|
|
|
class NMA:
|
|
|
|
|
2017-05-12 18:24:35 +00:00
|
|
|
def __init__(self, test_apikey=None):
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2015-08-11 21:56:22 +00:00
|
|
|
self.NMA_URL = "https://www.notifymyandroid.com/publicapi/notify"
|
2017-05-12 18:24:35 +00:00
|
|
|
self.TEST_NMA_URL = "https://www.notifymyandroid.com/publicapi/verify"
|
|
|
|
if test_apikey is None:
|
2017-10-25 18:33:56 +00:00
|
|
|
self.apikey = mylar.CONFIG.NMA_APIKEY
|
FIX:(#1630) One-off issues will now be post-processed according to grab-bag dir location, IMP: One-off pull-list issues will now have the status marked accordingly on weekly pullist for tracking purposes, FIX: Fix for utorrent not being able to update status properly after initial snatch, FIX: Fix for some incorrect variable references due to different snatch methods when trying to run on-snatch scripts, FIX: Fix for auto-torrent-snatcher trying to snatch a torrent with an '&' in the filename, FIX:(#1637) Fix for telegram not saving on snatch toggle properly, IMP: added additional logging for metatagging when attempting to create temp folder in cache location, IMP: will now clean up any left over metagtagging directories that fail during normal post-processing instead of leaving and continuing, FIX: Will notify on one-off grab's/storyarc's being post-processed, FIX: fix for displaying cbz issue details (the 'i' on the comic details page) in which the series title contained non-alphanumeric characters, IMP: Added ability to change status to Wanted on Upcoming tab (will perform an immediate search on selected issues), IMP: Threaded the one-off search call from the weeklypull
2017-06-02 14:05:06 +00:00
|
|
|
self.test = False
|
2017-05-12 18:24:35 +00:00
|
|
|
else:
|
|
|
|
self.apikey = test_apikey
|
FIX:(#1630) One-off issues will now be post-processed according to grab-bag dir location, IMP: One-off pull-list issues will now have the status marked accordingly on weekly pullist for tracking purposes, FIX: Fix for utorrent not being able to update status properly after initial snatch, FIX: Fix for some incorrect variable references due to different snatch methods when trying to run on-snatch scripts, FIX: Fix for auto-torrent-snatcher trying to snatch a torrent with an '&' in the filename, FIX:(#1637) Fix for telegram not saving on snatch toggle properly, IMP: added additional logging for metatagging when attempting to create temp folder in cache location, IMP: will now clean up any left over metagtagging directories that fail during normal post-processing instead of leaving and continuing, FIX: Will notify on one-off grab's/storyarc's being post-processed, FIX: fix for displaying cbz issue details (the 'i' on the comic details page) in which the series title contained non-alphanumeric characters, IMP: Added ability to change status to Wanted on Upcoming tab (will perform an immediate search on selected issues), IMP: Threaded the one-off search call from the weeklypull
2017-06-02 14:05:06 +00:00
|
|
|
self.test = True
|
2017-10-25 18:33:56 +00:00
|
|
|
self.priority = mylar.CONFIG.NMA_PRIORITY
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2015-08-11 21:56:22 +00:00
|
|
|
self._session = requests.Session()
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2015-08-11 21:56:22 +00:00
|
|
|
def _send(self, data, module):
|
FIX:(#1466) When post-processing if filename did not have issue year or volume, would error, IMP:(#1418) Separate copy/move/hardlink/symlink option for Story arcs, IMP:(#1417) Added story arc format folder to story arc options - can now specify folder format for story arc naming, IMP:(#1374) Added rtorrent_authentication to config.ini allowing user to specify digest/basic authentication, as well as the rpc_url (rtorrent_rpc_url) and ssl (rtorrent_ssl). Rtorrent_host no longer requires protocol in field, IMP: Instead of hitting the intermediary/32P site to get the torrent group, will now retain specific id for torrent group to speed up searches, FIX: (#1472) Fixed some problems with series being searched against 32P which had special characters and would return no results, FIX: Added some specific exception catches when attempting to retrieve search results for nzb providers, FIX: Fixed publisher retaining problem for story arcs (note story arcs will have to be refreshed), FIX: Fixed a problem with the pull-list matching up to the correct series when the issue was an annual for a given series with the alt_pull 2 method (would create an invalid link on the Wanted tab), IMP:(#1470) Added config.ini option to specify folder-formatting for weekly folder numbering, 0=YYYY-WN, 1=YYYY-MM-DD, IMP: (#1471) Added quick check to ensure that newznab host entries do not contain leading/trailing spaces and will strip accordingly, FIX:(#1476) Annuals now have option to add to reading list via the series detail page, IMP: Fixed password fields to allow for special characters within password, IMP: Weekly pull will now correctly show status for previous/future weeks for watchlisted series, IMP: Download option on pullist will work for previous weeks, FIX: Fixed some issues with one-off and story arc post-processing using different file operations, FIX: Fixed error when performing an 'Force Update Active Comics' from the Manage tab (or the scheduled updating of all active comics), IMP: Storyarc issues that are not on watchlist will now retain value for volume to help when searching and file-checking/post-processing, FIX:(#1473) Changed pullist dates on pullist page to unicode to allow for non-English presentation
2016-12-02 17:45:49 +00:00
|
|
|
try:
|
|
|
|
r = self._session.post(self.NMA_URL, data=data, verify=True)
|
|
|
|
except requests.exceptions.RequestException as e:
|
|
|
|
logger.error(module + '[' + str(e) + '] Unable to send via NMA. Aborting notification for this item.')
|
2017-05-12 18:24:35 +00:00
|
|
|
return {'status': False,
|
|
|
|
'message': str(e)}
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2015-10-06 17:16:27 +00:00
|
|
|
logger.fdebug('[NMA] Status code returned: ' + str(r.status_code))
|
2015-08-11 21:56:22 +00:00
|
|
|
if r.status_code == 200:
|
2017-05-12 18:24:35 +00:00
|
|
|
from xml.dom.minidom import parseString
|
|
|
|
dom = parseString(r.content)
|
|
|
|
try:
|
|
|
|
success_info = dom.getElementsByTagName('success')
|
|
|
|
success_code = success_info[0].getAttribute('code')
|
|
|
|
except:
|
|
|
|
error_info = dom.getElementsByTagName('error')
|
|
|
|
error_code = error_info[0].getAttribute('code')
|
|
|
|
error_message = error_info[0].childNodes[0].nodeValue
|
|
|
|
logger.info(module + '[' + str(error_code) + '] ' + error_message)
|
|
|
|
return {'status': False,
|
|
|
|
'message': '[' + str(error_code) + '] ' + error_message}
|
|
|
|
|
|
|
|
else:
|
FIX:(#1630) One-off issues will now be post-processed according to grab-bag dir location, IMP: One-off pull-list issues will now have the status marked accordingly on weekly pullist for tracking purposes, FIX: Fix for utorrent not being able to update status properly after initial snatch, FIX: Fix for some incorrect variable references due to different snatch methods when trying to run on-snatch scripts, FIX: Fix for auto-torrent-snatcher trying to snatch a torrent with an '&' in the filename, FIX:(#1637) Fix for telegram not saving on snatch toggle properly, IMP: added additional logging for metatagging when attempting to create temp folder in cache location, IMP: will now clean up any left over metagtagging directories that fail during normal post-processing instead of leaving and continuing, FIX: Will notify on one-off grab's/storyarc's being post-processed, FIX: fix for displaying cbz issue details (the 'i' on the comic details page) in which the series title contained non-alphanumeric characters, IMP: Added ability to change status to Wanted on Upcoming tab (will perform an immediate search on selected issues), IMP: Threaded the one-off search call from the weeklypull
2017-06-02 14:05:06 +00:00
|
|
|
if self.test is True:
|
|
|
|
logger.info(module + '[' + str(success_code) + '] NotifyMyAndroid apikey valid. Test notification sent successfully.')
|
|
|
|
else:
|
|
|
|
logger.info(module + '[' + str(success_code) + '] NotifyMyAndroid notification sent successfully.')
|
2017-05-12 18:24:35 +00:00
|
|
|
return {'status': True,
|
|
|
|
'message': 'APIKEY verified OK / notification sent'}
|
2015-08-11 21:56:22 +00:00
|
|
|
elif r.status_code >= 400 and r.status_code < 500:
|
|
|
|
logger.error(module + ' NotifyMyAndroid request failed: %s' % r.content)
|
2017-05-12 18:24:35 +00:00
|
|
|
return {'status': False,
|
|
|
|
'message': 'APIKEY verified OK / failure to send notification'}
|
2015-08-11 21:56:22 +00:00
|
|
|
else:
|
2017-05-12 18:24:35 +00:00
|
|
|
logger.error(module + ' NotifyMyAndroid notification failed serverside.')
|
|
|
|
return {'status': False,
|
|
|
|
'message': 'APIKEY verified OK / failure to send notification'}
|
2015-05-22 08:32:51 +00:00
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
def notify(self, snline=None, prline=None, prline2=None, snatched_nzb=None, sent_to=None, prov=None, module=None):
|
|
|
|
|
|
|
|
if module is None:
|
|
|
|
module = ''
|
2015-05-22 08:32:51 +00:00
|
|
|
module += '[NOTIFIER]'
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
|
2013-02-18 17:40:32 +00:00
|
|
|
apikey = self.apikey
|
|
|
|
priority = self.priority
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2013-02-18 17:40:32 +00:00
|
|
|
if snatched_nzb:
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
if snatched_nzb[-1] == '\.': snatched_nzb = snatched_nzb[:-1]
|
|
|
|
event = snline
|
|
|
|
description = "Mylar has snatched: " + snatched_nzb + " from " + prov + " and has sent it to " + sent_to
|
2013-02-18 17:40:32 +00:00
|
|
|
else:
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
event = prline
|
|
|
|
description = prline2
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2015-08-11 21:56:22 +00:00
|
|
|
data = {'apikey': apikey, 'application': 'Mylar', 'event': event.encode('utf-8'), 'description': description.encode('utf-8'), 'priority': priority}
|
2013-02-18 17:40:32 +00:00
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.info(module + ' Sending notification request to NotifyMyAndroid')
|
2015-05-22 08:32:51 +00:00
|
|
|
request = self._send(data, module)
|
|
|
|
|
2013-02-18 17:40:32 +00:00
|
|
|
if not request:
|
2015-05-22 08:32:51 +00:00
|
|
|
logger.warn(module + ' Error sending notification request to NotifyMyAndroid')
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
def test_notify(self):
|
2017-05-12 18:24:35 +00:00
|
|
|
module = '[TEST-NOTIFIER]'
|
|
|
|
try:
|
|
|
|
r = self._session.get(self.TEST_NMA_URL, params={'apikey': self.apikey}, verify=True)
|
|
|
|
except requests.exceptions.RequestException as e:
|
|
|
|
logger.error(module + '[' + str(e) + '] Unable to send via NMA. Aborting test notification - something is probably wrong...')
|
|
|
|
return {'status': False,
|
|
|
|
'message': str(e)}
|
|
|
|
|
|
|
|
logger.fdebug('[NMA] Status code returned: ' + str(r.status_code))
|
|
|
|
if r.status_code == 200:
|
|
|
|
from xml.dom.minidom import parseString
|
|
|
|
dom = parseString(r.content)
|
|
|
|
try:
|
|
|
|
success_info = dom.getElementsByTagName('success')
|
|
|
|
success_code = success_info[0].getAttribute('code')
|
|
|
|
except:
|
|
|
|
error_info = dom.getElementsByTagName('error')
|
|
|
|
error_code = error_info[0].getAttribute('code')
|
|
|
|
error_message = error_info[0].childNodes[0].nodeValue
|
|
|
|
logger.info(module + '[' + str(error_code) + '] ' + error_message)
|
|
|
|
return {'status': False,
|
|
|
|
'message': '[' + str(error_code) + '] ' + error_message}
|
|
|
|
|
|
|
|
else:
|
|
|
|
logger.info(module + '[' + str(success_code) + '] NotifyMyAndroid apikey valid. Testing notification service with it.')
|
|
|
|
elif r.status_code >= 400 and r.status_code < 500:
|
|
|
|
logger.error(module + ' NotifyMyAndroid request failed: %s' % r.content)
|
|
|
|
return {'status': False,
|
|
|
|
'message': 'Unable to send request to NMA - check your connection.'}
|
|
|
|
else:
|
|
|
|
logger.error(module + ' NotifyMyAndroid notification failed serverside.')
|
|
|
|
return {'status': False,
|
|
|
|
'message': 'Internal Server Error. Try again later.'}
|
|
|
|
|
2015-08-11 21:56:22 +00:00
|
|
|
event = 'Test Message'
|
|
|
|
description = 'ZOMG Lazors PewPewPew!'
|
|
|
|
data = {'apikey': self.apikey, 'application': 'Mylar', 'event': event.encode('utf-8'), 'description': description.encode('utf-8'), 'priority': 2}
|
|
|
|
|
|
|
|
return self._send(data,'[NOTIFIER]')
|
2015-07-21 06:37:41 +00:00
|
|
|
|
2013-04-22 04:13:56 +00:00
|
|
|
# 2013-04-01 Added Pushover.net notifications, based on copy of Prowl class above.
|
|
|
|
# No extra care has been put into API friendliness at the moment (read: https://pushover.net/api#friendly)
|
|
|
|
class PUSHOVER:
|
|
|
|
|
FIX:(#1905) Unicode errors when logging and system language is not a subset of english, IMP: Added post-processing queue (currently just for forceProcess api, but will be used by default for all post-processing actions soon), IMP: Multiple Torznab support added, IMP: Logging values for number of files and size/file added to config, IMP: Pushover notifications can be sent to specific device now, IMP: Added nzbget, newznab, nzb.su and dognzb test options, IMP: Added graphical checkmark/x when performing various tests (providers, downloaders, notifiers) within configuration, IMP: Removed some more unnecessary logging lines from searches
2018-04-06 17:46:39 +00:00
|
|
|
def __init__(self, test_apikey=None, test_userkey=None, test_device=None):
|
|
|
|
if all([test_apikey is None, test_userkey is None, test_device is None]):
|
|
|
|
self.PUSHOVER_URL = 'https://api.pushover.net/1/messages.json'
|
2018-07-31 20:12:07 +00:00
|
|
|
self.test = False
|
FIX:(#1905) Unicode errors when logging and system language is not a subset of english, IMP: Added post-processing queue (currently just for forceProcess api, but will be used by default for all post-processing actions soon), IMP: Multiple Torznab support added, IMP: Logging values for number of files and size/file added to config, IMP: Pushover notifications can be sent to specific device now, IMP: Added nzbget, newznab, nzb.su and dognzb test options, IMP: Added graphical checkmark/x when performing various tests (providers, downloaders, notifiers) within configuration, IMP: Removed some more unnecessary logging lines from searches
2018-04-06 17:46:39 +00:00
|
|
|
else:
|
|
|
|
self.PUSHOVER_URL = 'https://api.pushover.net/1/users/validate.json'
|
2018-07-31 20:12:07 +00:00
|
|
|
self.test = True
|
2017-10-25 18:33:56 +00:00
|
|
|
self.enabled = mylar.CONFIG.PUSHOVER_ENABLED
|
2017-06-09 00:23:59 +00:00
|
|
|
if test_apikey is None:
|
2017-10-25 18:33:56 +00:00
|
|
|
if mylar.CONFIG.PUSHOVER_APIKEY is None or mylar.CONFIG.PUSHOVER_APIKEY == 'None':
|
FIX:(#1905) Unicode errors when logging and system language is not a subset of english, IMP: Added post-processing queue (currently just for forceProcess api, but will be used by default for all post-processing actions soon), IMP: Multiple Torznab support added, IMP: Logging values for number of files and size/file added to config, IMP: Pushover notifications can be sent to specific device now, IMP: Added nzbget, newznab, nzb.su and dognzb test options, IMP: Added graphical checkmark/x when performing various tests (providers, downloaders, notifiers) within configuration, IMP: Removed some more unnecessary logging lines from searches
2018-04-06 17:46:39 +00:00
|
|
|
logger.warn('No Pushover Apikey is present. Fix it')
|
|
|
|
return False
|
2017-06-09 00:23:59 +00:00
|
|
|
else:
|
2017-10-25 18:33:56 +00:00
|
|
|
self.apikey = mylar.CONFIG.PUSHOVER_APIKEY
|
2017-06-09 00:23:59 +00:00
|
|
|
else:
|
|
|
|
self.apikey = test_apikey
|
|
|
|
|
FIX:(#1905) Unicode errors when logging and system language is not a subset of english, IMP: Added post-processing queue (currently just for forceProcess api, but will be used by default for all post-processing actions soon), IMP: Multiple Torznab support added, IMP: Logging values for number of files and size/file added to config, IMP: Pushover notifications can be sent to specific device now, IMP: Added nzbget, newznab, nzb.su and dognzb test options, IMP: Added graphical checkmark/x when performing various tests (providers, downloaders, notifiers) within configuration, IMP: Removed some more unnecessary logging lines from searches
2018-04-06 17:46:39 +00:00
|
|
|
if test_device is None:
|
|
|
|
self.device = mylar.CONFIG.PUSHOVER_DEVICE
|
|
|
|
else:
|
|
|
|
self.device = test_device
|
|
|
|
|
2017-06-09 00:23:59 +00:00
|
|
|
if test_userkey is None:
|
2017-10-25 18:33:56 +00:00
|
|
|
self.userkey = mylar.CONFIG.PUSHOVER_USERKEY
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
else:
|
2017-06-09 00:23:59 +00:00
|
|
|
self.userkey = test_userkey
|
|
|
|
|
2017-10-25 18:33:56 +00:00
|
|
|
self.priority = mylar.CONFIG.PUSHOVER_PRIORITY
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2015-10-06 17:16:27 +00:00
|
|
|
self._session = requests.Session()
|
|
|
|
self._session.headers = {'Content-type': "application/x-www-form-urlencoded"}
|
2013-04-22 04:13:56 +00:00
|
|
|
|
2016-09-11 21:48:01 +00:00
|
|
|
def notify(self, event, message=None, snatched_nzb=None, prov=None, sent_to=None, module=None):
|
2018-07-31 20:12:07 +00:00
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
if module is None:
|
|
|
|
module = ''
|
|
|
|
module += '[NOTIFIER]'
|
2013-04-22 04:13:56 +00:00
|
|
|
|
2016-09-11 21:48:01 +00:00
|
|
|
if snatched_nzb:
|
|
|
|
if snatched_nzb[-1] == '\.':
|
|
|
|
snatched_nzb = snatched_nzb[:-1]
|
|
|
|
message = "Mylar has snatched: " + snatched_nzb + " from " + prov + " and has sent it to " + sent_to
|
|
|
|
|
2017-10-25 18:33:56 +00:00
|
|
|
data = {'token': mylar.CONFIG.PUSHOVER_APIKEY,
|
|
|
|
'user': mylar.CONFIG.PUSHOVER_USERKEY,
|
2013-04-22 04:13:56 +00:00
|
|
|
'message': message.encode("utf-8"),
|
|
|
|
'title': event,
|
2017-10-25 18:33:56 +00:00
|
|
|
'priority': mylar.CONFIG.PUSHOVER_PRIORITY}
|
2013-04-22 04:13:56 +00:00
|
|
|
|
FIX:(#1905) Unicode errors when logging and system language is not a subset of english, IMP: Added post-processing queue (currently just for forceProcess api, but will be used by default for all post-processing actions soon), IMP: Multiple Torznab support added, IMP: Logging values for number of files and size/file added to config, IMP: Pushover notifications can be sent to specific device now, IMP: Added nzbget, newznab, nzb.su and dognzb test options, IMP: Added graphical checkmark/x when performing various tests (providers, downloaders, notifiers) within configuration, IMP: Removed some more unnecessary logging lines from searches
2018-04-06 17:46:39 +00:00
|
|
|
if all([self.device is not None, self.device != 'None']):
|
|
|
|
data.update({'device': self.device})
|
|
|
|
|
FIX: One-off Failed Download handling will now work, IMP: Some better error handling when detecting one-off's during post-processing, FIX:(#1143) When series contained a digit preceded by a dash, would incorrectly assume it as a negative issue number, FIX: Improved being able to detect corresponding annuals on CV when refreshing/importing a series when the annuals are new (ie. no data on CV), FIX: Alt_Pull method for weekly pull list retrieval working again, FIX: Fixed nzbid detection for experimental search, IMP: Mass Import button now available on Import Results screen (will attempt to import all series that are in a 'Not Imported' status), IMP: When searching for arc issues using the 'Search for Missing' option, the call is now threaded so it runs in the background, IMP: Changed IssueYear to IssueDate for Story Arc Issues on the arc details page, FIX:(#1156) Typo that caused error when attempting to view cbz comics in the series detail page, FIX:(#1145) Select All option via top checkbox (on series detail page), FIX: Auto-Want feature via weeklypull will better match to titles that contain 'the' and have hypens in differing character positions, FIX:(#1160) Would incorrectly take the length of a decimal placed issue when searching and never complete the issue number cylcing search, FIX:(#1161) When annuals not enabled, and series in watchlist and series annual in pullist, would error out trying to link series to pullist.
2015-11-18 06:32:40 +00:00
|
|
|
r = self._session.post(self.PUSHOVER_URL, data=data, verify=True)
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
|
2015-10-06 17:16:27 +00:00
|
|
|
if r.status_code == 200:
|
FIX:(#1905) Unicode errors when logging and system language is not a subset of english, IMP: Added post-processing queue (currently just for forceProcess api, but will be used by default for all post-processing actions soon), IMP: Multiple Torznab support added, IMP: Logging values for number of files and size/file added to config, IMP: Pushover notifications can be sent to specific device now, IMP: Added nzbget, newznab, nzb.su and dognzb test options, IMP: Added graphical checkmark/x when performing various tests (providers, downloaders, notifiers) within configuration, IMP: Removed some more unnecessary logging lines from searches
2018-04-06 17:46:39 +00:00
|
|
|
try:
|
|
|
|
response = r.json()
|
2018-07-31 20:12:07 +00:00
|
|
|
if 'devices' in response and self.test is True:
|
|
|
|
logger.fdebug('%s Available devices: %s' % (module, response))
|
|
|
|
if any([self.device is None, self.device == 'None']):
|
|
|
|
self.device = 'all available devices'
|
|
|
|
|
|
|
|
r = self._session.post('https://api.pushover.net/1/messages.json', data=data, verify=True)
|
|
|
|
if r.status_code == 200:
|
|
|
|
logger.info('%s PushOver notifications sent to %s.' % (module, self.device))
|
|
|
|
elif r.status_code >=400 and r.status_code < 500:
|
|
|
|
logger.error('%s PushOver request failed to %s: %s' % (module, self.device, r.content))
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
logger.error('%s PushOver notification failed serverside.' % module)
|
|
|
|
return False
|
FIX:(#1905) Unicode errors when logging and system language is not a subset of english, IMP: Added post-processing queue (currently just for forceProcess api, but will be used by default for all post-processing actions soon), IMP: Multiple Torznab support added, IMP: Logging values for number of files and size/file added to config, IMP: Pushover notifications can be sent to specific device now, IMP: Added nzbget, newznab, nzb.su and dognzb test options, IMP: Added graphical checkmark/x when performing various tests (providers, downloaders, notifiers) within configuration, IMP: Removed some more unnecessary logging lines from searches
2018-04-06 17:46:39 +00:00
|
|
|
else:
|
|
|
|
logger.info('%s PushOver notifications sent.' % module)
|
|
|
|
except Exception as e:
|
|
|
|
logger.warn('%s[ERROR] - %s' % (module, e))
|
2018-07-31 20:12:07 +00:00
|
|
|
return False
|
|
|
|
else:
|
|
|
|
return True
|
2015-10-06 17:16:27 +00:00
|
|
|
elif r.status_code >= 400 and r.status_code < 500:
|
2018-07-31 20:12:07 +00:00
|
|
|
logger.error('%s PushOver request failed: %s' % (module, r.content))
|
2015-10-06 17:16:27 +00:00
|
|
|
return False
|
2013-04-22 04:13:56 +00:00
|
|
|
else:
|
2018-07-31 20:12:07 +00:00
|
|
|
logger.error('%s PushOver notification failed serverside.' % module)
|
2015-10-06 17:16:27 +00:00
|
|
|
return False
|
2013-04-22 04:13:56 +00:00
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
def test_notify(self):
|
2018-07-31 20:12:07 +00:00
|
|
|
return self.notify(event='Test Message', message='Release the Ninjas!')
|
2013-09-07 06:05:32 +00:00
|
|
|
|
|
|
|
class BOXCAR:
|
|
|
|
|
2015-05-22 08:32:51 +00:00
|
|
|
#new BoxCar2 API
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
def __init__(self):
|
|
|
|
|
|
|
|
self.url = 'https://new.boxcar.io/api/notifications'
|
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
def _sendBoxcar(self, msg, title, module):
|
2013-09-07 06:05:32 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
Sends a boxcar notification to the address provided
|
|
|
|
|
|
|
|
msg: The message to send (unicode)
|
|
|
|
title: The title of the message
|
|
|
|
|
|
|
|
returns: True if the message succeeded, False otherwise
|
|
|
|
"""
|
|
|
|
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
try:
|
2013-09-07 06:05:32 +00:00
|
|
|
|
|
|
|
data = urllib.urlencode({
|
2017-10-25 18:33:56 +00:00
|
|
|
'user_credentials': mylar.CONFIG.BOXCAR_TOKEN,
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
'notification[title]': title.encode('utf-8').strip(),
|
2014-08-08 06:52:38 +00:00
|
|
|
'notification[long_message]': msg.encode('utf-8'),
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
'notification[sound]': "done"
|
2013-09-07 06:05:32 +00:00
|
|
|
})
|
|
|
|
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
req = urllib2.Request(self.url)
|
2013-09-07 06:05:32 +00:00
|
|
|
handle = urllib2.urlopen(req, data)
|
|
|
|
handle.close()
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
return True
|
2013-09-07 06:05:32 +00:00
|
|
|
|
|
|
|
except urllib2.URLError, e:
|
|
|
|
# if we get an error back that doesn't have an error code then who knows what's really happening
|
|
|
|
if not hasattr(e, 'code'):
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.error(module + 'Boxcar2 notification failed. %s' % e)
|
2013-09-07 06:05:32 +00:00
|
|
|
# If you receive an HTTP status code of 400, it is because you failed to send the proper parameters
|
|
|
|
elif e.code == 400:
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.info(module + ' Wrong data sent to boxcar')
|
|
|
|
logger.info(module + ' data:' + data)
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
else:
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.error(module + ' Boxcar2 notification failed. Error code: ' + str(e.code))
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
return False
|
2013-09-07 06:05:32 +00:00
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.fdebug(module + ' Boxcar2 notification successful.')
|
2013-09-07 06:05:32 +00:00
|
|
|
return True
|
|
|
|
|
2014-11-19 20:50:49 +00:00
|
|
|
def notify(self, prline=None, prline2=None, sent_to=None, snatched_nzb=None, force=False, module=None, snline=None):
|
2013-09-07 06:05:32 +00:00
|
|
|
"""
|
|
|
|
Sends a boxcar notification based on the provided info or SB config
|
|
|
|
|
|
|
|
title: The title of the notification to send
|
|
|
|
message: The message string to send
|
|
|
|
force: If True then the notification will be sent even if Boxcar is disabled in the config
|
|
|
|
"""
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
if module is None:
|
|
|
|
module = ''
|
|
|
|
module += '[NOTIFIER]'
|
2013-09-07 06:05:32 +00:00
|
|
|
|
2017-10-25 18:33:56 +00:00
|
|
|
if not mylar.CONFIG.BOXCAR_ENABLED and not force:
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.fdebug(module + ' Notification for Boxcar not enabled, skipping this notification.')
|
2013-09-07 06:05:32 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
# if no username was given then use the one from the config
|
|
|
|
if snatched_nzb:
|
2014-11-19 20:50:49 +00:00
|
|
|
title = snline
|
2013-09-07 06:05:32 +00:00
|
|
|
message = "Mylar has snatched: " + snatched_nzb + " and has sent it to " + sent_to
|
|
|
|
else:
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
title = prline
|
|
|
|
message = prline2
|
2013-09-07 06:05:32 +00:00
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
logger.info(module + ' Sending notification to Boxcar2')
|
2013-09-07 06:05:32 +00:00
|
|
|
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
self._sendBoxcar(message, title, module)
|
2013-09-07 06:05:32 +00:00
|
|
|
return True
|
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
def test_notify(self):
|
|
|
|
self.notify(prline='Test Message',prline2='ZOMG Lazors Pewpewpew!')
|
|
|
|
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
class PUSHBULLET:
|
|
|
|
|
2017-05-12 18:24:35 +00:00
|
|
|
def __init__(self, test_apikey=None):
|
2015-07-21 06:37:41 +00:00
|
|
|
self.PUSH_URL = "https://api.pushbullet.com/v2/pushes"
|
2017-05-12 18:24:35 +00:00
|
|
|
if test_apikey is None:
|
2017-10-25 18:33:56 +00:00
|
|
|
self.apikey = mylar.CONFIG.PUSHBULLET_APIKEY
|
2017-05-12 18:24:35 +00:00
|
|
|
else:
|
|
|
|
self.apikey = test_apikey
|
2017-10-25 18:33:56 +00:00
|
|
|
self.deviceid = mylar.CONFIG.PUSHBULLET_DEVICEID
|
|
|
|
self.channel_tag = mylar.CONFIG.PUSHBULLET_CHANNEL_TAG
|
2015-08-19 18:12:20 +00:00
|
|
|
self._json_header = {'Content-Type': 'application/json',
|
2017-05-12 18:24:35 +00:00
|
|
|
'Authorization': 'Basic %s' % base64.b64encode(self.apikey + ":")}
|
2015-07-21 06:37:41 +00:00
|
|
|
self._session = requests.Session()
|
|
|
|
self._session.headers.update(self._json_header)
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
def get_devices(self, api):
|
|
|
|
return self.notify(method="GET")
|
|
|
|
|
|
|
|
def notify(self, snline=None, prline=None, prline2=None, snatched=None, sent_to=None, prov=None, module=None, method=None):
|
IMP:(#753) Better handling of cbz files when using metatagging option, IMP: Added option for MetaTagging to enable/disable overwriting of existing metadata on cbz files, IMP: Post-Processing will now delete folders that are identical to filenames after successful post-processing, FIX:(#756) Fix for Manual Search for an Issue which resulted in traceback errors upon not finding any matches (Windows), IMP: Added module-name to logging for some modules to help troubleshooting (eventually all will be done), IMP: If a filename contained repeated characters for spaces (ie. ___ or ...), it would fail on post-processing due to the nzbname being off, IMP: Monitoring of CV API will now be persitent on restarts/shutdowns/etc, IMP: Added a maximum CV API global so that it can be adjusted for monitoring more easily should API requirements change, IMP: When Adding new series, will now only mark issues that are actually upcoming as Wanted (based on Store Date)
2014-06-22 08:32:45 +00:00
|
|
|
if module is None:
|
|
|
|
module = ''
|
|
|
|
module += '[NOTIFIER]'
|
2015-07-21 06:37:41 +00:00
|
|
|
|
|
|
|
# http_handler = HTTPSConnection("api.pushbullet.com")
|
2015-05-22 08:32:51 +00:00
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
# if method == 'GET':
|
|
|
|
# uri = '/v2/devices'
|
|
|
|
# else:
|
|
|
|
# method = 'POST'
|
|
|
|
# uri = '/v2/pushes'
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
# authString = base64.b64encode(self.apikey + ":")
|
2015-01-31 22:21:42 +00:00
|
|
|
|
|
|
|
if method == 'GET':
|
2015-07-21 06:37:41 +00:00
|
|
|
pass
|
|
|
|
# http_handler.request(method, uri, None, headers={'Authorization': 'Basic %s:' % authString})
|
2015-01-31 22:21:42 +00:00
|
|
|
else:
|
|
|
|
if snatched:
|
|
|
|
if snatched[-1] == '.': snatched = snatched[:-1]
|
|
|
|
event = snline
|
|
|
|
message = "Mylar has snatched: " + snatched + " from " + prov + " and has sent it to " + sent_to
|
|
|
|
else:
|
|
|
|
event = prline + ' complete!'
|
|
|
|
message = prline2
|
|
|
|
|
|
|
|
data = {'type': "note", #'device_iden': self.deviceid,
|
|
|
|
'title': event.encode('utf-8'), #"mylar",
|
2015-05-22 08:32:51 +00:00
|
|
|
'body': message.encode('utf-8')}
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
|
2017-07-18 04:26:40 +00:00
|
|
|
if self.channel_tag:
|
|
|
|
data['channel_tag'] = self.channel_tag
|
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
r = self._session.post(self.PUSH_URL, data=json.dumps(data))
|
2017-05-12 18:24:35 +00:00
|
|
|
dt = r.json()
|
2015-07-21 06:37:41 +00:00
|
|
|
if r.status_code == 200:
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
if method == 'GET':
|
2017-05-12 18:24:35 +00:00
|
|
|
return dt
|
IMP: (#844)Annuals now deleted from table on a Delete Series command, IMP: (#837)Better volume detection when searching for issues, IMP: (#842)(#808) Added some handling for issue titles when searching (it's not perfect, but it works for most), IMP: (#836)Added .cb7 for filechecking purposes only, IMP: (#830)issue numbers that are -1 can now be renamed, FIX: 'bi-annual' now fixed along with some other improvements for annual handling, IMP: Added version check for autoProcessComics and ComicRN - in order to help warn users of changes and the need to update these files since they are usually outside of the mylar git directory when being used, FIX:(#840) Boxcar2 should be working again, FIX: (#845) If search returned a filename that had no distinction between issue number and issue title and/or extra information, would error out if any of the words contained NOW, IMP: (#823) Added some better detection for NZBGet parameters when using ComicRN.py
2014-10-06 18:10:36 +00:00
|
|
|
else:
|
2015-01-31 22:21:42 +00:00
|
|
|
logger.info(module + ' PushBullet notifications sent.')
|
2017-05-12 18:24:35 +00:00
|
|
|
return {'status': True,
|
|
|
|
'message': 'APIKEY verified OK / notification sent'}
|
2015-07-21 06:37:41 +00:00
|
|
|
elif r.status_code >= 400 and r.status_code < 500:
|
|
|
|
logger.error(module + ' PushBullet request failed: %s' % r.content)
|
2017-05-12 18:24:35 +00:00
|
|
|
return {'status': False,
|
|
|
|
'message': '[' + str(r.status_code) + '] ' + dt['error']['message']}
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
else:
|
2017-05-12 18:24:35 +00:00
|
|
|
logger.error(module + ' PushBullet notification failed serverside: %s' % r.content)
|
|
|
|
return {'status': False,
|
|
|
|
'message': '[' + str(r.status_code) + '] ' + dt['error']['message']}
|
IMP: Ability to now specify search provider order (regardless of torrents or nzb) within the config.ini, IMP: (#667) Changed the db module to try to accomodate db locking errors and lowering the amount of actual write transactions that were committed along with a new scheduler system, IMP: Changed sabnzbd directory to post-processing, and included subdirs for sabnzbd & nzbget ComicRN scripts, IMP: NZBGet Post-Processing ComicRN.py script (updated for use with nzbget v11.0+)added & updated in post-processing/nzbget directory (thnx ministoat), FIX: If Issue Location was None, and status was Downloaded would cause error in GUI and break series, IMP: (#689) Minimum # of seeders added (will work with KAT), IMP: (#680) Added Boxcar 2 IO Notifications, IMP: Added PushBullet Notifications, IMP: Cleaned up some notification messages so it's not so cluttered, IMP: Added Clickable series link in History tab, IMP: Added Post-Processed as a status to History tab to show manually post-processed items, IMP: Removed log level dropdown from Logs page & added 'ThreadName' as a column, IMP: Added Force Check Availability & View Future Pull-list to Upcoming sub-tabs, IMP: Added '--safe' option to startup options which will redirect directly to Manage Comics screen incase things are broken, FIX: Added proper month conversions for manual post-processing when doing comparitive issue analysis for matches, FIX: (#613) Allow for negative issue numbers in post-processing when renaming and issue padding is enabled, FIX: File Permissions on post-processing would stop post-processing if couldn't change, now will just log the error and continue, IMP: Added Scheduler (from sickbeard) to allow for threadnaming and better scheduling, IMP: Filenames in the format of ' () ' will now get scanned in, IMP: During manual post-processing will now stop looking for matches upon a successful match, IMP: A Refresh/Weeklypull series check will now just scan in issue data, instead of series info,etc, IMP: Removed some legacy GCD code that is no longer in use, IMP: Exception/traceback handling will now be logged, FIX: Unable to grab torrents from KAT due to content-encoding detection failing, IMP: Added universal date-time conversion to allow for non-english based dates to be properly compared when checking search results against publication dates, FIX: Annuals will now get proper notification (prior was leaving out the word 'annual' from notification/logs), IMP: Improved future pull-list detection and increased retension (now ~5 months), IMP: Will now mark new issues as Wanted on a Refresh Series if autowant upcoming is enabled (was reverting to a status of None previously), IMP: Cannot change status to Downloaded if current status is Skipped or Wanted, FIX: (#704) UnSkipped will now work (X in options column on comic details page), IMP: future_check will check upcoming future issues (future pull-list) that have no series data yet (ie. #1's) and auto-add them to watchlist when the data is available and auto-want accordingly, IMP: (#706) Downloading issues to local machine (via comicdetails screen) with special characters in filename now will work, IMP: improved comparison checks during weekly pull list and improved speed abit since only refreshing issue data now instead of entire series, Other Referenced issues: (#670)(#690) and some others....
2014-05-25 18:32:11 +00:00
|
|
|
|
2015-07-21 06:37:41 +00:00
|
|
|
def test_notify(self):
|
2015-08-19 18:12:20 +00:00
|
|
|
return self.notify(prline='Test Message', prline2='Release the Ninjas!')
|
2013-09-07 06:05:32 +00:00
|
|
|
|
2016-11-08 08:11:51 +00:00
|
|
|
class TELEGRAM:
|
2017-06-09 00:23:59 +00:00
|
|
|
def __init__(self, test_userid=None, test_token=None):
|
2016-11-08 08:11:51 +00:00
|
|
|
self.TELEGRAM_API = "https://api.telegram.org/bot%s/%s"
|
2017-06-09 00:23:59 +00:00
|
|
|
if test_userid is None:
|
2017-10-25 18:33:56 +00:00
|
|
|
self.userid = mylar.CONFIG.TELEGRAM_USERID
|
2017-06-09 00:23:59 +00:00
|
|
|
else:
|
|
|
|
self.userid = test_userid
|
|
|
|
if test_token is None:
|
2017-10-25 18:33:56 +00:00
|
|
|
self.token = mylar.CONFIG.TELEGRAM_TOKEN
|
2017-06-09 00:23:59 +00:00
|
|
|
else:
|
|
|
|
self.token = test_token
|
2016-11-08 08:11:51 +00:00
|
|
|
|
2018-02-27 18:06:28 +00:00
|
|
|
def notify(self, message):
|
2016-11-08 08:11:51 +00:00
|
|
|
# Construct message
|
2018-02-27 18:06:28 +00:00
|
|
|
payload = {'chat_id': self.userid, 'text': message}
|
2016-11-08 08:11:51 +00:00
|
|
|
|
|
|
|
# Send message to user using Telegram's Bot API
|
|
|
|
try:
|
2017-05-16 18:15:11 +00:00
|
|
|
response = requests.post(self.TELEGRAM_API % (self.token, "sendMessage"), json=payload, verify=True)
|
2016-11-08 08:11:51 +00:00
|
|
|
except Exception, e:
|
|
|
|
logger.info(u'Telegram notify failed: ' + str(e))
|
|
|
|
|
|
|
|
# Error logging
|
|
|
|
sent_successfuly = True
|
|
|
|
if not response.status_code == 200:
|
2017-05-16 18:15:11 +00:00
|
|
|
logger.info(u'Could not send notification to TelegramBot (token=%s). Response: [%s]' % (self.token, response.text))
|
2016-11-08 08:11:51 +00:00
|
|
|
sent_successfuly = False
|
|
|
|
|
|
|
|
logger.info(u"Telegram notifications sent.")
|
|
|
|
return sent_successfuly
|
|
|
|
|
|
|
|
def test_notify(self):
|
2018-02-27 18:06:28 +00:00
|
|
|
return self.notify('Test Message: Release the Ninjas!')
|
2017-06-20 02:05:53 +00:00
|
|
|
|
|
|
|
class SLACK:
|
|
|
|
def __init__(self, test_webhook_url=None):
|
2017-10-25 18:33:56 +00:00
|
|
|
self.webhook_url = mylar.CONFIG.SLACK_WEBHOOK_URL if test_webhook_url is None else test_webhook_url
|
2017-06-20 02:05:53 +00:00
|
|
|
|
|
|
|
def notify(self, text, attachment_text, module=None):
|
|
|
|
if module is None:
|
|
|
|
module = ''
|
|
|
|
module += '[NOTIFIER]'
|
|
|
|
|
|
|
|
payload = {
|
2018-02-26 15:22:34 +00:00
|
|
|
# "text": text,
|
|
|
|
# "attachments": [
|
|
|
|
# {
|
|
|
|
# "color": "#36a64f",
|
|
|
|
# "text": attachment_text
|
|
|
|
# }
|
|
|
|
# ]
|
|
|
|
# FIX: #1861 move notif from attachment to msg body - bbq
|
|
|
|
"text": attachment_text
|
2017-06-20 02:05:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try:
|
|
|
|
response = requests.post(self.webhook_url, json=payload, verify=True)
|
|
|
|
except Exception, e:
|
|
|
|
logger.info(module + u'Slack notify failed: ' + str(e))
|
|
|
|
|
|
|
|
# Error logging
|
|
|
|
sent_successfuly = True
|
|
|
|
if not response.status_code == 200:
|
|
|
|
logger.info(module + u'Could not send notification to Slack (webhook_url=%s). Response: [%s]' % (self.webhook_url, response.text))
|
|
|
|
sent_successfuly = False
|
|
|
|
|
|
|
|
logger.info(module + u"Slack notifications sent.")
|
|
|
|
return sent_successfuly
|
2018-07-31 20:12:07 +00:00
|
|
|
|
2017-06-20 02:05:53 +00:00
|
|
|
def test_notify(self):
|
|
|
|
return self.notify('Test Message', 'Release the Ninjas!')
|