IMP:(#1680) Added Pushbullet Channel Support

This commit is contained in:
davalanche 2017-07-17 22:26:40 -06:00 committed by evilhero
parent 41f6c4d5e3
commit da8bec9bf1
4 changed files with 15 additions and 2 deletions

4
data/interfaces/default/config.html Executable file → Normal file
View File

@ -1259,6 +1259,10 @@
<input type="button" class="btn" value="Update device list" id="getPushbulletDevices" />
-->
</div>
<div class="row">
<label>Channel Tag</label><input type="text" name="pushbullet_channel_tag" id="pushbullet_channel_tag" value="${config['pushbullet_channel_tag']}" size="50">
<small>Send to all subscribers of the channel with this tag (Optional)</small>
</div>
<div align="center" class="row">
<input type="button" value="Test Pushbullet" id="pushbullet_test" style="float:center" /></br>
<input type="text" name="pbstatus" style="text-align:center; font-size:11px;" id="pbstatus" size="55" DISABLED />

5
mylar/__init__.py Executable file → Normal file
View File

@ -223,6 +223,7 @@ BOXCAR_TOKEN = None
PUSHBULLET_ENABLED = False
PUSHBULLET_APIKEY = None
PUSHBULLET_DEVICEID = None
PUSHBULLET_CHANNEL_TAG = None
PUSHBULLET_ONSNATCH = False
TELEGRAM_ENABLED = False
TELEGRAM_TOKEN = None
@ -516,7 +517,7 @@ def initialize():
ALLOW_PACKS, ENABLE_TORRENTS, TORRENT_DOWNLOADER, MINSEEDS, USE_WATCHDIR, TORRENT_LOCAL, LOCAL_WATCHDIR, TORRENT_SEEDBOX, SEEDBOX_HOST, SEEDBOX_PORT, SEEDBOX_USER, SEEDBOX_PASS, SEEDBOX_WATCHDIR, \
ENABLE_RSS, RSS_CHECKINTERVAL, RSS_LASTRUN, FAILED_DOWNLOAD_HANDLING, FAILED_AUTO, ENABLE_TORRENT_SEARCH, ENABLE_TPSE, TPSE_PROXY, TPSE_VERIFY, ENABLE_32P, SEARCH_32P, MODE_32P, KEYS_32P, RSSFEED_32P, USERNAME_32P, PASSWORD_32P, AUTHKEY_32P, PASSKEY_32P, FEEDINFO_32P, VERIFY_32P, SNATCHEDTORRENT_NOTIFY, \
PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_APIKEY, PUSHOVER_USERKEY, PUSHOVER_ONSNATCH, BOXCAR_ENABLED, BOXCAR_ONSNATCH, BOXCAR_TOKEN, \
PUSHBULLET_ENABLED, PUSHBULLET_APIKEY, PUSHBULLET_DEVICEID, PUSHBULLET_ONSNATCH, LOCMOVE, NEWCOM_DIR, FFTONEWCOM_DIR, \
PUSHBULLET_ENABLED, PUSHBULLET_APIKEY, PUSHBULLET_DEVICEID, PUSHBULLET_CHANNEL_TAG, PUSHBULLET_ONSNATCH, LOCMOVE, NEWCOM_DIR, FFTONEWCOM_DIR, \
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, LOWERCASE_FILENAMES, USE_MINSIZE, MINSIZE, USE_MAXSIZE, MAXSIZE, CORRECT_METADATA, \
FOLDER_FORMAT, SETDEFAULTVOLUME, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, ADD_TO_CSV, CVINFO, LOG_LEVEL, POST_PROCESSING, POST_PROCESSING_SCRIPT, \
FILE_OPTS, SEARCH_DELAY, GRABBAG_DIR, READ2FILENAME, SEND2READ, MAINTAINSERIESFOLDER, TAB_ENABLE, TAB_HOST, TAB_USER, TAB_PASS, TAB_DIRECTORY, \
@ -697,6 +698,7 @@ def initialize():
PUSHBULLET_ENABLED = bool(check_setting_int(CFG, 'PUSHBULLET', 'pushbullet_enabled', 0))
PUSHBULLET_APIKEY = check_setting_str(CFG, 'PUSHBULLET', 'pushbullet_apikey', '')
PUSHBULLET_DEVICEID = check_setting_str(CFG, 'PUSHBULLET', 'pushbullet_deviceid', '')
PUSHBULLET_CHANNEL_TAG = check_setting_str(CFG, 'PUSHBULLET', 'pushbullet_channel_tag', '')
PUSHBULLET_ONSNATCH = bool(check_setting_int(CFG, 'PUSHBULLET', 'pushbullet_onsnatch', 0))
TELEGRAM_ENABLED = bool(check_setting_int(CFG, 'TELEGRAM', 'telegram_enabled', 0))
@ -1716,6 +1718,7 @@ def config_write():
new_config['PUSHBULLET']['pushbullet_enabled'] = int(PUSHBULLET_ENABLED)
new_config['PUSHBULLET']['pushbullet_apikey'] = PUSHBULLET_APIKEY
new_config['PUSHBULLET']['pushbullet_deviceid'] = PUSHBULLET_DEVICEID
new_config['PUSHBULLET']['pushbullet_channel_tag'] = PUSHBULLET_CHANNEL_TAG
new_config['PUSHBULLET']['pushbullet_onsnatch'] = int(PUSHBULLET_ONSNATCH)
new_config['TELEGRAM'] = {}

View File

@ -347,6 +347,7 @@ class PUSHBULLET:
else:
self.apikey = test_apikey
self.deviceid = mylar.PUSHBULLET_DEVICEID
self.channel_tag = mylar.PUSHBULLET_CHANNEL_TAG
self._json_header = {'Content-Type': 'application/json',
'Authorization': 'Basic %s' % base64.b64encode(self.apikey + ":")}
self._session = requests.Session()
@ -386,6 +387,9 @@ class PUSHBULLET:
'title': event.encode('utf-8'), #"mylar",
'body': message.encode('utf-8')}
if self.channel_tag:
data['channel_tag'] = self.channel_tag
r = self._session.post(self.PUSH_URL, data=json.dumps(data))
dt = r.json()
if r.status_code == 200:

View File

@ -4298,6 +4298,7 @@ class WebInterface(object):
"pushbullet_onsnatch": helpers.checked(mylar.PUSHBULLET_ONSNATCH),
"pushbullet_apikey": mylar.PUSHBULLET_APIKEY,
"pushbullet_deviceid": mylar.PUSHBULLET_DEVICEID,
"pushbullet_channel_tag": mylar.PUSHBULLET_CHANNEL_TAG,
"telegram_enabled": helpers.checked(mylar.TELEGRAM_ENABLED),
"telegram_onsnatch": helpers.checked(mylar.TELEGRAM_ONSNATCH),
"telegram_token": mylar.TELEGRAM_TOKEN,
@ -4546,7 +4547,7 @@ class WebInterface(object):
enable_meta=0, cbr2cbz_only=0, cmtagger_path=None, ct_tag_cr=0, ct_tag_cbl=0, ct_cbz_overwrite=0, unrar_cmd=None, enable_rss=0, rss_checkinterval=None, failed_download_handling=0, failed_auto=0, enable_torrent_search=0, enable_tpse=0, enable_32p=0, mode_32p=0, rssfeed_32p=None, passkey_32p=None, username_32p=None, password_32p=None, snatchedtorrent_notify=0,
enable_torrents=0, minseeds=0, local_watchdir=None, seedbox_watchdir=None, seedbox_user=None, seedbox_pass=None, seedbox_host=None, seedbox_port=None,
prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=None, nma_enabled=0, nma_apikey=None, nma_priority=0, nma_onsnatch=0, pushover_enabled=0, pushover_onsnatch=0, pushover_apikey=None, pushover_userkey=None, pushover_priority=None, boxcar_enabled=0, boxcar_onsnatch=0, boxcar_token=None,
pushbullet_enabled=0, pushbullet_apikey=None, pushbullet_deviceid=None, pushbullet_onsnatch=0, telegram_enabled=0, telegram_token=None, telegram_userid=None, telegram_onsnatch=0, torrent_downloader=0, torrent_local=0, torrent_seedbox=0, utorrent_host=None, utorrent_username=None, utorrent_password=None, utorrent_label=None,
pushbullet_enabled=0, pushbullet_apikey=None, pushbullet_deviceid=None, pushbullet_channel_tag=None, pushbullet_onsnatch=0, telegram_enabled=0, telegram_token=None, telegram_userid=None, telegram_onsnatch=0, torrent_downloader=0, torrent_local=0, torrent_seedbox=0, utorrent_host=None, utorrent_username=None, utorrent_password=None, utorrent_label=None,
rtorrent_host=None, rtorrent_ssl=0, rtorrent_verify=0, rtorrent_authentication='basic', rtorrent_rpc_url=None, rtorrent_username=None, rtorrent_password=None, rtorrent_directory=None, rtorrent_label=None, rtorrent_startonload=0, transmission_host=None, transmission_username=None, transmission_password=None, transmission_directory=None,deluge_host=None, deluge_username=None, deluge_password=None, deluge_label=None,
qbittorrent_host=None, qbittorrent_username=None, qbittorrent_password=None, qbittorrent_label=None, qbittorrent_folder=None, qbittorrent_startonload=0,
preferred_quality=0, move_files=0, rename_files=0, add_to_csv=1, cvinfo=0, lowercase_filenames=0, folder_format=None, file_format=None, enable_extra_scripts=0, extra_scripts=None, enable_snatch_script=0, snatch_script=None, enable_pre_scripts=0, pre_scripts=None, post_processing=0, file_opts=None, syno_fix=0, search_delay=None, enforce_perms=0, chmod_dir=0777, chmod_file=0660, chowner=None, chgroup=None,
@ -4689,6 +4690,7 @@ class WebInterface(object):
mylar.PUSHBULLET_ENABLED = pushbullet_enabled
mylar.PUSHBULLET_APIKEY = pushbullet_apikey
mylar.PUSHBULLET_DEVICEID = pushbullet_deviceid
mylar.PUSHBULLET_CHANNEL_TAG = pushbullet_channel_tag
mylar.PUSHBULLET_ONSNATCH = pushbullet_onsnatch
mylar.TELEGRAM_ENABLED = telegram_enabled
mylar.TELEGRAM_TOKEN = telegram_token